Opened 18 months ago
Closed 18 months ago
#34675 closed Cleanup/optimization (fixed)
Selenium WebDriver implementation is broken due to update of Selenium
Reported by: | Jonathan Weth | Owned by: | Jonathan Weth |
---|---|---|---|
Component: | Testing framework | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | yes |
Description
def create_webdriver(self): if self.selenium_hub: from selenium import webdriver > 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
Change History (8)
comment:1 by , 18 months ago
Easy pickings: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
Type: | Bug → Cleanup/optimization |
UI/UX: | set |
comment:2 by , 18 months ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
follow-up: 6 comment:3 by , 18 months ago
I'm not sure why but I cannot reproduce this crash with selenium
4.10.0.
comment:4 by , 18 months ago
Has patch: | set |
---|
comment:6 by , 18 months ago
Replying to 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.
- g. with (using docker-selenium)
./runtests.py --selenium firefox --selenium-hub http://127.0.0.1:4444/wd/hub --external-host 172.17.0.1
comment:7 by , 18 months ago
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'
Accepting following data from report and this post. Upgrade options are listed here.