Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tscandalitta opened this issue Jun 5, 2024 · 6 comments
Labels
C-py help wanted Issues looking for contributions I-defect

Comments

@tscandalitta
Copy link

tscandalitta commented Jun 5, 2024

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

Copy link

github-actions bot commented Jun 5, 2024

@tscandalitta, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

@titusfortner
Copy link
Member

These special webkit classes aren't really maintained as well as the other drivers; desired_capabilities should be deleted, and a default options class should be created by default.

@titusfortner titusfortner added C-py help wanted Issues looking for contributions and removed needs-triaging labels Jun 5, 2024
Copy link

github-actions bot commented Jun 5, 2024

This issue is looking for contributors.

Please comment below or reach out to us through our IRC/Slack/Matrix channels if you are interested.

2 similar comments
Copy link

github-actions bot commented Jun 5, 2024

This issue is looking for contributors.

Please comment below or reach out to us through our IRC/Slack/Matrix channels if you are interested.

Copy link

github-actions bot commented Jun 5, 2024

This issue is looking for contributors.

Please comment below or reach out to us through our IRC/Slack/Matrix channels if you are interested.

@iampopovich
Copy link
Contributor

@titusfortner
I believe it can be done like in safari.webdriver, but I will ask before opening a pull request:
did I understand correctly that in this class we should stop accepting desired_capabilities as argument and create default options inside the class instance, as it was done in the commit ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-py help wanted Issues looking for contributions I-defect
Projects
None yet
Development

No branches or pull requests

3 participants