Any one know how to use Selenium 2 with Phpunit? Are there any Selenium 2 samples in PHP?
I recommened the usage of Menta, a Selenium 2 Framework which requires WebDriver. Both packages are PSR-0 compatible, so you can use them with Composer. You can configure selenium with the phpunit.xml. Here an example
tests/integration
The bootstrap file reads the configuration variables from testing.selenium.*, so you can easily set new variables.
getValue('testing.selenium.seleniumServerUrl'),
$configuration->getValue('testing.selenium.browser')
);
Now you can easily implement you testcases. Here an example
open('http://www.google.de');
$element = $session->element(LocatorStrategy::NAME, 'q');
$this->assertTrue($element->displayed());
}
}
The Menta Package also have two demo files, located here