joyzoursky / docker-python-chromedriver

Dockerfile for running Python Selenium in headless Chrome (Python 2.7 / 3.6 / 3.7 / 3.8 / Alpine based Python / Chromedriver / Selenium / Xvfb included in different versions)
https://hub.docker.com/r/joyzoursky/python-chromedriver/
MIT License
638 stars 196 forks source link

`test_script.py` tests are broken on fresh install #22

Closed DGaffney closed 3 years ago

DGaffney commented 3 years ago

Just installed to use this repo as a guide for a workshop I'll be running in a few weeks, and looks like while this installs selenium just fine, it fails to run your tests correctly:

root@b91ef629f6c9:/usr/workspace# python test_script.py
test_case_1 (__main__.TestTemplate)
Find and click top-right button ... test_script.py:18: DeprecationWarning: use options instead of chrome_options
  self.driver = webdriver.Chrome(chrome_options=chrome_options)
FAIL
test_case_2 (__main__.TestTemplate)
Find and click Learn more button ... test_script.py:18: DeprecationWarning: use options instead of chrome_options
  self.driver = webdriver.Chrome(chrome_options=chrome_options)
FAIL

======================================================================
FAIL: test_case_1 (__main__.TestTemplate)
Find and click top-right button
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_script.py", line 29, in test_case_1
    el = self.driver.find_element_by_class_name('btn-header')
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":".btn-header"}
  (Session info: headless chrome=79.0.3945.79)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test_script.py", line 32, in test_case_1
    self.fail(ex.msg)
AssertionError: no such element: Unable to locate element: {"method":"css selector","selector":".btn-header"}
  (Session info: headless chrome=79.0.3945.79)

======================================================================
FAIL: test_case_2 (__main__.TestTemplate)
Find and click Learn more button
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_script.py", line 38, in test_case_2
    el = self.driver.find_element_by_xpath(".//*[@id='tag-line-wrap']/span/a")
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":".//*[@id='tag-line-wrap']/span/a"}
  (Session info: headless chrome=79.0.3945.79)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test_script.py", line 41, in test_case_2
    self.fail(ex.msg)
AssertionError: no such element: Unable to locate element: {"method":"xpath","selector":".//*[@id='tag-line-wrap']/span/a"}
  (Session info: headless chrome=79.0.3945.79)

----------------------------------------------------------------------
Ran 2 tests in 25.545s

FAILED (failures=2)