Provides selenium webdriver support for play applications.
Under sample/sample-app you can find a simple selenium test example using the module.
So far only 2 configuration items must be added:
List of browsers you want the tests to be executed at
test.selenium.browsers=firefox,iexplorer,chrome,safari :
Url of the selenium grid server
test.selenium.hub.url=http://localhost:4444/wd/hub
Create your test as you would normally do using testng and extend the class play.modules.selenium.custom.BaseTest
Example:
public class GoogleTest extends BaseTest {
public GoogleTest(DesiredCapabilities cap, String hub) throws Exception {
super(cap, hub);
}
@Test
public void checkWebpage () {
driver.get("http://www.google.com");
driver.findElement(By.name("q")).sendKeys("Swets");
driver.findElement(By.name("q")).submit();
driver.close();
}
}
First start the server. You should run something like this:
java -jar selenium-server-standalone-2.20.0.jar -role hub
The start all the different nodes you want:
java -jar selenium-server-standalone-2.20.0.jar -role node -hub http://<selenium grid server>:4444/grid/register
If you plan to use internet explorer browser on you test you need to be a little bit more specific when starting the node:
java -jar selenium-server-standalone-2.20.0.jar -role node -hub http://<selenium grid server>:4444/grid/register -browser "browserName=internet explorer,version=8,platform=WINDOWS"
This is to workaround a bug on how selenium identifies the node’s platform. Issue 1699
And finally you can run your tests:
ant runTestNG