使用Xvfb在无头模式下进行硒测试

use*_*587 8 selenium

我需要使用Xvfb在无头模式下运行selenium测试,在pom.xml中我有:

      <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>
Run Code Online (Sandbox Code Playgroud)

当我运行mvn integration-test时,它无法加载Xvfb,selenium测试仍然在firefox中运行,我检查了以下内容:

(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
Run Code Online (Sandbox Code Playgroud)

有谁知道这意味着什么?谢谢.

Jam*_*mie 6

将-extension GLX添加到Xvfb命令行可能会删除前两个错误.