Getting GDK_BACKEND does not match available display error in debian

Actually, I am trying to run a mute browser on a remote debian server via selenium. I have firefox 46.0.1 installed on the server and I am using selenium version 2.53.1.

Whenever I tried to run a given test, I received the following error.

org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary(/usr/bin/firefox) on port 7055; process output follows: 
Error: GDK_BACKEND does not match available displays

I have a firefox driver instance in my code:

saDriver = new FirefoxDriver();

can anyone help?

+4
source share
2 answers

I am not familiar with Java. However, in Python, this problem can be solved with the following method, it can help you

: GDK_BACKEND , pyvirtualdisplay:

pip install pyvirtualdisplay selenium

xvfb:

sudo apt-get install xvfb

:

from pyvirtualdisplay import Display
display = Display(visible=0, size=(800, 600))
display.start()

:

from pyvirtualdisplay import Display
from selenium import webdriver

display = Display(visible=0, size=(800, 600))
display.start()

browser = webdriver.Firefox()
browser.get('http://www.python.org')

browser.close()
display.stop()
+1

, selenium, .

nohup sudo Xvfb: 10 - ac &
export DISPLAY=10
0

Source: https://habr.com/ru/post/1661863/


All Articles