dash icon indicating copy to clipboard operation
dash copied to clipboard

[BUG] deprecation warnings for selenium when using `dash_duo`

Open prokie opened this issue 2 years ago • 9 comments

Describe your context When using dash_duo and performing tests on our application we get the following deprecation warnings

  C:\repositories\database-gui\venv\Lib\site-packages\selenium\webdriver\remote\remote_connection.py:391: DeprecationWarning:
  HTTPResponse.getheader() is deprecated and will be removed in urllib3 v2.1.0. Instead use HTTPResponse.headers.get(name, default).
  • replace the result of pip list | grep dash below
dash                      2.11.1 
dash-bootstrap-components 1.4.1  
dash-chart-editor         0.0.1a4
dash-core-components      2.0.0  
dash-extensions           1.0.1  
dash-html-components      2.0.0  
dash-table                5.0.0  
dash-testing-stub         0.0.2  

Describe the bug When running pytest with dash_duo the following deprecation warnings show up.

  C:\repositories\database-gui\venv\Lib\site-packages\selenium\webdriver\remote\remote_connection.py:391: DeprecationWarning:
  HTTPResponse.getheader() is deprecated and will be removed in urllib3 v2.1.0. Instead use HTTPResponse.headers.get(name, default).

Expected behavior

I expect to not get any deprecation warnings.

prokie avatar Jul 07 '23 09:07 prokie

This issue seems to be solved if we update requires-testing.txt to allow for selenium version 4.7.0.

# Dependencies necessary for utilizing Dash provided testing utilities
beautifulsoup4>=4.8.2
cryptography<3.4;python_version<"3.7"
lxml>=4.6.2
percy>=2.0.2
pytest>=6.0.2
requests[security]>=2.21.0
selenium>=3.141.0,<=4.7.0
waitress>=1.4.4
multiprocess>=0.70.12
psutil>=5.8.0
dash_testing_stub>=0.0.2

prokie avatar Jul 07 '23 13:07 prokie

This is on selenium side, should be fixed in selenium 4.6.1 and above.

T4rk1n avatar Jul 07 '23 13:07 T4rk1n

Seems like the latest working selenium version is 4.9.1. The version latest version 4.10.0 is giving me errors.

E       selenium.common.exceptions.InvalidArgumentException: Message: invalid argument: unrecognized capability: loggingPrefs
E       Stacktrace:
E       Backtrace:
E               GetHandleVerifier [0x00ADA813+48355]
E               (No symbol) [0x00A6C4B1]
E               (No symbol) [0x00975358]
E               (No symbol) [0x0098AC31]
E               (No symbol) [0x009BFCEE]
E               (No symbol) [0x009BF9A8]
E               (No symbol) [0x009C0AD7]
E               (No symbol) [0x009C093C]
E               (No symbol) [0x009BA536]
E               (No symbol) [0x009982DC]
E               (No symbol) [0x009993DD]
E               GetHandleVerifier [0x00D3AABD+2539405]
E               GetHandleVerifier [0x00D7A78F+2800735]
E               GetHandleVerifier [0x00D7456C+2775612]
E               GetHandleVerifier [0x00B651E0+616112]
E               (No symbol) [0x00A75F8C]
E               (No symbol) [0x00A72328]
E               (No symbol) [0x00A7240B]
E               (No symbol) [0x00A64FF7]
E               BaseThreadInitThunk [0x756500C9+25]
E               RtlGetAppContainerNamedObjectPath [0x773C7B4E+286]
E               RtlGetAppContainerNamedObjectPath [0x773C7B1E+238]

venv\Lib\site-packages\selenium\webdriver\remote\errorhandler.py:245: InvalidArgumentException

prokie avatar Jul 07 '23 13:07 prokie

@prokie I think there was a bug introduced in the version I locked last year that caused our tests to fail, I'll do some more testing to get latest when I have some time or if you want you can create a PR with the new version and see if the tests still fails.

T4rk1n avatar Jul 07 '23 14:07 T4rk1n

I can create a PR

prokie avatar Jul 07 '23 15:07 prokie

Some of the tests are failing in #2591. I will look into it when I am back from my vacation.

prokie avatar Jul 09 '23 11:07 prokie

Hey guys! Have there been any updates on whether the upper bound for selenium will be removed for dash testing? We still get the same deprecation warnings and it seems to be solved by upgrading to 4.6 and higher? See here

However, there is an upper bound on dash testing right now, which prevents that: https://github.com/plotly/dash/blob/2153a683acecc2bf68b4dc00f62a4500501c9b16/requires-testing.txt#L8

huong-li-nguyen avatar Dec 13 '23 21:12 huong-li-nguyen

@huong-li-nguyen The issue with removing the upper bound is mostly with our CI percy integration that would also need to be updated otherwise it causes the tests to fail.

We can delete this line to get chrome to work on latest selenium: https://github.com/plotly/dash/blob/2153a683acecc2bf68b4dc00f62a4500501c9b16/dash/testing/browser.py#L478

And selenium now auto download the browser and driver in the latest versions, the circleci config would need to remove the browser download orb.

cc @alexcjohnson

T4rk1n avatar Dec 14 '23 15:12 T4rk1n

@T4rk1n if it's just about our own tests but most users would be able to use the latest Selenium, can we remove the upper bound in requires-testing.txt but add a line with this restriction in requires-ci.txt?

alexcjohnson avatar Dec 16 '23 11:12 alexcjohnson