gpt4 book ai didi

使用 Xvfb 在 headless 模式下进行 Selenium 测试

转载 作者:行者123 更新时间:2023-12-03 00:49:19 27 4
gpt4 key购买 nike

我需要使用 Xvfb 以 headless 模式运行 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>

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

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

最佳答案

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

关于使用 Xvfb 在 headless 模式下进行 Selenium 测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4654212/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com