Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Availability of Python types for SeleniumBase? #3239

albertkim started this conversation in General
Discussion options

I'm a big fan of my IDE knowing that types/functions are available as I'm coding. However, right from the start with code like

 with SB(uc=True, headless=True) as sb:
 sb.get(params["start_url"])

VSCode thinks that the sb type is Unknown, meaning that there is no auto-complete for any function names called on sb. I'm wondering if I'm doing something wrong here, or if types are just not a part of this library.

You must be logged in to vote

Replies: 1 comment 2 replies

Comment options

That depends on the SeleniumBase Syntax Format used. With the BaseCase and sb pytest fixture formats, the IDE knows the base methods. In the case of the SB() and Driver() formats, the methods are determined at runtime, so if uc=True, then the UC Mode methods appear. If activating CDP Mode, then more methods appear.

When using the Python debugger, you'll see all the methods. Set a breakpoint(), to get realtime auto-completion for the methods.

This assumes you're looking for the methods, rather than the types associated.
For the types, that can be found in the SB() and Driver() docstrings. Eg:

>>> from seleniumbase import Driver
>>> help(Driver) 
You must be logged in to vote
2 replies
Comment options

I'm using 21. SeleniumBase SB (Python context manager) since my use case is more scraping and less tests.

Comment options

From Debug Mode:

(Pdb+) from seleniumbase import SB
(Pdb+) help(SB)

Then scroll down...
See all methods. See all types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /