Robot framework tests are not running in github actions

Im trying to run a very simple robot framework test of launching a browser from github actions. I have installed chrome and chrome browser and gave necessary permissions. But tests are failing with 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.)”

Dependencies in github actions:

          sudo apt-get update
          sudo apt -y --force-yes install fonts-liberation libasound2  libatk-bridge2.0-0 libatk1.0-0  libatspi2.0-0  libcairo2 libcups2 libdrm2 libgbm1 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libx11-6 libxcb1 libxcomposite1 libxdamage1 libxext6 libxfixes3 libxkbcommon0 libxrandr2 xdg-utils
          sudo apt -y --force-yes install wget
          wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
          sudo dpkg -i google-chrome-stable_current_amd64.deb
          sudo apt install -f
          google-chrome --version
          wget -N https://chromedriver.storage.googleapis.com/106.0.5249.61/chromedriver_linux64.zip -P ~/
          unzip ~/chromedriver_linux64.zip -d ~/
          rm ~/chromedriver_linux64.zip
          echo $PATH
          sudo mv -f ~/chromedriver /usr/local/bin
          sudo chmod +x /usr/local/bin/chromedriver
          echo $PATH


Parent setup:

Launch URL
${chrome_options}=  Evaluate  sys.modules['selenium.webdriver'].ChromeOptions()  sys, selenium.webdriver
Call Method    ${chrome_options}    add_argument    --no-sandbox
Call Method    ${chrome_options}    add_argument    --disable-extensions
Call Method    ${chrome_options}    add_argument    --headless
Call Method    ${chrome_options}    add_argument    --disable-gpu
Create Webdriver    Chrome    chrome_options=${chrome_options}
Go To    ${URL}

Hi @Tejaswini,

If I remember correctly github actions, just like docker containers don’t have a display server by default, but chrome needs one even when running headless.

I usually just use XVFB, but depending on what you need to do you might need a window manager as well, if are only useing BrowserLibrary or SeleniumLibrary then there is no need for a window manager, just running XVFB and setting up the $DISPLAY environment variable for your logged in user should be enough.

FYI this is the a snippet from one of my github actions for a gui app, so I needed a window manager (I used fluxbox) but this might help you get started (I ran xvfb on display 13, only because 13 is my lucky number, you can use any display number you like), obviously you’ll need to ensure xvfb and any window manager you want are installed:

      - 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 this helps,

Dave.