Unable to start Chrome in Docker using image marketsquare/robotframework-browser:18.8.0

Hi, would like to seek help regarding issue I encountered when running RobotFramework script in custom docker I built using this image marketsquare/robotframework-browser:18.8.0

Setup failed: SessionNotCreatedException: Message: session not created: Chrome failed to start: exited normally. (session not created: DevToolsActivePort file doesn’t exist)
(The process started from chrome location /opt/google/chrome/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Stacktrace:
#0 0x55f155e4486a
#1 0x55f155b12e50
#2 0x55f155b4ae05
#3 0x55f155b46c78
#4 0x55f155b9364e
#5 0x55f155b92e66
#6 0x55f155b87233
#7 0x55f155b55093
#8 0x55f155b5609e
#9 0x55f155e0bacb
#10 0x55f155e0fa81
#11 0x55f155df7695
#12 0x55f155e105f2
#13 0x55f155ddc86f
#14 0x55f155e33668
#15 0x55f155e33832
#16 0x55f155e4365c
#17 0x7f747e740609 start_thread
Skipped for Retry

I already tried using these ${chrome_options}= --no-sandbox --disable-dev-shm-usage --headless --disable-gpu --use-fake-ui-for-media-stream but still the same issue

Any suggestions?

Feels weird - browser library does not use chromedriver …

I’m using SeleniumLibrary and I downloaded my chromedriver from here Chrome for Testing availability

I’m a little curious why you chose that docker image which is built for Browser Library when you’re using SeleniumLibrary, why didn’t you choose a docker image which is built SeleniumLibrary?

If you search docker hub for SeleniumLibrary there are several to choose from.

Dave.

How did you know that it is build for Browser Library? Also I installed
SeleniumLibrary and others in the docker image but still encountered the issue. Anything I missed?

Appium-Python-Client 3.2.1
attrs 23.1.0
certifi 2024.7.4
cffi 1.16.0
click 8.1.7
colorama 0.4.6
decorator 5.1.1
docutils 0.20.1
grpcio 1.59.3
grpcio-tools 1.59.3
h11 0.14.0
idna 3.4
kitchen 1.2.6
natsort 8.4.0
outcome 1.3.0.post0
overrides 7.4.0
pip 24.2
protobuf 4.25.1
pycparser 2.21
Pygments 2.17.2
PySocks 1.7.1
robotframework 6.1.1
robotframework-appiumlibrary 2.0.0
robotframework-assertion-engine 3.0.3
robotframework-browser 18.0.0
robotframework-datadriver 1.11.0
robotframework-dependencylibrary 4.0.1
robotframework-pabot 2.16.0
robotframework-pythonlibcore 4.3.0
robotframework-retryfailed 0.2.0
robotframework-seleniumlibrary 6.1.3
robotframework-stacktrace 0.4.1
selenium 4.12.0
setuptools 68.2.2
six 1.16.0
sniffio 1.3.0
sortedcontainers 2.4.0
trio 0.23.1
trio-websocket 0.11.1
typing_extensions 4.8.0
urllib3 2.1.0
wrapt 1.16.0
wsproto 1.2.0

The name robotframework-browseris a pretty good clue, but also the overview says:

Docker images for RobotFramework Browser library⁠.

https://hub.docker.com/r/marketsquare/robotframework-browser

I can see you’ve added seleniumlibrary and other stuff, I was just curious why you chose a Browser library⁠ image as your base and not an image that already had a working seleniumlibrary?

I would have thought if you knew you wanted to use seleniumlibrary it’d be easier to start from a base that already had seleniumlibrary and the browser you want so there was less to install to your final image.

But you might also have a really good reason for using this base and by asking I could learn something.

Dave.

I only got the direction to use this specific image. Ops who provided this image based the selection from the image mentioned here GitLab | ROBOT FRAMEWORK . So I think its a reliable source and secured from Ops perspective.

In terms of security of using any dockerimage built for SeleniumLibrary, how do you make sure which image is secured and which is not?

Ah ok, your ops team telling you this is the approved one is a good reason.

In terms of security of using any dockerimage built for SeleniumLibrary, how do you make sure which image is secured and which is not?

I’m pretty new to docker so I have no idea how to answer how you make sure any image is secured?

What I was shown is that you can view the makeup of an image like this:

https://hub.docker.com/layers/h4cki0us/robot-selenium/0.0.1/images/sha256-752ed5fed58fdeb8761558e201b0a71c46f1ad72fbcbf04e6effedc30143045e?context=explore

I guess my question then becomes when there’s no “official” image what makes a community contributed image not secure or not trustworthy for your ops team?

I ask because I’ve developed a tool that works with robot framework, I don’t have the skill or time to setup “official” images, however one of the users of my tool has put their hand up to make community contributed images available, would your ops team reject those images because they’re not “official” images?

Dave.

1 Like

I’ll discuss the matter with them. I think I really need to change the image I also tried installing some chrome dependencies and running chrome as non-root but still no luck. Will share here in thread once I find a suitable image.

I’m trying to search for possible replacement here in https://hub.docker.com/ I’m using the filter under Trusted Content. Which do you think is better for running RobotFramework scripts in different browsers? Should I select Python or Selenium image then customize it by installing other necessary packages, dependencies and libraries.

Any recommendations on which is more reliable and will give less headache such as this Chrome issue

1 Like

Hi,

Personnaly I use this docker image that works pretty well:

Images will never fit 100% your requirements, but you can modify the Dockerfile easily, change versions, start script etc…

About your issues, you mentioned you downloaded the chromedriver from the testing availability site, but usually it is installed when building the image alongside with chrome, from a package depending of your docker OS (Fedora or else… with dnf).

Also it needs a virtual screen, such as xfvb (you can check Dockerfile from the link above how the .sh endpoint script is done, also for packages installation).

For security concerns, anyway the update rate of the available or maintained images might not be sufficient sometimes to cover the ongoing and found vulnerabilities. But Docker Desktop for example gives you info on the build image with CVE and vulnerabilities.
You can then update the Dockerfile and rebuild the image with the needed versions.

Regards
Charlie

2 Likes

Do I still need xfvb even I will just run my tests using headless?

Yes, there needs to be a display or the browser will crash, at least for Chrome and other Chromium based browsers as well as Firefox.

Dave.

1 Like

You can use this Dockerfile i created for my headless chrome tests, it is working fine:

# Use an official Python runtime as a parent image
FROM python:3.10-bookworm

ENV DEBUG=True

WORKDIR /hydra_manager

# Install ping utility
RUN apt-get update && apt-get upgrade -y && \
    apt-get install -y iputils-ping net-tools curl wget netcat-openbsd gnupg

RUN apt-get update && apt-get install -y \
    curl \
    wget \
    gnupg \
    software-properties-common \
    lsb-release \
    libgconf-2-4 \
    libnss3 \
    libx11-xcb1 \
    libxkbcommon0 \
    libxcomposite1 \
    libxdamage1 \
    libxrandr2 \
    libgbm1 \
    libasound2 \
    libpangocairo-1.0-0 \
    libatk1.0-0 \
    libcups2 \
    libgdk-pixbuf2.0-0 \
    libdrm2 \
    xdg-utils \
    --no-install-recommends \
    && rm -rf /var/lib/apt/lists/*

# Add amd64 architecture support for Google Chrome
RUN dpkg --add-architecture amd64

# Download and add the correct Google Chrome repository key using curl and gpg
RUN curl -fsSL https://dl.google.com/linux/linux_signing_key.pub | gpg --dearmor -o /usr/share/keyrings/google-chrome-keyring.gpg

# Add the Google Chrome repository with the correct key and architecture
RUN echo "deb [arch=amd64 signed-by=/usr/share/keyrings/google-chrome-keyring.gpg] http://dl.google.com/linux/chrome/deb/ stable main" | tee /etc/apt/sources.list.d/google-chrome.list

# Install Google Chrome
RUN apt-get update && apt-get install -y google-chrome-stable

# Verify Chrome installation
RUN google-chrome --version

# Copy the rest of the application code
COPY . /hydra_manager

RUN pip install --upgrade pip
RUN pip install packaging


# Install any needed packages specified in requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

ENV LISTEN_PORT=8000
EXPOSE 8000

# prevent python from writning .pyc files
ENV PYTHONDONTWRITEBYTECODE 1

# ensure Python output is sent directly to the terminal without buffering
ENV PYTHONUNBUFFERED 1

# Ensure the entry point script is executable
RUN chmod +x /hydra_manager/entrypoint.py

ENTRYPOINT ["python", "/hydra_manager/entrypoint.py"]
#CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]

Hi @CharlieScene , I was able to run a test using the image you suggested ppodgorsek/robot-framework. I noticed the chrome and chromedriver version is 126. How can I update the Chrome and Chromedriver version the latest?

Hi,

In the beginning of the file you have environnement variables definition:

# Dependency versions
ENV CHROMIUM_VERSION 128.0

You can modify it there (128 version is available now for Fedora Updates System). Version is used here:

RUN dnf upgrade -y --refresh \
  && dnf install -y \
    chromedriver-${CHROMIUM_VERSION}* \
    chromium-${CHROMIUM_VERSION}* \

You could eventually use Chrome testing versions this way (personnaly I rather rely on a stable/managed version):

RUN dnf install -y --enablerepo=updates-testing \
    chromedriver \
    chromium \

Finally if you want automatic update at each run of the image-based container, you can look into the link I sent by mail for selenium driver manager (can be done I think when running the container with endpoint, but you’ll maybe have to manage authorization) here :

Regards.
Charlie

2 Likes

I tried doing it but I got this error

Hi,

It seems you’re missing the \bin folder needed next to dockerfile.
When building the image, it copies/paste the entrypoint file run run-tests-in-virtual-screen.sh that contains robot and pabot start command. This file is needed and called in the last command CMD [“run-tests-in-virtual-screen.sh”]
As well as the 2 other .sh file that setup parameters for chrome and chromedriver :

image

Regards.
Charlie

Now I got this SSL certificate problem. Any idea how to resolve this issue?

Hi,

Sorry but no clue there.

I tried with this Dockerfile to build and had an issue with chrome version that wasn’t found, but changed to 128 (instead of 128.0) and it worked.
Here it seems fedora repo cannot be reached (with 40 it worked here although).

Can you try with 39 eventually if you have same issue?

Eventually:

  • Check and update your certificates locally
  • Try to remove the previous image before build and build with nocache:
    docker build --no-cache -t image_name .

Regards
Charlie