Skip to content

selenium.webdriver.common.options is missing #7379

Description

@bersbersbers

See https://github.com/python/typeshed/tree/master/stubs/selenium/selenium/webdriver/common

While the following codes are running fine:

"""Show bug."""fromtypingimportAny, Literal, Typefromseleniumimportwebdriverfromselenium.webdriverimportchrome, firefoxfromselenium.webdriver.common.optionsimportArgOptionsfromselenium.webdriver.remote.webdriverimportWebDriverdeffun(browser: Literal["chrome", "firefox"]) ->Any:
"""Show bug."""driver_class: Type[WebDriver]
options: ArgOptionsifbrowser=="chrome":
driver_class=webdriver.Chromeoptions=chrome.options.Options()
elifbrowser=="firefox":
driver_class=webdriver.Firefoxoptions=firefox.options.Options()
return (driver_class, options)
"""Show bug."""fromselenium.webdriverimportchromefromselenium.webdriver.common.optionsimportArgOptionsdeffun() ->ArgOptions:
"""Show bug."""returnchrome.options.Options()

I see various errors in Pylance and mypy:

Import "selenium.webdriver.common.options" could not be resolved
Incompatible types in assignment (expression has type "Options", variable has type "ArgOptions")
Incompatible return value type (got "Options", expected "ArgOptions") [return-value]

Interstingly, selenium.webdriver.common.options is not mentioned here, either: https://www.selenium.dev/selenium/docs/api/py/api.html#webdriver-common

Metadata

Metadata

Assignees

No one assigned

    Labels

    stubs: incompleteAnnotations or sub-modules missing from an existing package or module

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions