-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Thank you so much for helping improve the quality of Dash!
We do our best to catch bugs during the release process, but we rely on your help to find the ones that slip through.
Describe your context
Please provide us your environment so we can easily reproduce the issue.
- replace the result of
pip list | grep dashbelow
dash 1.17.0
dash-core-components 1.13.0
dash-html-components 1.1.1
dash-renderer 1.8.3
dash-table 4.11.0
-
if frontend related, tell us your Browser, Version, and OS
- OS: Linux Ubuntu 18.04
- Browser chrome
Describe the bug
I'm currently trying to run Pytest to test the app's front end that I'm building. I've followed the guide at
https://dash.plotly.com/testing
However, I cannot run my tests because either Pytest or Dash isn't recognizing my Chromedriver. When I run
python3.6 -m pytest --webdriver Chrome -k test_one tests/dataviz/test_dataviz.py
I get the following error.
ERROR dash.testing.browser:browser.py:415 <<<Webdriver not initialized correctly>>>
and
FileNotFoundError: [Errno 2] No such file or directory: 'chromedriver': 'chromedriver'
and
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH.
It looks like Selenium or Pytest cannot find my chromedriver file, even though I've downloaded it to my project, app, and test directories. I've used Selenium before and know that you have to specify where your chrome file is with something like
browser = webdriver.Chrome(executable_path="/file/path/goes/here/)
But I'm not sure where to put that or what I have to do to get Pytest and Dash to recognize my ChromeDriver.
My File Structure (Front End)
├── chromedriver
├── dataviz
│ ├── app.py
│ ├── chromedriver
│ ├── Dockerfile
│ ├── init.py
│ ├── pycache
│ │ ├── app.cpython-36.pyc
│ │ └── init.cpython-36.pyc
│ ├── README.md
│ └── requirements.txt
├── README.md
├── requirements.txt
└── tests
├── conftest.py
├── dataviz
│ ├── chromedriver
│ ├── init.py
│ ├── pycache
│ │ ├── init.cpython-36.pyc
│ │ ├── test_dataviz.cpython-36-pytest-6.0.1.pyc
│ │ └── test_dataviz.cpython-36-pytest-6.1.2.pyc
│ └── test_dataviz.py
Everything in bold is related to the front end/testing of my app.
My Tests / Set Up
tests/dataviz/test_dataviz.py
from dash.testing.application_runners import import_app
def test_one(dash_duo):
app = import_app("dash_test.app")
dash_duo.start_server(app)
assert dash_duo.get_logs() == [], "browser console should contain no error"
tests/conftest.py
from selenium.webdriver.chrome.options import Options
def pytest_setup_options():
# Set up some options for how we want the Chrome webdriver to be configured
options = Options()
options.add_argument('--disable-gpu')
options.add_argument('--headless')
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')
return options
** Full Error Message **
Run python3.6 -m pytest --webdriver Chrome -k test_one tests/dataviz/test_dataviz.py
Test session starts (platform: linux, Python 3.6.9, pytest 6.0.1, pytest-sugar 0.9.4)
rootdir: /home/ebeb9/PycharmProjects/Social-Media-Public-Analysis
plugins: webdriver-1.7.0, mock-3.2.0, sugar-0.9.4, dash-1.17.0
collecting ...
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― ERROR at setup of test_one ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
request = <SubRequest 'dash_duo' for <Function test_one>>, dash_thread_server = <dash.testing.application_runners.ThreadedRunner object at 0x7f1082c74710>, tmpdir = local('/tmp/pytest-of-ebeb9/pytest-66/test_one0')
@pytest.fixture
def dash_duo(request, dash_thread_server, tmpdir):
with DashComposite(
dash_thread_server,
browser=request.config.getoption("webdriver"),
remote=request.config.getoption("remote"),
remote_url=request.config.getoption("remote_url"),
headless=request.config.getoption("headless"),
options=request.config.hook.pytest_setup_options(),
download_path=tmpdir.mkdir("download").strpath,
percy_assets_root=request.config.getoption("percy_assets"),
percy_finalize=request.config.getoption("nopercyfinalize"),
> pause=request.config.getoption("pause"),
) as dc:
../../.local/lib/python3.6/site-packages/dash/testing/plugin.py:151:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../.local/lib/python3.6/site-packages/dash/testing/composite.py:6: in __init__
super(DashComposite, self).__init__(**kwargs)
../../.local/lib/python3.6/site-packages/dash/testing/browser.py:61: in __init__
self._driver = until(self.get_webdriver, timeout=1)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wait_cond = <bound method Browser.get_webdriver of <dash.testing.composite.DashComposite object at 0x7f1082cd9748>>, timeout = 1, poll = 0.1, msg = 'expected condition not met within timeout'
def until(
wait_cond, timeout, poll=0.1, msg="expected condition not met within timeout"
): # noqa: C0330
res = wait_cond()
logger.debug(
"start wait.until with method, timeout, poll => %s %s %s",
wait_cond,
timeout,
poll,
)
end_time = time.time() + timeout
while not res:
if time.time() > end_time:
> raise TestingTimeoutError(msg)
E dash.testing.errors.TestingTimeoutError: expected condition not met within timeout
../../.local/lib/python3.6/site-packages/dash/testing/wait.py:25: TestingTimeoutError
----------------------------------------------------------------------------------------------------- Captured log setup ------------------------------------------------------------------------------------------------------
ERROR dash.testing.browser:browser.py:415 <<<Webdriver not initialized correctly>>>
Traceback (most recent call last):
File "/home/ebeb9/.local/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 76, in start
stdin=PIPE)
File "/usr/lib/python3.6/subprocess.py", line 729, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.6/subprocess.py", line 1364, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'chromedriver': 'chromedriver'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/ebeb9/.local/lib/python3.6/site-packages/dash/testing/browser.py", line 413, in get_webdriver
return getattr(self, "_get_{}".format(self._browser))()
File "/home/ebeb9/.local/lib/python3.6/site-packages/dash/testing/browser.py", line 456, in _get_chrome
else webdriver.Chrome(options=options, desired_capabilities=capabilities)
File "/home/ebeb9/.local/lib/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
self.service.start()
File "/home/ebeb9/.local/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 83, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
ERROR dash.testing.browser:browser.py:415 <<<Webdriver not initialized correctly>>>
Traceback (most recent call last):
File "/home/ebeb9/.local/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 76, in start
stdin=PIPE)
File "/usr/lib/python3.6/subprocess.py", line 729, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.6/subprocess.py", line 1364, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'chromedriver': 'chromedriver'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/ebeb9/.local/lib/python3.6/site-packages/dash/testing/browser.py", line 413, in get_webdriver
return getattr(self, "_get_{}".format(self._browser))()
File "/home/ebeb9/.local/lib/python3.6/site-packages/dash/testing/browser.py", line 456, in _get_chrome
else webdriver.Chrome(options=options, desired_capabilities=capabilities)
File "/home/ebeb9/.local/lib/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
self.service.start()
File "/home/ebeb9/.local/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 83, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
ERROR dash.testing.browser:browser.py:415 <<<Webdriver not initialized correctly>>>
Traceback (most recent call last):
File "/home/ebeb9/.local/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 76, in start
stdin=PIPE)
File "/usr/lib/python3.6/subprocess.py", line 729, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.6/subprocess.py", line 1364, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'chromedriver': 'chromedriver'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/ebeb9/.local/lib/python3.6/site-packages/dash/testing/browser.py", line 413, in get_webdriver
return getattr(self, "_get_{}".format(self._browser))()
File "/home/ebeb9/.local/lib/python3.6/site-packages/dash/testing/browser.py", line 456, in _get_chrome
else webdriver.Chrome(options=options, desired_capabilities=capabilities)
File "/home/ebeb9/.local/lib/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
self.service.start()
File "/home/ebeb9/.local/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 83, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
ERROR dash.testing.browser:browser.py:415 <<<Webdriver not initialized correctly>>>
Traceback (most recent call last):
File "/home/ebeb9/.local/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 76, in start
stdin=PIPE)
File "/usr/lib/python3.6/subprocess.py", line 729, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.6/subprocess.py", line 1364, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'chromedriver': 'chromedriver'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/ebeb9/.local/lib/python3.6/site-packages/dash/testing/browser.py", line 413, in get_webdriver
return getattr(self, "_get_{}".format(self._browser))()
File "/home/ebeb9/.local/lib/python3.6/site-packages/dash/testing/browser.py", line 456, in _get_chrome
else webdriver.Chrome(options=options, desired_capabilities=capabilities)
File "/home/ebeb9/.local/lib/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
self.service.start()
File "/home/ebeb9/.local/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 83, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
ERROR dash.testing.browser:browser.py:415 <<<Webdriver not initialized correctly>>>
Traceback (most recent call last):
File "/home/ebeb9/.local/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 76, in start
stdin=PIPE)
File "/usr/lib/python3.6/subprocess.py", line 729, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.6/subprocess.py", line 1364, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'chromedriver': 'chromedriver'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/ebeb9/.local/lib/python3.6/site-packages/dash/testing/browser.py", line 413, in get_webdriver
return getattr(self, "_get_{}".format(self._browser))()
File "/home/ebeb9/.local/lib/python3.6/site-packages/dash/testing/browser.py", line 456, in _get_chrome
else webdriver.Chrome(options=options, desired_capabilities=capabilities)
File "/home/ebeb9/.local/lib/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
self.service.start()
File "/home/ebeb9/.local/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 83, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
ERROR dash.testing.browser:browser.py:415 <<<Webdriver not initialized correctly>>>
Traceback (most recent call last):
File "/home/ebeb9/.local/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 76, in start
stdin=PIPE)
File "/usr/lib/python3.6/subprocess.py", line 729, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.6/subprocess.py", line 1364, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'chromedriver': 'chromedriver'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/ebeb9/.local/lib/python3.6/site-packages/dash/testing/browser.py", line 413, in get_webdriver
return getattr(self, "_get_{}".format(self._browser))()
File "/home/ebeb9/.local/lib/python3.6/site-packages/dash/testing/browser.py", line 456, in _get_chrome
else webdriver.Chrome(options=options, desired_capabilities=capabilities)
File "/home/ebeb9/.local/lib/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
self.service.start()
File "/home/ebeb9/.local/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 83, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
ERROR dash.testing.browser:browser.py:415 <<<Webdriver not initialized correctly>>>
Traceback (most recent call last):
File "/home/ebeb9/.local/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 76, in start
stdin=PIPE)
File "/usr/lib/python3.6/subprocess.py", line 729, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.6/subprocess.py", line 1364, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'chromedriver': 'chromedriver'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/ebeb9/.local/lib/python3.6/site-packages/dash/testing/browser.py", line 413, in get_webdriver
return getattr(self, "_get_{}".format(self._browser))()
File "/home/ebeb9/.local/lib/python3.6/site-packages/dash/testing/browser.py", line 456, in _get_chrome
else webdriver.Chrome(options=options, desired_capabilities=capabilities)
File "/home/ebeb9/.local/lib/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
self.service.start()
File "/home/ebeb9/.local/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 83, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
ERROR dash.testing.browser:browser.py:415 <<<Webdriver not initialized correctly>>>
Traceback (most recent call last):
File "/home/ebeb9/.local/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 76, in start
stdin=PIPE)
File "/usr/lib/python3.6/subprocess.py", line 729, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.6/subprocess.py", line 1364, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'chromedriver': 'chromedriver'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/ebeb9/.local/lib/python3.6/site-packages/dash/testing/browser.py", line 413, in get_webdriver
return getattr(self, "_get_{}".format(self._browser))()
File "/home/ebeb9/.local/lib/python3.6/site-packages/dash/testing/browser.py", line 456, in _get_chrome
else webdriver.Chrome(options=options, desired_capabilities=capabilities)
File "/home/ebeb9/.local/lib/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
self.service.start()
File "/home/ebeb9/.local/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 83, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
ERROR dash.testing.browser:browser.py:415 <<<Webdriver not initialized correctly>>>
Traceback (most recent call last):
File "/home/ebeb9/.local/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 76, in start
stdin=PIPE)
File "/usr/lib/python3.6/subprocess.py", line 729, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.6/subprocess.py", line 1364, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'chromedriver': 'chromedriver'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/ebeb9/.local/lib/python3.6/site-packages/dash/testing/browser.py", line 413, in get_webdriver
return getattr(self, "_get_{}".format(self._browser))()
File "/home/ebeb9/.local/lib/python3.6/site-packages/dash/testing/browser.py", line 456, in _get_chrome
else webdriver.Chrome(options=options, desired_capabilities=capabilities)
File "/home/ebeb9/.local/lib/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
self.service.start()
File "/home/ebeb9/.local/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 83, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
ERROR dash.testing.browser:browser.py:415 <<<Webdriver not initialized correctly>>>
Traceback (most recent call last):
File "/home/ebeb9/.local/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 76, in start
stdin=PIPE)
File "/usr/lib/python3.6/subprocess.py", line 729, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.6/subprocess.py", line 1364, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'chromedriver': 'chromedriver'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/ebeb9/.local/lib/python3.6/site-packages/dash/testing/browser.py", line 413, in get_webdriver
return getattr(self, "_get_{}".format(self._browser))()
File "/home/ebeb9/.local/lib/python3.6/site-packages/dash/testing/browser.py", line 456, in _get_chrome
else webdriver.Chrome(options=options, desired_capabilities=capabilities)
File "/home/ebeb9/.local/lib/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
self.service.start()
File "/home/ebeb9/.local/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 83, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
ERROR dash.testing.browser:browser.py:415 <<<Webdriver not initialized correctly>>>
Traceback (most recent call last):
File "/home/ebeb9/.local/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 76, in start
stdin=PIPE)
File "/usr/lib/python3.6/subprocess.py", line 729, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.6/subprocess.py", line 1364, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'chromedriver': 'chromedriver'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/ebeb9/.local/lib/python3.6/site-packages/dash/testing/browser.py", line 413, in get_webdriver
return getattr(self, "_get_{}".format(self._browser))()
File "/home/ebeb9/.local/lib/python3.6/site-packages/dash/testing/browser.py", line 456, in _get_chrome
else webdriver.Chrome(options=options, desired_capabilities=capabilities)
File "/home/ebeb9/.local/lib/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
self.service.start()
File "/home/ebeb9/.local/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 83, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
100% ██████████
=================================================================================================== short test summary info ===================================================================================================
FAILED tests/dataviz/test_dataviz.py::test_one - dash.testing.errors.TestingTimeoutError: expected condition not met within timeout
Results (1.33s):
1 error
** Full Source Code / Repo **
Our repository/branch for the Front end using Dash can be found at
https://github.com/Social-Media-Public-Analysis/Social-Media-Public-Analysis/tree/dataviz
Thank you and I hope this was enough information!