Skip to content

[🐛 Bug]: Python code samples on Chrome (and Edge) options docs page don't work #2621

@tommorris

Description

@tommorris

What happened?

On the WebDriver Chrome specific functionality page, it contains examples of how to set options for the Chrome driver like this:

options = get_default_chrome_options()
driver = webdriver.Chrome(options=options)

When I read this, I wondered "is get_default_chrome_options a function in WebDriver? And if so, how do I import it? I looked at the repository a bit and realised that the documentation had fallen out-of-sync with the test code.

The Edge page similarly just lists as the method:

options = get_default_edge_options()

In #2139 (commit f85c1de), the code was refactored for testing purposes to the above from:

options = webdriver.ChromeOptions()
driver = webdriver.Chrome(options=options)

get_default_chrome_options() is a helper function for testing that returns a ChromeOptions with .add_argument("--no-sandbox").

(Obviously, you'd modify the options by calling the various methods on it that are documented on the page before passing it in as an argument to webdriver.Chrome.)

The Python documentation is no longer helpful for someone trying to set driver options for Chrome or Edge. The change in #2139 doesn't seem to affect anything other than Chrome or Edge, or any other language than Python or Java. I haven't looked at the other examples, but a quick clicking through of all the various languages suggest there are a fair few non-existent or perhaps unhelp code samples here.

If there were a simple fix for this, I'd do it and submit a PR, but it looks like it needs a fair bit of refactoring and moving around.

What browsers and operating systems are you seeing the problem on?

Documentation bug—applies to all browsers/operating systems.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions