Java 如何在远程服务器上使用selenium运行codeception验收测试
我的phpunit有一个测试服务器,现在我们想用selenium添加codeception验收测试 但是,正如您所知,远程服务器没有“桌面”,因此它不会像我们的开发人员计算机那样打开浏览器 我尝试在计算机上安装firefox,但仍然出现以下错误:Java 如何在远程服务器上使用selenium运行codeception验收测试,java,php,linux,selenium,codeception,Java,Php,Linux,Selenium,Codeception,我的phpunit有一个测试服务器,现在我们想用selenium添加codeception验收测试 但是,正如您所知,远程服务器没有“桌面”,因此它不会像我们的开发人员计算机那样打开浏览器 我尝试在计算机上安装firefox,但仍然出现以下错误: Cannot find firefox binary in PATH. Make sure firefox is installed. OS appears to be: LINUX Build info: version: '2.44.0
Cannot find firefox binary in PATH. Make sure firefox is installed. OS appears to be: LINUX
Build info: version: '2.44.0', revision: '76d78cf', time: '2014-10-23 20:02:37'
System info: host: 'testdev', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version:
'3.2.0-23-generic', java.version: '1.7.0_65'
Driver info: driver.version: FirefoxDriver
Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
Error: no display specified
Error: no display specified
所以现在我做了这个
WebDriver:
url: 'http://example.com/'
browser: firefox
capabilities:
binary: "/usr/bin/firefox"
我得到了这个错误:
Cannot find firefox binary in PATH. Make sure firefox is installed. OS appears to be: LINUX
Build info: version: '2.44.0', revision: '76d78cf', time: '2014-10-23 20:02:37'
System info: host: 'testdev', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version:
'3.2.0-23-generic', java.version: '1.7.0_65'
Driver info: driver.version: FirefoxDriver
Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
Error: no display specified
Error: no display specified
有可能我在做什么吗
或者我必须有一个“屏幕”?才能将Selenium与Firefox或Chrome等一起使用-您需要一个具有用户界面的linux发行版
如果你在一台没有显示器(也就是终端)的linux机器上,那么你可以研究Selenium HTMLUnit(无头浏览)。你可以通过PHPBrowser进行无头浏览,或者你可以安装一个像xfce4 vnc4server这样的GUI,它将为你提供一个运行Firefox的虚拟桌面。这有一个额外的好处,您可以以图形方式观看测试运行