i'm having trouble getting selenium see sites hosted on virtual machine. following test causes error, , have no idea why:
<?php require_once 'phpunit/extensions/seleniumtestcase.php'; class actualtest extends phpunit_extensions_seleniumtestcase { protected function setup() { $this->setbrowser("*firefox"); $this->setbrowserurl("http://10.48.77.48/"); // ip of virtual machine $this->sethost('192.168.101.1'); // ip of mac } public function testgethomepage() { $this->open("/", true); } }
it returns following error message, indicating couldn't find virtual machine:
$ phpunit actualtest.php phpunit 3.5.6 sebastian bergmann. e time: 7 seconds, memory: 6.75mb there 1 error: 1) actualtest::testgethomepage phpunit_framework_exception: response selenium rc server testcomplete(). xhr error: url = http://10.48.77.48/ response_code = 404 error_message = page not found. /home/craiga/ombudsman/app/systemtests/actualtest.php:16 failures! tests: 1, assertions: 0, errors: 1.
i can access site browser anywhere on network without problem, reason browser launched selenium can't. error occurs whether launch test virtual machine or mac.
i can following test connect google without problem:
<?php require_once 'phpunit/extensions/seleniumtestcase.php'; class vanitysearchtest extends phpunit_extensions_seleniumtestcase { protected function setup() { $this->setbrowser("*firefox"); $this->setbrowserurl("http://www.google.com.au/"); $this->sethost('192.168.101.1'); // ip of mac } public function testsearchforself() { $this->open("/"); $this->type("q", "craig anderson"); $this->click("btng"); $this->waitforpagetoload("30000"); try { $this->asserttrue($this->istextpresent("craiga.id.au")); } catch (phpunit_framework_assertionfailederror $e) { array_push($this->verificationerrors, $e->tostring()); } } }
this test, connects mac's default page, passes without problems:
<?php require_once 'phpunit/extensions/seleniumtestcase.php'; class mactest extends phpunit_extensions_seleniumtestcase { protected function setup() { $this->setbrowser("*firefox"); $this->setbrowserurl("http://192.168.101.1/"); $this->sethost('192.168.101.1'); // ip of mac } public function testmachomepage() { $this->open("/"); try { $this->asserttrue($this->istextpresent("it works!")); } catch (phpunit_framework_assertionfailederror $e) { array_push($this->verificationerrors, $e->tostring()); } } }
does have idea why might happening? i'm happy provide whatever information can setup. i'm using selenium server 1.0.3, , latest phpunit pear.
remove 1 http below line
$this->setbrowserurl("http://http://10.48.77.48/"); // ip of virtual machine
and try...let me know if works
Comments
Post a Comment