I'm using Selenium server (2.39.0) on centOs server 6.5 (redhat) developing tests in PHP, using phpUnit (i installed phpunit by pear as well)
but everytime i get this error:
Invalid response while accessing the Selenium Server at 'http://localhost:4444/selenium-server/driver/':
Failed to start new browser session: org.openqa.selenium.server.RemoteCommandException:
Error while launching browser
Caused by
RuntimeException:
Invalid response while accessing the Selenium Server at 'http://localhost:4444/selenium-server/driver/':
Failed to start new browser session: org.openqa.selenium.server.RemoteCommandException:
Error while launching browser
this is the test that i'm trying to execute:
<?php
require_once 'PHPUnit/Extensions/SeleniumTestCase.php';
class Example extends PHPUnit_Extensions_SeleniumTestCase
{
function setUp()
{
$this->setBrowser("*firefox");
$this->setBrowserUrl("http://www.google.com/");
}
function testMyTestCase()
{
$this->open("/");
$this->type("q", "selenium rc");
$this->click("btnG");
$this->waitForPageToLoad("30000");
$this->assertTrue($this->isTextPresent("Results * for selenium rc"));
}
}
?>
i'm trying also to run the script using :
phpunit --configuration conf.xml example.php
where in conf.xml i've got:
<browser name="Firefox" browser="*firefox" host="IPHOST" port="4444" timeout="30000" />
but i receive the same error
and the door 4444 is free:
netstat -anp | grep 4444
gives:
tcp 0 0 :::4444 :::* LISTEN
what am i doing wrong?
EDIT:
@sircapsalot: do you mean to change the script?
anyway i don't know if i'm going to the right direction but i changed something: first of all the script is different:
<?php
class Example extends PHPUnit_Extensions_Selenium2TestCase
{
protected function setUp()
{
$this->setBrowser('firefox');
$this->setBrowserUrl('http://www.example.com/');
}
public function testTitle()
{
$this->url('http://www.example.com/');
$this->assertEquals('Example WWW page', $this->title());
}
}
?>
and i installed Xvfb so now i don't have the error that selenium has failed to start new browser session, but i'm having another error
PHPUnit_Extensions_Selenium2TestCase_WebDriverException:
Unable to connect to host 127.0.0.1 on port 7055 after 45000ms.
Firefox console output:
Error: no display specified
and i already tried with:
Xvfb :99 -ac -screen 0 1280x1024x24 &
and:
export DISPLAY=:99