Selenium and Headless Environment
Using the X Virtual Frame Buffer (Xvfb):
We can use xvfb to create a headless environment for selenium (for example, to run over SSH).
Instructions:
Start
xvfb
with the following options:$ Xvfb :89 -ac -noreset
(where
:89
is the virtual "display" created).Then, set the
DISPLAY
variable to be this virtual display:$ export DISPLAY=:89
At this point, we can run the selenium server as desired. Examples follow.
Run the server Java archive:
$ java -jar selenium-server.jar
In Python:
from selenium import webdriverdriver = webdriver.Firefox()...