Ubuntu – Error when executing headless firefox through Selenium

firefoxheadlessseleniumUbuntux11

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

Best Answer

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.

Related Question