miguelgrinberg/flasky

Current version of chromedriver breaks pinned version of selenium

bkline opened this issue · 2 comments

Running the tests on my Ubuntu 20.4 server against tag 5d resulted in

test_admin_home_page (test_selenium.SeleniumTestCase) ... skipped 'Web browser not available'

So I hacked tests/test_selenium.py to add code to re-raise the exception caught in SeleniumTestCase.setUpClass() which got me

ERROR: setUpClass (test_selenium.SeleniumTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/bkline/repos/flasky/tests/test_selenium.py", line 19, in setUpClass
    cls.client = webdriver.Chrome(chrome_options=options)
  File "/home/bkline/repos/flasky/venv/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py", line 65, in __init__
    RemoteWebDriver.__init__(
  File "/home/bkline/repos/flasky/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 98, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "/home/bkline/repos/flasky/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 188, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/home/bkline/repos/flasky/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 256, in execute
    self.error_handler.check_response(response)
  File "/home/bkline/repos/flasky/venv/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 194, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: invalid argument: unrecognized capability: chromeOptions

A little more digging found some advice which suggested upgrading selenium to accommodate changes to the behavior of the launcher in chromedriver. Sure enough, running pip install -U selenium got the selenium test back in the game. So it would seem that the requirements documents need to be updated to bump the version of selenium. I'm at 3.141.0 which is what PyPI is currently serving up. I haven't done the testing to determine the minimum version needed to avoid the breakage I ran into, but I'm not seeing any adverse side effects from this version.

(venv) $ grep selenium requirements/dev.txt 
selenium==3.4.3
(venv) $ pip freeze | grep selenium
selenium==3.141.0
(venv) $ dpkg -l | grep chromium
ii  chromium-browser                       1:85.0.4183.83-0ubuntu0.20.04.2             amd64        Transitional package - chromium-browser -> chromium snap
ii  chromium-chromedriver                  1:85.0.4183.83-0ubuntu0.20.04.2             amd64        Transitional package - chromium-chromedriver -> chromium snap

Okay. I'll test the new selenium version and update the requirements. Thanks.

Thanks. I updated the selenium version to the latest, as everything looks good with it.