I'm doing testing in PHPUnit+Selenium (using PHPUnit_Extensions_SeleniumTestCase) and I need to do something to close browser even if the test result on error. Let's see, I've done this test:
<?php
require_once 'PHPUnit/Extensions/SeleniumTestCase.php';
class WebTest extends PHPUnit_Extensions_SeleniumTestCase
{
protected $fail;
protected function setUp()
{
$this->setBrowser('*chrome');
$this->setBrowserUrl('http://www.google.com/');
}
public function testTitle()
{
$this->open('http://www.google.com/');
$this->assertTitle($this->fail->value());
}
}
?>
Which result on error caused by:
$this->assertTitle($this->fail->value());
Because there is not value in $fail and then the test finishes getting an error. The problem is that the browser remains open in Selenium. How can I force to close browser from Selenium?
Thx in advance.
browserSessionReuse
and forgot about it. You could also try with$this->stop()
. – Alexandru Guzinschi Oct 9 '14 at 12:37$this->shareSession(false);
before$this->open('http://www.google.com/');
– Alexandru Guzinschi Oct 9 '14 at 13:25