Automated Acceptance Testing.
Selenium WebDriver
test framework for web applications.
You don't have to worry anymore about complex XPATH
or CSS selector
because we are taking care for you about that.
Simply set each property on the element and we will generate the necessary selector.
You can combine more properties/attributes on the same selector very easy.
This project is optimized for:
- Dynamic html & Complex UI
-
Sencha ExtJS
-
Bootstrap
- Simple web applications/sites
<button>Save</button>
<button>Cancel</button>
<div class="close" title="Close">x</div>
<span class="minimize" title="Minimize">_</span>
Button saveButton = new Button().setText("Save");
Button cancelButton = new Button().setText("Cancel");
// more properties for selecting/testing specific element with wanted attributes
WebLocator closeIcon = new WebLocator().setClasses("close").setTitle("Close");
WebLocator minimIcon = new WebLocator().setClasses("minimize").setTitle("Minimize");
public class SubscribePage {
private WebLocator header = new WebLocator().setClasses("header");
private TextField emailField = new TextField().setLabel("Email");
private WebLink subscribeLink = new WebLink(header, "Subscribe now");
public void subscribe(String email) {
emailField.setValue(email);
subscribeLink.click();
}
}
public class SubscribeTest extends TestBase {
SubscribePage subscribePage = new SubscribePage();
@Test
public void subscribeTest() {
subscribePage.subscribe("me@testy.com");
}
}
public class SubscribersPage {
private Table table = new Table();
public boolean unsubscribe(String email) {
// find row that contains specified email in second column
Row row = table.getRow(new Cell(2, email));
// find remove button inside specified row
Button removeButton = new Button(row, "Remove");
return removeButton.click();
}
}
public class RemoveSubscriberTest extends TestBase {
SubscribersPage subscribersPage = new SubscribersPage();
@Test
public void unsubscribeTest() {
boolean removed = subscribersPage.unsubscribe("me@testy.com");
//... assert
}
}
- Java
- Maven
<dependency>
<groupId>com.sdl.lt</groupId>
<artifactId>Testy</artifactId>
<version>2.13.1</version>
</dependency>
Here is how these lines appear in a project pom.xml
After you create your driver, pass the reference to Testy, then just it use as you want
driver = new FirefoxDriver();
WebDriverConfig.init(driver);
// then just use WebLocator or any other classes from Testy
public static WebDriver driver;
static {
startSuite();
}
private static void startSuite() {
try {
driver = WebDriverConfig.getWebDriver(Browser.FIREFOX);
} catch (Exception e) {
LOGGER.error("Exception when start suite", e);
}
}
- Set this system property: remoteDriver=true
- Pass the remote hub url as a parameter when initializing the WebDriver. e.g.:
WebDriver driver = WebDriverConfig.getWebDriver(EnvConfig.getBrowserConfigPath(), new URL("http://localhost:4444/wd/hub"));
or
WebDriver driver = WebDriverConfig.getWebDriver(URL remoteUrl, DesiredCapabilities capabilities);
Here is how these lines appear in a project
Here is a sample project with cucumber and Testy on Chrome browser:
Release Notes for Testy 2.13.1
- added setChildNodes(SearchType searchType, final WebLocator... childNodes) method
- improvement select(boolean doScroll, String... nodes) method in Tree
- update webdriver version 3.141.59
- TODO
<repositories>
<repository>
<id>sonatype-nexus-snapshots</id>
<name>sonatype-nexus-snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependency>
<groupId>com.sdl.lt</groupId>
<artifactId>Testy</artifactId>
<version>2.14.0-SNAPSHOT</version>
</dependency>
Testy is MIT licensed.