Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

selenium test in headless mode with Xvfb

Tags:

selenium

i need to run selenium tests in a headless mode using Xvfb, in the pom.xml i have:

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>selenium-maven-plugin</artifactId>
        <version>1.1</version>

        <executions>
            <execution>
                <id>xvfb</id>
                <phase>pre-integration-test</phase>
                <goals>
                    <goal>xvfb</goal>
                </goals>
                <!-- 
                <configuration>
                    <display>:2</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>

when i run mvn integration-test, it failed to load Xvfb, selenium tests were still ran in firefox, i checked the following:

(EE) AIGLX error: dlopen of /usr/X11/lib/dri/swrast_dri.so failed (dlopen(/usr/X11/lib/dri/swrast_dri.so, 5): image not found)
(EE) GLX: could not load software renderer
(EE) XKB: Couldn't open rules file /usr/X11/share/X11/xkb/rules/base
(EE) XKB: No components provided for device Virtual core keyboard

anyone know what that means? Thanks.

like image 660
user468587 Avatar asked Jan 11 '11 04:01

user468587


1 Answers

Adding -extension GLX to your Xvfb command line may remove the first two errors.

like image 179
Jamie Avatar answered Nov 18 '22 04:11

Jamie