selenium icon indicating copy to clipboard operation
selenium copied to clipboard

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

Open tscandalitta opened this issue 8 months ago • 6 comments

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

tscandalitta avatar Jun 05 '24 20:06 tscandalitta