Skip to content

Latest commit

 

History

History
91 lines (72 loc) · 3.94 KB

README.md

File metadata and controls

91 lines (72 loc) · 3.94 KB

Build Status Quality Gate Maven Central

Overview

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.

Breaking news!

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

Quick start

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:

  1. Add the dependency to your pom.xml:
<dependency>
    <groupId>com.github.aquality-automation</groupId>
    <artifactId>aquality-selenium</artifactId>
    <version>4.x.x</version>
</dependency>
  1. Create instance of Browser in your test method:
Browser browser = AqualityServices.getBrowser();
  1. 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();
  1. Use ElementFactory class's methods to get an instance of each element.
ITextBox txbSearch = AqualityServices.getElementFactory().getTextBox(By.id("searchInput"), "Search");
  1. Call element's methods to perform action with element:
txbSearch.type("Selenium WebDriver");
txbSearch.submit();
browser.waitForPageToLoad();
  1. 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")));
  1. 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

  1. Quit browser at the end
browser.quit();

See quick start example here

Documentation

To get more details please look at documentation:

License

Library's source code is made available under the Apache 2.0 license.