-
Notifications
You must be signed in to change notification settings - Fork 196
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
Error: 'chromedriver' executable needs to be in PATH. #14
Comments
There are 2 problems in this script:
For me I would change the last part of the script like this:
Or it should also works with the correct executable path:
|
did you resolve this issue? tried using this in my
this is the code i'm using: opts = Options()
opts.add_argument('--no-sandbox')
opts.add_argument('--ignore-certificate-errors')
opts.add_argument('--start-maximized')
opts.add_argument('--disable-dev-shm-usage')
#opts.binary_location = '/usr/bin/google-chrome-stable'
with open(creds, 'r') as f:
creds = json.load(f)
if headless:
opts.add_argument('--headless')
assert opts.headless
def enable_download_headless(browser, download_dir):
browser.command_executor._commands["send_command"] = ("POST", '/session/$sessionId/chromium/send_command')
params = {'cmd':'Page.setDownloadBehavior', 'params': {'behavior': 'allow', 'downloadPath': download_dir}}
browser.execute("send_command", params)
prefs = {
'download.default_directory': download_path,
'download.prompt_for_download': False,
'download.directory_upgrade': True,
'safebrowsing.enabled': False,
'safebrowsing.disable_download_protection': True}
else:
prefs = {
'download.prompt_for_download': False,
'safebrowsing.enabled': False,
'safebrowsing.disable_download_protection': True}
opts.add_experimental_option("prefs", prefs)
browser = Chrome(executable_path = '/usr/local/bin/chromedriver', options = opts) |
@stevenhurwitt Could you try with adding these arguments, see if the crash still happens?
|
yeah so i think the issue was that it needed to be in the same directory as the script and i needed some additional dependencies for the ubuntu docker container. reference here |
I have implemented your dockfile into my project which uses webdriver chrome to run the python test script (using mac OS) . However when tried, it errors out as follows:
Docker file:
Use an official Python runtime as a parent image
FROM python:3.7
ENV APP_DIR /app
WORKDIR $APP_DIR
ENV PYTHONPATH="$PYTHONPATH:/app"
COPY uits uits
COPY requirements.txt requirements.txt
COPY setup.py setup.py
install google chrome
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
RUN sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
RUN apt-get -y update
RUN apt-get install -y google-chrome-stable
install chromedriver
RUN apt-get install -yqq unzip
RUN wget -O /tmp/chromedriver.zip http://chromedriver.storage.googleapis.com/`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`/chromedriver_linux64.zip
RUN unzip /tmp/chromedriver.zip chromedriver -d /usr/local/bin/
set display port to avoid crash
ENV DISPLAY=:99
install selenium
RUN pip install selenium
upgrade pip
RUN pip install --upgrade pip
#install required additional dependencies
RUN pip install -r requirements.txt
Test script look like this:
class SeleniumClient(object):
"""
A wrapper for selenium's client with various handy extensions.
"""
def init(self, params=None, config="default", driver=None):
if driver is not None:
self.driver = driver
return
The text was updated successfully, but these errors were encountered: