If the test works on your local machine but not on the Gitlab runner, then that would indicate the Gitlab runner machine is missing something that you need to run the test.
Lets start with the basics:
Are your local machine and the Gitlab runner machine using the same OS? which OS? (Windows/MacOS/Lunux?)
From the screen shot of your logs it looks like your Gitlab runner might be Linux?
I can see that you are using SeleniumLibrary and that RobotFramework has detected it’s installed, It doesn’t appear to be complaining about not having a webdriver so it appears you have that installed and it’s been found by SeleniumLibrary
If I’m correct in guessing your Gitlab runner is Linux, then which one? do you have a display manager installed (X11/Wayland)?
The reason I ask is even when you a browser in headless mode it still need a display manager and still needs the DISPLAY variable set.
To help troubleshoot your issue can you add this line just before Open Browser
Log %{DISPLAY}
It should return something like :0
If you know you don’t have a display manager installed, I usually install XVFB for this purpose on my github runners, I also install fluxbox for a very lightweight window manager, this is an excerpt from one of my github workflow runner YAML’s for Ubuntu-Latest, that should give you what you need to get started.
- name: "Ubuntu Xvfb"
if: ${{ matrix.platform == 'ubuntu-latest' }}
run: |
export DISPLAY=:13.0
Xvfb :13 -screen 0 1920x1080x24 > /dev/null 2>&1 &
# xauth with complain unless ~/.Xauthority exists
touch ~/.Xauthority
# To view a listing of the .Xauthority file, enter the following
xauth list
# fluxbox
fluxbox &
Im willing to make a bet that the python bindings of Selenium are newer in your CI machine than the ones on your local machine. ChromeOptions.headless attribute was mentioned to be deprecated half a year ago afaik and Diego posted about that Headless is Going Away! | Selenium
If you check the “Before” and “After” code snippets, “Before” is the exact way SeleniumLibrary still does that and thats where your error is happening according to the “logs you posted” to SO …
Either downgrade selenium itself in the CI to something where that works (see the version you have installed) … OR File a bug to SeleniumLibrary and cross your fingers that someone fixes the issue