Fix “Could not start Selenium session… Error starting browser ” (maven + TestNG + headless unix)By neokrates, written on April 27, 2010 |
howto |
- neokrates
- Email: uwarov@yahoo.com
- Website: http://www.thinkplexx.com
- Join date: 05-31-09
- Posts: 20
Which test frameworks do you use?
- Something different (91%, 10 Votes)
- Selenium (9%, 1 Votes)
- JUnit (or any other *unit*) (0%, 0 Votes)
- Fit (0%, 0 Votes)
- JBehave (0%, 0 Votes)
- Mockito (or any other *mock*) (0%, 0 Votes)
- Canoo WebTest (0%, 0 Votes)
Total Voters: 11
Loading ...
That is a common configuration to run many browser tests under selenium. One specific case is headless unix, i.e. hardware without monitor. The problem is to let browser run without X-Server. The described solution allows gui-based browsers to run under selenium. It fixes “Error starting browser” in many, but not all cases.
Important: that fix only applies to headless systems. If on your target system, firefox already running under X-Server, this fix won’t help.
For headless systems it is important, that all gui-based software actually finds an X-Server. If display is not available, xvfb can help (http://de.wikipedia.org/wiki/Xvfb).
Don’t forget to properly install and configure Xvfb on the target system. Use apt-get, aptitude, etc… if it is not yet installed.
Software:
Maven
TestNG (or any other framework)
Headless Unix
Selenium
Xvfb
The precondition is, that your maven + TestNG + Selenium project is already set up. Then, you have fully configured pom.xml.
Your DISPLAY environment variable is set to :1.0. If no, change <display>:1</display> in the code below accordingly. Add that execution to your pom.xml:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>selenium-maven-plugin</artifactId>
<executions>
<execution>
<id>xvfb</id>
<phase>pre-integration-test</phase>
<goals>
<goal>xvfb</goal>
</goals>
<configuration>
<display>:1</display>
</configuration>
</execution>
<execution>
<id>selenium</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start-server</goal>
</goals>
<configuration>
<background>true</background>
</configuration>
</execution>
</executions>
</plugin> |
Here is more about selenium-maven-plugin and Xvfb : http://mojo.codehaus.org/selenium-maven-plugin/examples/headless-with-xvfb.html.
Have fun!
|
LEARN MORE (amazon bookstore)
|
|
TAGS
|
|
RELATED
|
Pages
Posts
|
|
SOCIAL
|
|
INCOMING SEARCH TERMS
|


















