Skip to content

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

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

Closed
tscandalitta opened this issue Jun 5, 2024 · 9 comments
Labels
C-py Python Bindings I-defect Something is not working as intended J-stale Applied to issues that become stale, and eventually closed. R-help wanted Issues looking for contributions

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

@tscandalitta tscandalitta added I-defect Something is not working as intended A-needs-triaging A Selenium member will evaluate this soon! labels Jun 5, 2024
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 Python Bindings R-help wanted Issues looking for contributions and removed A-needs-triaging A Selenium member will evaluate this soon! 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 ?

Copy link

This issue is stale because it has been open 280 days with no activity. Remove stale label or comment or this will be closed in 14 days.

@github-actions github-actions bot added the J-stale Applied to issues that become stale, and eventually closed. label Dec 30, 2024
Copy link

This issue was closed because it has been stalled for 14 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 13, 2025
Copy link

This issue has been automatically locked since there has not been any recent activity since it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Feb 12, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
C-py Python Bindings I-defect Something is not working as intended J-stale Applied to issues that become stale, and eventually closed. R-help wanted Issues looking for contributions
Projects
None yet
Development

No branches or pull requests

3 participants