我想在不显示的情况下在 Linux 服务器上使用 Maven 从 TeamCity 运行硒测试。
在运行 Selenium 测试时,我在 TeamCity 中收到以下错误:
Failed to execute goal org.codehaus.mojo:selenium-maven-plugin:2.3:xvfb (xvfb) on project my-project:
It appears that the configured display is already in use: :1
我安装了 x11-fonts*、xvfb、firefox,提取了 DISPLAY=localhost:1,启动了 xvfb
在 pom.xml 我添加了以下插件:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>selenium-maven-plugin</artifactId>
<version>2.3</version>
<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>
您对如何解决此问题有任何想法吗?
UPD: xvfb 正在使用命令运行
Xvfb :1 -screen 0 1920x1200x24 > /dev/null 2>&1 &
UPD:在我尝试在运行测试之前不运行 xvfb 之前,但得到:
Execution xvfb of goal org.codehaus.mojo:selenium-maven-plugin:2.3:xvfb failed: Execute failed: java.io.IOException: Cannot run program "xauth": java.io.IOException: error=2, No such file or directory