Create a Docker image running Robot Framework

Hello Team,
I want to test a simple RobotFramework selenium script which
will launch Google website and then do a simple search. The script is
running fine when I am executing it directly without docker-compose (
meaning directly via the command robot Selenium.robot), now when I am
trying to run via docker-compose up, it is throwing me this error:`

WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally.
(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.)

This is what I am written in my Dockerfile:

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/89.0.4389.23/chromedriver_linux64.zip
&& unzip chromedriver_linux64.zip
&& rm chromedriver_linux64.zip
&& mv chromedriver /usr/local/bin
&& chmod +x /usr/local/bin/chromedriver

Br,
Sayom

Hi Sayom,

Are you using a docker template that is known to work or are you trying to create your own from scratch? It looks like you are trying to create your own but I don’t see any display settings?

If you duck duck “robot framework docker seleniumlibray” you’ll find a few working examples on github etc from various people.
This might be the easiest way for you to move forward if all you’re interested in is getting it working for your build and moving on with testing your application.

If you’re trying to create your own from scratch for the learning experience, have you got a display?
The browsers (even headless) will usually crash on launch without a display driver, and usually a docker image doesn’t have one, so the usual way to deal with this is to use XVFB.
You’ll also need to configure a screen resolution for XVFB and set the display variable amongst other things, so I recommend looking at the existing examples.

Dave.

1 Like