-
Notifications
You must be signed in to change notification settings - Fork 1.4k
-
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.
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment 2 replies
-
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)
Beta Was this translation helpful? Give feedback.
All reactions
-
I'm using 21. SeleniumBase SB (Python context manager)
since my use case is more scraping and less tests.
Beta Was this translation helpful? Give feedback.
All reactions
-
From Debug Mode:
(Pdb+) from seleniumbase import SB (Pdb+) help(SB)
Then scroll down...
See all methods. See all types.
Beta Was this translation helpful? Give feedback.