【问题标题】:selenium tests fail: xvfb-run: error: Xvfb failed to startselenium 测试失败:xvfb-run:错误:Xvfb 无法启动
【发布时间】:2016-05-20 00:08:09
【问题描述】:

我在 phpuni-environment.conf 文件中有这个用于硒测试的配置

[program:selenium]
command=xvfb-run java -Dwebdriver.firefox.bin=/usr/bin/firefox -jar /usr/share/selenium/selenium-server-standalone.jar
autostart=false ; selenium

[program:python-webserver]
command=python -m SimpleHTTPServer 8080
directory=. ; python-webserver
autostart=false ; python-webserver

[program:php-webserver]
command=php -S localhost:8080
directory=. ; php-webserver
autostart=false ; php-webserver

我通过 vagrant 进行测试。每当我运行任何类型的测试时,我总是会收到此错误

xvfb-run: error: Xvfb failed to start

我为这个错误找到了几个解决方案,我尝试了这个

command=xvfb-run --auto-servernum --server-num=1 java -Dwebdriver.firefox.bin=/usr/bin/firefox -jar /usr/share/selenium/selenium-server-standalone.jar

但我仍然得到同样的错误。我在这里错过了什么?

【问题讨论】:

标签: php selenium ubuntu xvfb


【解决方案1】:

下面的代码用于启动 XVFB 服务器并在为 java 透视图编写的无头模式下进行测试。

应该在 CENTOS 中运行以下命令

显示=:99 sudo java -jar /root/Seleniumfolder/selenium-server-standalone-2.50.0.jar -log /root/Seleniumfolder/SeleniumServer.log -host 127.0.0.1 -port 4444 -Dwebdriver.firefox.bin="/usr/bin /火狐"

【讨论】:

  • 你能给我这个文件吗?我找不到它。
猜你喜欢
  • 2013-05-19
  • 1970-01-01
  • 2017-09-24
  • 1970-01-01
  • 2018-09-12
  • 2017-05-03
  • 1970-01-01
  • 2022-11-12
  • 2016-07-26
相关资源
最近更新 更多