[Django] #34675: Selenium WebDriver implementation is broken due to update of Selenium

14 views
Skip to first unread message

Django

unread,
Jun 23, 2023, 1:46:14 PM6/23/23
to django-...@googlegroups.com
#34675: Selenium WebDriver implementation is broken due to update of Selenium
---------------------------------------------+------------------------
Reporter: hansegucker | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: dev
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
---------------------------------------------+------------------------
{{{
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

--
Ticket URL: <https://code.djangoproject.com/ticket/34675>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jun 23, 2023, 2:02:24 PM6/23/23
to django-...@googlegroups.com
#34675: Selenium WebDriver implementation is broken due to update of Selenium
--------------------------------------+------------------------------------
Reporter: hansegucker | Owner: nobody
Type: Cleanup/optimization | Status: new

Component: Testing framework | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 1
--------------------------------------+------------------------------------
Changes (by Natalia Bidart):

* 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>

Django

unread,
Jun 23, 2023, 2:11:17 PM6/23/23
to django-...@googlegroups.com
#34675: Selenium WebDriver implementation is broken due to update of Selenium
-------------------------------------+-------------------------------------
Reporter: hansegucker | Owner:
Type: | hansegucker
Cleanup/optimization | Status: assigned

Component: Testing framework | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by hansegucker):

* owner: nobody => hansegucker
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/34675#comment:2>

Django

unread,
Jun 23, 2023, 2:25:25 PM6/23/23
to django-...@googlegroups.com
#34675: Selenium WebDriver implementation is broken due to update of Selenium
-------------------------------------+-------------------------------------
Reporter: hansegucker | Owner:
Type: | hansegucker
Cleanup/optimization | Status: assigned
Component: Testing framework | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 1
-------------------------------------+-------------------------------------

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>

Django

unread,
Jun 23, 2023, 3:09:58 PM6/23/23
to django-...@googlegroups.com
#34675: Selenium WebDriver implementation is broken due to update of Selenium
-------------------------------------+-------------------------------------
Reporter: hansegucker | Owner:
Type: | hansegucker
Cleanup/optimization | Status: assigned
Component: Testing framework | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by hansegucker):

* has_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/34675#comment:4>

Django

unread,
Jun 23, 2023, 3:10:04 PM6/23/23
to django-...@googlegroups.com
#34675: Selenium WebDriver implementation is broken due to update of Selenium
-------------------------------------+-------------------------------------
Reporter: hansegucker | Owner:
Type: | hansegucker
Cleanup/optimization | Status: assigned
Component: Testing framework | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 1
-------------------------------------+-------------------------------------

Comment (by hansegucker):

https://github.com/django/django/pull/17001

--
Ticket URL: <https://code.djangoproject.com/ticket/34675#comment:5>

Django

unread,
Jun 23, 2023, 3:10:59 PM6/23/23
to django-...@googlegroups.com
#34675: Selenium WebDriver implementation is broken due to update of Selenium
-------------------------------------+-------------------------------------
Reporter: hansegucker | Owner:
Type: | hansegucker
Cleanup/optimization | Status: assigned
Component: Testing framework | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 1
-------------------------------------+-------------------------------------

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>

Django

unread,
Jun 23, 2023, 3:46:08 PM6/23/23
to django-...@googlegroups.com
#34675: Selenium WebDriver implementation is broken due to update of Selenium
-------------------------------------+-------------------------------------
Reporter: Jonathan Weth | Owner: Jonathan
Type: | Weth

Cleanup/optimization | Status: assigned
Component: Testing framework | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 1
-------------------------------------+-------------------------------------

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>

Django

unread,
Jun 26, 2023, 8:33:39 AM6/26/23
to django-...@googlegroups.com
#34675: Selenium WebDriver implementation is broken due to update of Selenium
-------------------------------------+-------------------------------------
Reporter: Jonathan Weth | Owner: Jonathan
Type: | Weth
Cleanup/optimization | Status: closed

Component: Testing framework | Version: dev
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by GitHub <noreply@…>):

* 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>

Reply all
Reply to author
Forward
0 new messages