【问题标题】:selenium test in headless mode with Xvfb使用 Xvfb 在无头模式下进行硒测试
【发布时间】:2011-01-11 04:35:10
【问题描述】:

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

      <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>

当我运行 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

有人知道这是什么意思吗?谢谢。

【问题讨论】:

    标签: selenium


    【解决方案1】:

    在 Xvfb 命令行中添加 -extension GLX 可能会消除前两个错误。

    【讨论】:

    • 你的意思是+extension GLX
    【解决方案2】:

    我发现我的设置中缺少台面驱动程序。

    yum install mesa-dri-drivers 
    

    解决了问题。

    【讨论】:

      【解决方案3】:

      在 Debian / Ubuntu 中,包为“libgl1-mesa-dri”,如:

      apt-get install libgl1-mesa-dri
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2020-06-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-01-01
        • 2016-11-07
        • 2010-10-19
        相关资源
        最近更新 更多