Set of Selenium Grid extensions for a better UI tests.
See the Wiki for documentation, examples and other information.
- Twitter: @Sterodium
- GitHub Issues
- Gitter Chat
Remove pain of testing complex UI components by hacking DOM. With this extension you are able to combine Selenium tests with Sikuli image recognition and run them on the grid.
Even more! Sikuli allows you to automate anything you see.
Downloading files in Selenium tests? Get them to your machine and check contents. Now it's easy.
You might have some file upload tests. Uploading files to remote environment is not a problem anymore.
Extensions need to be installed on Selenium Grid. It is obligatory to have Extension proxy installed in the hub.
Binaries and dependency information for Maven, Gradle and other build tools can be found at http://search.maven.org.
Look into project https://github.com/bravostudiodev/bravo-grid for docker images.
<dependency>
<groupId>io.sterodium</groupId>
<artifactId>sikuli-extension-client</artifactId>
<version>x.y.z</version>
</dependency>
<dependency>
<groupId>io.sterodium</groupId>
<artifactId>file-extension-client</artifactId>
<version>x.y.z</version>
</dependency>
Selenium hub:
- Get Hub extensions proxy jar file and put it together with selenium-server-standalone-x.y.z.jar
- Modify hubConfig.json (servlets and capability matcher property)
...
"servlet": "io.sterodium.extensions.hub.proxy.HubRequestsProxyingServlet",
...
"capabilityMatcher": "io.sterodium.extensions.capability.CustomCapabilityMatcher"
...
Launch grid with
java -cp "selenium-server-standalone-3.0.1.jar:extension-proxy-x.y.z.jar" org.openqa.grid.selenium.GridLauncherV3 -role hub -hubConfig hubConfig.json
Selenium node:
- Get All node extensions jar file and put it together with with selenium-server-standalone-x.y.z.jar
- Modify nodeConfig.json (capabilities and servlet properties)
...
"capabilities": [
{
"extension.sikuliCapability": true
}
],
"configuration": {
...
"servlets": "io.sterodium.extensions.node.SikuliExtensionServlet,io.sterodium.extensions.node.upload.FileUploadServlet,io.sterodium.extensions.node.download.FileDownloadServlet"
...
}
Launch node with
java -cp "selenium-server-standalone-3.0.1.jar:all-node-extensions-x.y.z.jar" org.openqa.grid.selenium.GridLauncherV3 -role node -nodeConfig nodeConfig.json
Get session id from RemoteWebDriver
String sessionId = remoteWebDriver.getSessionId();
Create Sikuli client and upload images to selenium node:
SikuliExtensionClient client = new SikuliExtensionClient(host, port, sessionId);
client.uploadResourceBundle("my_images_folder");
Locate image on screen and click:
TargetFactory targetFactory = client.getTargetFactory();
ImageTarget imageTarget = targetFactory.createImageTarget("image.png");
DesktopScreenRegion desktop = client.getDesktop();
ScreenRegion screenRegion = desktop.find(imageTarget);
Mouse mouse = client.getMouse();
mouse.click(screenRegion.getCenter());
Refer to Sikuli docs for basic Sikuli API usage.
File upload to selenium node:
FileExtensionClient fileExtensionClient = new FileExtensionClient(host, port, sessionId);
String uploadPath = fileExtensionClient.upload(resourceBundlePath);
File download from selenium node:
FileExtensionClient fileExtensionClient = new FileExtensionClient(host, port, sessionId);
File fileFromNode = fileExtensionClient.download(pathToFile);
File deletion from selenium node: (which can be used as cleanup after upload/download activity performed on node)
FileExtensionClient fileExtensionClient = new FileExtensionClient(host, port, sessionId);
boolean isFiledeleted = fileExtensionClient.delete(pathToFile);
$ git clone git@github.com:sterodium/selenium-grid-extensions.git
$ cd selenium-grid-extensions/
$ mvn install