1

I'm extending a python 3 docker image to run chrome headlessly for a robot framework test library. Chrome was working, but is now failing with this error:

  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

I've tried using chromedriver 83 instead of 84 and I tried deleting my images and rebuilding them. My Dockerfile looks like this:

FROM python:3

RUN apt-get update -y

# Dependencies
RUN apt-get install -y  \
       apt-utils \
       build-essential \
       fonts-liberation \
       gconf-service \
       libappindicator1 \
       libasound2 \
       libcurl4 \
       libffi-dev \
       libgconf-2-4 \
       libindicator7 \
       libnspr4 \
       libnss3 \
       libpango1.0-0 \
       libssl-dev \
       libxss1 \
       libgbm1 \
       python-dev \
       python-pip \
       python-pyasn1 \
       python-pyasn1-modules \
       unzip \
       wget \
       xdg-utils \
       xvfb \
       libappindicator3-1 \
       libatk-bridge2.0-0 \
       libgtk-3-0 \
       lsb-release

RUN wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \
        && dpkg -i google-chrome*.deb \
        && rm google-chrome*.deb \
    && wget -q https://chromedriver.storage.googleapis.com/84.0.4147.30/chromedriver_linux64.zip \
        && unzip chromedriver_linux64.zip \
        && rm chromedriver_linux64.zip \
        && mv chromedriver /usr/local/bin \
        && chmod +x /usr/local/bin/chromedriver

RUN python3 -m pip install selenium
RUN python3 -m pip install robotframework

RUN python3 -m pip install --upgrade robotframework-seleniumlibrary 

And I have this in my resources.robot file to start chrome/chromedriver:

Open Chrome Browser
    ${options}                          Evaluate             sys.modules['selenium.webdriver'].ChromeOptions()  sys, selenium.webdriver
    Call Method                         ${options}           add_argument    --no-sandbox
    Call Method                         ${options}           add_argument    --headless
    ${prefs}                            Create Dictionary    download.default_directory=${TMP_PATH}
    Call Method                         ${options}           add_experimental_option    prefs    ${prefs}
    Create Webdriver                    Chrome               chrome_options=${options}

Docker Login
    Start Virtual Display               1920    1080
    Open Chrome Browser
    Go To                               ${URL}

I've been stuck on this for a couple of days so any ideas of how I can get chrome/chromedriver working again would be rad!

Emery
  • 11
  • 1
  • [This question](https://stackoverflow.com/questions/50642308/webdriverexception-unknown-error-devtoolsactiveport-file-doesnt-exist-while-t) suggests that you could try the flags `--no-sandbox` or `--disable-dev-shm-usage`. Do either of those help? – Nick ODell Jul 30 '20 at 00:25
  • @NickODell I managed to fix it, the code above works - the problem was that somewhere else in the test code was opening a browser without the Open Chrome Browser keyword – Emery Jul 30 '20 at 16:15

0 Answers0