Can't run firefox in headless mode
According to documentation to start selenium server in headless mode I am supposed to launch the server with the xvfb-run wrapper under a specific Firefox profile. This can be done with following command : DISPLAY=:1 xvfb-run java -jar selenium-server.jar -firefoxProfileTemplate /home/ronline/.mozilla/firefox/aqiycn5z.selenium
Once I get system acknowledgement that selenium server is up and running I call my phpunit script to execute a set of basic tests phpunit --log-tap test.log test.php
but the excution freeze with a selenium server output about launching firefox 17:50:33.300 INFO - Preparing Firefox profile... 17:50:36.376 INFO - Launching Firefox...
Firefox headless mode is supposed to run out of the box. Are there any additional drivers to be installed in the order to get this work?
Installation details: firefox --version Mozilla Firefox 38.0 PHPUnit 4.6.6 Ubuntu LTS 12.04
The content of the test.php :
<?php
class EditUser extends PHPUnit_Extensions_SeleniumTestCase
{
protected function setUp()
{
$this->setBrowser("*firefox /usr/lib/firefox/firefox");
$this->setBrowserUrl("http://www.google.com");
}
public function testMyTestCase()
{
$this->open("/");
}
}
?>
Apparently the Firefox 38.0 is still not supported by the selenium server. The solution is to install the Firefox 34.0 and point to the selenium server to its binary executable:
$this->setBrowser("*firefox /opt/firefox/firefox-34/firefox-bin");
Another option is to remove the setBrowser method from the unit test file and injecting the bellow xml snippet to the phpunit xml configuration file.
<selenium>
<browsername="Firefox"
browser="*firefox /opt/firefox/firefox-34/firefox-bin"
host="localhost"
port="4444"
timeout="30000"/>
</selenium>
链接地址: http://www.djcxy.com/p/57522.html
下一篇: 无法在无头模式下运行Firefox