No X11 DISPLAY variable was set - Linux VM Error

770 views
Skip to first unread message

80Vikram

unread,
Mar 11, 2016, 8:49:18 AM3/11/16
to Serenity BDD Users Group
Hi,

Earlier I had docker setup on MAC mini and everything works perfectly.

Now I'm trying to replicate same setup on Linux VM + Docker ;  but getting below error and all the test cases are failing.

java.awt.HeadlessException:
No X11 DISPLAY variable was set, but this program performed an operation which requires it.


I have installed xvbf , chrome browser and chrome driver successfully on Linux VM
. Please let me know if you had encountered this issue earlier

Thanks & Regards,
Vikram



Sébastien Bouffard

unread,
Mar 16, 2016, 7:02:59 PM3/16/16
to Serenity BDD Users Group
Hi

Not really a Serenity related question IMO... but in case this could help, here is a script I am using for a similar setup (Selenium + xvfb). It's going to to start an xvfb session, then start selenium server and wait until everything is up and running. Of course you will need to update the paths and all... hope this helps!

#!/bin/bash

S1="$(wget --server-response http://127.0.0.1:4444/wd/hub/static/resource/hub.html 2>&1 | awk '/^  HTTP/{print $2}')"

if [ x$S1 = x200 ];

then

echo "Selenium is running."

else

echo "Turning on Xvfb and Selenium..."

sudo Xvfb :10 -screen 0 1366x768x24 -ac > /dev/null 2>&1 &

sudo DISPLAY=:10 nohup xvfb-run java -jar /usr/local/bin/selenium-server-standalone-2.50.0.jar -Dwebdriver.chrome.driver=/usr/local/bin/chromedriver &

until [  x$S1 = x200 ]; do

sleep 5

echo "..."

S1="$(wget --server-response http://127.0.0.1:4444/wd/hub/static/resource/hub.html 2>&1 | awk '/^  HTTP/{print $2}')"

done

echo "OK."

fi


echo "Starting tests..."

# cmd to start your tests...

Reply all
Reply to author
Forward
0 new messages