Skip to content

DeprecationWarnings on selenium 4 #283

Description

@icemac

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.

Activity

  1. dosas commented on Dec 1, 2021

    @dosas
    Contributor

    Working on it.

  2. BeyondEvil commented on Dec 5, 2021

    @BeyondEvil
    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? 🙇

  3. dosas commented on Apr 1, 2022

    @dosas
    Contributor

    will continue after #282 is merged

  4. BeyondEvil commented on Apr 1, 2022

    @BeyondEvil
    Contributor

    Merged @dosas 😊

  5. BeyondEvil commented on Sep 22, 2022

    @BeyondEvil
    Contributor

    v4.0.0 was just released. Any updates here?

  6. dosas commented on Sep 24, 2022

    @dosas
    Contributor

    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

  7. dborin commented on Sep 29, 2022

    @dborin

    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 ========
    
  8. BeyondEvil commented on Sep 30, 2022

    @BeyondEvil
    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. 🙏 🙇

  9. BeyondEvil commented on Sep 30, 2022

    @BeyondEvil
    Contributor

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

  10. sdiemer commented on Jun 8, 2023

    @sdiemer

    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

  11. rschwebel commented on Aug 2, 2023

    @rschwebel

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

  12. icemac commented on Oct 18, 2023

    @icemac
    Author

    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.
  13. BeyondEvil commented on Oct 31, 2023

    @BeyondEvil
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions