-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[py] Add type hints to remote webdriver and related modules #17002
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
[py] Add type hints to remote webdriver and related modules #17002
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||||||||
…yndul/selenium into py-add-type-hints-to-remote-webdriver
User description
🔗 Related Issues
💥 What does this PR do?
Adds type annotations to the remote WebDriver module and related files to improve static type checking and IDE support.
🔧 Implementation Notes
💡 Additional Considerations
🔄 Types of changes
PR Type
Enhancement
Description
Add comprehensive type hints to remote WebDriver module
Improve static type checking and IDE support across related modules
Use cast() for execute() return values with known types
Add TypeVar pattern for decorator function signature preservation
Convert ScriptKey._id to always be str for consistent typing
File Walkthrough
webdriver.py
Add comprehensive type hints to WebDriver classpy/selenium/webdriver/remote/webdriver.py
WebDriver class
(title, current_url, page_source, etc.)
get_window_size, add_cookie, pin_script
optional dict access chains
dict[str, int] and dict[str, Any] returns
bidi_connection async generator
script_key.py
Add type hints and improve ScriptKey hashabilitypy/selenium/webdriver/remote/script_key.py
virtual_authenticator.py
Add type hints to virtual authenticator decoratorspy/selenium/webdriver/common/virtual_authenticator.py
required_virtual_authenticator decorators