7

I am trying to execute headless firefox on the remote machine(running Ubuntu 16.04) through Selenium via SSH. However, this gives me a "Error: GDK_BACKEND does not match available displays" error. My host machine runs Windows. I do not want to see the graphical output. It is just being used for selenium testing.

I am using X Virtual Frame Buffer to act as a dummy driver:

Xvfb :10 -screen 0 1024x768x16 &

I also have exported the DISPLAY environment variable with the value of 10 for this specific case.

Where am I going wrong?

EDIT: When I simply run "sudo firefox" in my commandline over SSH after running xvbf, no errors are thrown. Errors are only thrown when running firefox through selenium.

More Details:-

I am calling firefox through selenium. The exact error that the selenium standalone server gives is:-

17:52:55.218 INFO - Executing: [new session: Capabilities     [{browserName=firefox, platform=ANY,     firefox_profile=UEsDBBQAAAAAAJuOD0nf9RXUMgAAA...}]])
17:52:55.230 INFO - Creating a new session for Capabilities   [{browserName=firefox, platform=ANY, firefox_profile=UEsDBBQAAAAAAJuOD0nf9RXUMgAAA...}]
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host     127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
Error: GDK_BACKEND does not match available displays
4
  • Apparently ubuntu does not come with xinit installed by default so, maybe, firefox cannot find that it should be using xorg as the backend.
    – grochmal
    Commented Aug 15, 2016 at 19:15
  • @grochmal I do not really know xserver in depth. Can you please explain why I need xinit?
    – goluhaque
    Commented Aug 15, 2016 at 19:29
  • It is just because of the variable GDK_BACKEND, the only place I know that that is used is in forcing GTK to use wayland. In that case it would be set to GDK_BACKEND=wayland. The equivalent for xorg would be GDK_BACKEND=xinit (but that is a guess).
    – grochmal
    Commented Aug 15, 2016 at 19:39
  • Apparently this is caused because of incompatibility between Firefox 48 and Selenium(selenium extension is not signed in firefox 48, and firefox 48 only runs signed extensions). I just went ahead with using chrome.
    – goluhaque
    Commented Aug 15, 2016 at 19:58

4 Answers 4

2

Apparently this is caused because of incompatibility between Firefox 48 and Selenium(selenium extension is not signed in firefox 48, and firefox 48 only runs signed extensions). I just used chrome, as my use-case was not extremely browser-specific.

2

I solved this issue with Firefox. The steps are:

  1. Downgraded Firefox from 49.0 to 46.0
  2. Install XVFB by command sudo apt-get install xvfb
  3. Run Selenium with the command xvfb-run java8 -jar selenium-project.jar

My Selenium version is 2.53.1 and Ubuntu 14.04.

0

I don't know why the DISPLAY env variable method didn't work, but I switched to using xvfb-run <command> (in my case xvfb-run npm test) and it worked great! :)

0

I have answered here https://stackoverflow.com/questions/50250580/error-gdk-backend-does- not-match-available-displays-running-selenium-using-cro

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .