Skip to content
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

DeprecationWarnings on selenium 4 #283

Open
icemac opened this issue Dec 1, 2021 · 13 comments
Open

DeprecationWarnings on selenium 4 #283

icemac opened this issue Dec 1, 2021 · 13 comments

Comments

@icemac
Copy link

icemac commented Dec 1, 2021

When running a customer project's tests I get the following deprecation warnings:

/.../selenium-4.1.0-py3.9.egg/selenium/webdriver/chrome/webdriver.py:70: DeprecationWarning: desired_capabilities has been deprecated, please pass in a Service object
    super(WebDriver, self).__init__(DesiredCapabilities.CHROME['browserName'], "goog",
/.../selenium-4.1.0-py3.9.egg/selenium/webdriver/chrome/webdriver.py:70: DeprecationWarning: service_log_path has been deprecated, please pass in a Service object
    super(WebDriver, self).__init__(DesiredCapabilities.CHROME['browserName'], "goog",

Using pytest-selenium = 2.0.1 on selenium = 4.1.0.

@dosas
Copy link
Contributor

dosas commented Dec 1, 2021

Working on it.

@BeyondEvil
Copy link
Contributor

Working on it.

Hey.

Between the 15th and 22nd of December, I'm taking vacation with the explicit purpose of working on this plugin (and the other plugins I maintain).

Would you be interested in helping me during that time? Mainly with reviewing PRs and maybe triaging issues?

If you are please shoot me an email at jimbrannlund at fastmail dot com.

Maybe @ssbarnea and @gnikonorov are able to help out as well? 🙇

@dosas
Copy link
Contributor

dosas commented Apr 1, 2022

will continue after #282 is merged

@BeyondEvil
Copy link
Contributor

Merged @dosas 😊

@BeyondEvil
Copy link
Contributor

v4.0.0 was just released. Any updates here?

@dosas
Copy link
Contributor

dosas commented Sep 24, 2022

I have been trying to work on it but could not get it done on time. The desired capabilities are an essential part of this plugin for the cloud based drivers.

I pushed some of the work to this fork

@dborin
Copy link

dborin commented Sep 29, 2022

Seeing this with Python Selenium 4.5 and pytest-selenium 4.0.0

========== warnings summary ===========
tests/selenium/test_milestones.py::TestMilestones::test_add_new_to_ip_with_required_attr
  /home/dborin/.pyenv/versions/3.9.6/envs/upgrade-pytest-packages/lib/python3.9/site-packages/selenium/webdriver/chrome/webdriver.py:69: DeprecationWarning: desired_capabilities has been deprecated, please pass in a Service object
    super().__init__(DesiredCapabilities.CHROME['browserName'], "goog",

tests/selenium/test_milestones.py::TestMilestones::test_add_new_to_ip_with_required_attr
  /home/dborin/.pyenv/versions/3.9.6/envs/upgrade-pytest-packages/lib/python3.9/site-packages/selenium/webdriver/chrome/webdriver.py:69: DeprecationWarning: service_log_path has been deprecated, please pass in a Service object
    super().__init__(DesiredCapabilities.CHROME['browserName'], "goog",

-- Docs: https://docs.pytest.org/en/stable/warnings.html
============== 1 passed, 2 warnings in 11.74s ========

@BeyondEvil
Copy link
Contributor

Seeing this with Python Selenium 4.5 and pytest-selenium 4.0.0

========== warnings summary ===========
tests/selenium/test_milestones.py::TestMilestones::test_add_new_to_ip_with_required_attr
  /home/dborin/.pyenv/versions/3.9.6/envs/upgrade-pytest-packages/lib/python3.9/site-packages/selenium/webdriver/chrome/webdriver.py:69: DeprecationWarning: desired_capabilities has been deprecated, please pass in a Service object
    super().__init__(DesiredCapabilities.CHROME['browserName'], "goog",

tests/selenium/test_milestones.py::TestMilestones::test_add_new_to_ip_with_required_attr
  /home/dborin/.pyenv/versions/3.9.6/envs/upgrade-pytest-packages/lib/python3.9/site-packages/selenium/webdriver/chrome/webdriver.py:69: DeprecationWarning: service_log_path has been deprecated, please pass in a Service object
    super().__init__(DesiredCapabilities.CHROME['browserName'], "goog",

-- Docs: https://docs.pytest.org/en/stable/warnings.html
============== 1 passed, 2 warnings in 11.74s ========

Would you mind creating a small repro repo?

It really speeds up my ability to solve the issue. 🙏 🙇

@BeyondEvil
Copy link
Contributor

Maybe hold off on that, as I think the repo created for me in this issue: #284 actually covers this issue as well.

@sdiemer
Copy link

sdiemer commented Jun 8, 2023

Hello, since yesterday (release 4.10.0 of Selenium, https://github.com/SeleniumHQ/selenium/releases/tag/selenium-4.10.0), this warning is no more a warning but is causing the code to fail:

Traceback (most recent call last):
  File "/opt/venv/lib/python3.9/site-packages/pytest_selenium/pytest_selenium.py", line 200, in driver
    for retry in Retrying(
  File "/opt/venv/lib/python3.9/site-packages/tenacity/__init__.py", line 347, in __iter__
    do = self.iter(retry_state=retry_state)
  File "/opt/venv/lib/python3.9/site-packages/tenacity/__init__.py", line 325, in iter
    raise retry_exc.reraise()
  File "/opt/venv/lib/python3.9/site-packages/tenacity/__init__.py", line 158, in reraise
    raise self.last_attempt.result()
  File "/usr/lib/python3.9/concurrent/futures/_base.py", line 433, in result
    return self.__get_result()
  File "/usr/lib/python3.9/concurrent/futures/_base.py", line 389, in __get_result
    raise self._exception
  File "/opt/venv/lib/python3.9/site-packages/pytest_selenium/pytest_selenium.py", line 207, in driver
    driver = driver_class(**driver_kwargs)
TypeError: __init__() got an unexpected keyword argument 'desired_capabilities'

Versions:
OS: Debian 11
Python: 3.9.2
pytest: 7.3.1
pytest-selenium: 4.0.1

Regards

@rschwebel
Copy link

Any progress on this? The issue does now exist for 1.5 years, and pytest-selenium becomes increasingly unusable these days.

@icemac
Copy link
Author

icemac commented Oct 18, 2023

I tried to fix this in a local fork but I failed even to find a combination of the dependencies so the tests can run successfully. So I had to give up. 😢

Here is what I did:

  • I added py as a dependency, see Missing dependency on py package #313.
  • I downgraded selenium to <4.10 which fixed some tests which are broken when using with a current selenium version. (12 failed, 88 passed, 3 skipped, 6 xfailed for Python 3.11 as well as for Python 3.8)
  • The output of pytest-html 4.x also changed, but downgrading it to 3.2, 3.1.1, 3.0.0 or even to <3 did not help to fix the tests which assert certain HTML snippets in the output.

@BeyondEvil
Copy link
Contributor

@icemac Thanks for the effort, it's greatly appreciated.

But given all the changes to Selenium (and now pytest-html) coupled with the lack of love this plugin has received - I think a rewrite is required.

I don't know when I'll have the time to do that. Especially since pytest-html is still taking up a lot of time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants