Browser Issue on running on gitlab ci cd yaml file

Hello everyone,
i am a beginner in robot framework. I created a test and as well pushed to my repository.

I can successfully run it locally but my pipeline (gitlab) is failing and i cant follow the issue.
My webdriver is already set correct.

Do you guys have a minute to check my issue?

You can just check the link with all the screenshots here python - Robot Framework issue: AttributeError: can't set attribute - Stack Overflow

Thanks in advance!

Hi Cem,

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 &

Hope that helps,

Dave.

2 Likes

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 :wink:

Pinging @EdManlove - maybe a priority issue ?

1 Like

Hi damies13,

Thanks a lot for your help!

Short information:

  • using Windows locally
  • gitlab runner is a Linux Debian
  • SeleniumLibrary is importet/installed

Whats working?:

  • Locally the tests are passed, as well headless

Failing:

  • pipline is failing, because of AttributeError

What did i do now?

  • i downgraded Selenium Version (3.9, 3.8,3.6,3.0.1) → was not helpful

  • i had no Display Manager on the runner, so i installed fluxbox → was not helpful, same issue :confused:

      > $ ps -e --forest
    
    PID TTY          TIME CMD
      1 ?        00:00:00 bash
     10 ?        00:00:00 bash
   1451 ?        00:00:00  \_ Xvfb
   1452 ?        00:00:00  \_ fluxbox
   1455 ?        00:00:00  \_ ps

Hi Rasjani,

thanks a lot! I saw the link before and i am using an older version (3.9) and still have the issue…

Thanks