Skip to content

[🐛 Bug]: TypeError: WebDriver.__init__() got an unexpected keyword argument 'desired_capabilities' #14087

@tscandalitta

Description

@tscandalitta

What happened?

I'm running some automation tests on a webkit based browser

Code:

from selenium.webdriver import WebKitGTK

webdriver_path: str = "/usr/bin/WebKitWebDriver"
driver = WebKitGTK(executable_path=webdriver_path)
driver.get("https://google.com")

Error:

python3.11 mytest.py 
Traceback (most recent call last):
  File "/tests/mytest.py", line 4, in <module>
    driver = WebKitGTK(executable_path=webdriver_path)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tests/.venv/lib/python3.11/site-packages/selenium/webdriver/webkitgtk/webdriver.py", line 66, in __init__
    super().__init__(
TypeError: WebDriver.__init__() got an unexpected keyword argument 'desired_capabilities'

As you can see inspecting selenium.webdriver.webkitgtk.webdriver.py, the constructor of RemoteWebDriver does not accept desired_capabilities
Screenshot from 2024-06-05 15-41-05

If I remove that param desired_capabilities=desired_capabilities I get:

python3.11 test_drivers.py 
Traceback (most recent call last):
  File "/tests/mytest.py", line 4, in <module>
    driver = WebKitGTK(executable_path=webdriver_path)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tests/.venv/lib/python3.11/site-packages/selenium/webdriver/webkitgtk/webdriver.py", line 66, in __init__
    super().__init__(
  File "/tests/.venv/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 188, in __init__
    capabilities = options.to_capabilities()
                   ^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'to_capabilities'

So I have to replace desired_capabilities=desired_capabilities with options=options

Screenshot from 2024-06-05 17-31-37

And then it just runs ok!

Is it a bug or I'm missing something??

How can we reproduce the issue?

from selenium.webdriver import WebKitGTK

webdriver_path: str = "/usr/bin/WebKitWebDriver"
driver = WebKitGTK(executable_path=webdriver_path)
driver.get("https://google.com")

Relevant log output

python3.11 mytest.py 
Traceback (most recent call last):
  File "/tests/mytest.py", line 4, in <module>
    driver = WebKitGTK(executable_path=webdriver_path)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tests/.venv/lib/python3.11/site-packages/selenium/webdriver/webkitgtk/webdriver.py", line 66, in __init__
    super().__init__(
TypeError: WebDriver.__init__() got an unexpected keyword argument 'desired_capabilities'

Operating System

Ubuntu 20.04.6 LTS

Selenium version

Python 4.21.0

What are the browser(s) and version(s) where you see this issue?

MiniBrowser

What are the browser driver(s) and version(s) where you see this issue?

WebkitGTKDriver

Are you using Selenium Grid?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-pyPython BindingsI-defectSomething is not working as intendedJ-staleApplied to issues that become stale, and eventually closed.R-help wantedIssues looking for contributions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions