This package is a library designed to simplify your work with Selenium WebDriver.
You've got to use this set of methods, related to most common actions performed with web elements.
Most of performed methods are logged using LOG4J, so you can easily see a history of performed actions in your log.
We use interfaces where is possible, so you can implement your own version of target interface with no need to rewrite other classes.
Starting from v4.4.0 onwards, this package requires Java 11 or higher, as Selenium has stopped support of Java 8. The last version available for Java 8 is v4.3.3
To start the project using aquality.selenium framework, you can download our template BDD project by this link.
Alternatively, you can follow the steps below:
- Add the dependency to your pom.xml:
<dependency>
<groupId>com.github.aquality-automation</groupId>
<artifactId>aquality-selenium</artifactId>
<version>4.x.x</version>
</dependency>
- Create instance of Browser in your test method:
Browser browser = AqualityServices.getBrowser();
- Use Browser's methods directly for general actions, such as navigation, window resize, scrolling and alerts handling:
browser.maximize();
browser.goTo("https://wikipedia.org");
browser.waitForPageToLoad();
- Use ElementFactory class's methods to get an instance of each element.
ITextBox txbSearch = AqualityServices.getElementFactory().getTextBox(By.id("searchInput"), "Search");
- Call element's methods to perform action with element:
txbSearch.type("Selenium WebDriver");
txbSearch.submit();
browser.waitForPageToLoad();
- Use BiDi functionality to handle basic authentication:
browser.network().addBasicAuthentication("domain.com", "username", "password");
or intercept network requests/responses:
browser.network().startNetworkInterceptor((HttpHandler) request -> new HttpResponse()
.setStatus(HttpStatus.SC_OK)
.addHeader("Content-Type", MediaType.HTML_UTF_8.toString())
.setContent(utf8String("Some phrase")));
- Emulate GeoLocation, Device, Touch, Media, UserAgent overrides, Disable script execution, log HTTP exchange, track Performance metrics, add initialization scripts, and more using browser.devTools() interfaces:
final double latitude = 53.90772672521578;
final double longitude = 27.458060411865375;
final double accuracy = 0.97;
browser.devTools().emulation().setGeolocationOverride(latitude, longitude, accuracy);
See more DevTools use cases here
- Quit browser at the end
browser.quit();
See quick start example here
To get more details please look at documentation:
Library's source code is made available under the Apache 2.0 license.