> return webdriver.Remote(
command_executor=self.selenium_hub,
desired_capabilities=self.get_capability(self.browser),
)
E TypeError: WebDriver.__init__() got an unexpected keyword
argument 'desired_capabilities'
.tox/globalenv/lib/python3.11/site-packages/django/test/selenium.py:92:
TypeError
}}}
In selenium >= 4.10, `desired_capabilities` is no longer a valid argument
for the constructor of `WebDriver`. There seem to be other ways to set
those capabilities.
https://github.com/django/django/blob/main/django/test/selenium.py#L95
https://github.com/SeleniumHQ/selenium/commit/9f5801c82fb3be3d5850707c46c3f8176e3ccd8e
--
Ticket URL: <https://code.djangoproject.com/ticket/34675>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* ui_ux: 0 => 1
* type: Bug => Cleanup/optimization
* easy: 0 => 1
* stage: Unreviewed => Accepted
Comment:
Accepting following data from report and
[https://stackoverflow.com/questions/76430192/getting-typeerror-webdriver-
init-got-an-unexpected-keyword-argument-desi this post]. Upgrade options
are listed
[https://www.selenium.dev/documentation/webdriver/getting_started/upgrade_to_selenium_4/#capabilities
here].
--
Ticket URL: <https://code.djangoproject.com/ticket/34675#comment:1>
* owner: nobody => hansegucker
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/34675#comment:2>
Comment (by Mariusz Felisiak):
I'm not sure why but I cannot reproduce this crash with `selenium` 4.10.0.
--
Ticket URL: <https://code.djangoproject.com/ticket/34675#comment:3>
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/34675#comment:4>
Comment (by hansegucker):
https://github.com/django/django/pull/17001
--
Ticket URL: <https://code.djangoproject.com/ticket/34675#comment:5>
Comment (by hansegucker):
Replying to [comment:3 Mariusz Felisiak]:
> I'm not sure why but I cannot reproduce this crash with `selenium`
4.10.0.
The bug only occurs if you are using a remote Selenium web driver.
e. g. with ./runtests.py --selenium firefox --selenium-hub
http://127.0.0.1:4444/wd/hub --external-host 172.17.0.1 (using docker-
selenium)
--
Ticket URL: <https://code.djangoproject.com/ticket/34675#comment:6>
Comment (by Natalia Bidart):
Reproduced with the given instructions, thanks!
Ran `docker-selenium` as suggested in https://github.com/SeleniumHQ
/docker-selenium#quick-start:
{{{
docker run -d -p 4444:4444 -p 7900:7900 --shm-size="2g" selenium
/standalone-firefox:4.10.0-20230607
}}}
And then:
{{{
./runtests.py --selenium=firefox --selenium-
hub=http://localhost:4444/wd/hub
}}}
Errors are:
{{{
Traceback (most recent call last):
File "/usr/lib/python3.11/unittest/suite.py", line 166, in
_handleClassSetUp
setUpClass()
File "/home/nessita/fellowship/django/django/test/selenium.py", line
115, in setUpClass
cls.selenium = cls.create_webdriver()
^^^^^^^^^^^^^^^^^
File "/home/nessita/fellowship/django/django/test/selenium.py", line 93,
in create_webdriver
return webdriver.Remote(
^^^^^^^^^^^^^^^^^
TypeError: WebDriver.__init__() got an unexpected keyword argument
'desired_capabilities'
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34675#comment:7>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"ecd5a0daaf7bda6154175df2280f888099deefe8" ecd5a0da]:
{{{
#!CommitTicketReference repository=""
revision="ecd5a0daaf7bda6154175df2280f888099deefe8"
Fixed #34675 -- Fixed creating remote webdriver for Selenium 4.10.0+.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34675#comment:8>