Selenium and Headless Environment

I recently installed Python 2.7, Robot Framework and the Selenium Library (I still don't know if I succeded though...) on a Red Hat Server to run some test on a web application.

So I tried a simple test case using the robot framework to see if Selenium Library is functional, just to Open a web page, nothing more...

Selenium Server is up and running according to the result of ps, and firefox binaries are in the PATH...

Running the test case from the Robot Framework (with the pybot testcasename.tsv) I get an exception: ERROR: Problem capturing a screenshot to string: java.awt.AWTException: headless environment

So, what is the Headless Environment? Does anyone have an idea if there is something else that needs to be istalled or to be configured as well?


Using the X Virtual Frame Buffer (Xvfb):

We can use xvfb to create a headless environment for selenium (for example, to run over SSH).

  1. Start xvfb with the following options:

    $ Xvfb :89 -ac -noreset

    (where :89 is the virtual "display" created).

  2. Then, set the DISPLAY variable to be this virtual display:

    $ export DISPLAY=:89

  3. 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 webdriver

driver = webdriver.Firefox()

Need Your Help

selecting unique row from a table- ORACLE

sql oracle

I have a table employee that has employee’s benefit data.

How are variables scoped when calling the same Play template again?

java templates view playframework

I'm writing a tag that keeps track of how many time it was called, in order to generate unique ids for its elements:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.