[py] Update DesiredCapabilities example to use modern Options API#16295
[py] Update DesiredCapabilities example to use modern Options API#16295cgoldberg merged 5 commits intoSeleniumHQ:trunkfrom
Conversation
The code example in the DesiredCapabilities docstring was using the deprecated desired_capabilities argument and was missing the mandatory options argument, causing it to fail with a TypeError. This PR updates the example to use the correct Options-based approach for instantiating a remote driver.
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||
|
Please fix formatting and sign the CLA. |
|
Please also remove the 2 notes in that docstring that are no longer relevant. (the comment about "platformName" and "browserVersion", and also the one about using copy()) |
cgoldberg
left a comment
There was a problem hiding this comment.
I just made an update to your branch so it uses a w3c compliant platform name.
The example isn't really that relevant to this class, but I guess it's better than the outdated one that was there previously.
User description
Related Issues
N/A - This fixes a bug found in the documentation that was not tracked by an issue.
💥 What does this PR do?
https://github.com/SeleniumHQ/selenium/blob/trunk/py/selenium/webdriver/common/desired_capabilities.py#L32-L38
The code example in the
DesiredCapabilitiesdocstring was using the deprecateddesired_capabilitiesargument and was missing the new, mandatoryoptionsparameter, causing it to fail with aTypeError.This PR updates the example to use the modern and correct Options-based approach for instantiating a remote driver, ensuring the documentation is accurate and helpful for users.
🔧 Implementation Notes
This is a straightforward documentation update to align the code example with the current API. No other implementation details are relevant.
💡 Additional Considerations
N/A
🔄 Types of changes
Bug fix (backwards compatible)
PR Type
Documentation
Description
Update DesiredCapabilities docstring example to use modern Options API
Replace deprecated
desired_capabilitiesargument withoptionsparameterFix capability names to use current W3C standard format
Ensure example code runs without TypeError
Diagram Walkthrough
File Walkthrough
desired_capabilities.py
Modernize DesiredCapabilities docstring examplepy/selenium/webdriver/common/desired_capabilities.py
desired_capabilitiesargument withoptionsparameter
platformName,browserVersion)