Git Product home page Git Product logo

aquality-automation / aquality-selenium-java Goto Github PK

View Code? Open in Web Editor NEW
75.0 14.0 34.0 540 KB

Aquality Selenium is a library built over Selenium WebDriver tool that allows to automate work with web browsers. Selenium WebDriver requires some skill and experience. So, Aquality Selenium suggests simplified and most importantly safer and more stable way to work with Selenium WebDriver.

License: Apache License 2.0

Java 98.84% JavaScript 1.16%
selenium java automation pageobject browserstack selenoid zalenium qatools qa

aquality-selenium-java's Introduction

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.

aquality-selenium-java's People

Contributors

apavar avatar aqualityautomation avatar dmitrybogatko avatar eugenenekh avatar knysh avatar mialeska avatar nikikuzi avatar nikrusaka1qa avatar nikrusaka1qa2 avatar paveliam avatar runetsk-zz avatar sunigos avatar xahtuk44 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aquality-selenium-java's Issues

Try to set -DisRemote=false, you'll get ClassCastException

java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean
at aquality.appium.mobile.configuration.ApplicationProfile.isRemote(ApplicationProfile.java:30)
at aquality.appium.mobile.application.AqualityServices.setDefaultApplicationFactory(AqualityServices.java:65)
at aquality.appium.mobile.application.AqualityServices.getApplicationFactory(AqualityServices.java:78)
at aquality.appium.mobile.application.AqualityServices.startApplication(AqualityServices.java:94)
at aquality.appium.mobile.application.AqualityServices.lambda$getApplication$2(AqualityServices.java:33)
at aquality.selenium.core.applications.AqualityServices.getApp(AqualityServices.java:48)
at aquality.appium.mobile.application.AqualityServices.getApplication(AqualityServices.java:33)

Browser mistakenly opens new window in some conditions

The issue can be reproduced when using combination of several conditions:

  1. Using testng @BeforeMethod annotation for setUp method, in witch Browser opens any website
  2. Using timeout parameter in testng @test annotation
  3. Using method isDisplayed of any element of form from framework

e.g. as in code below:

public class TestTimeout {

@BeforeMethod
public void setUp() {
    BrowserManager.getBrowser().goTo("https://ya.ru/");
}

@Test(timeOut = 1000000)
public void testTimeout() {
    Assert.assertTrue(new ElementFactory().getLabel(By.id("text"), "name").state().isDisplayed());
}

}

Add findChildElements mefod for elements

Now it's impossible to check existing subElement without exception.
It has got workflow like get Xpath of the parent element, add Xpath of the child and search as new element on the page.

Uploading files

Hello. I have an issue with uploading files. There is no Element for implementing it. What is the way I can do this?

Element.class: HighlightState argument is not used in getText, getAttribute, getCssValue methods

Element.class has the following methods that have HighlightState argument:

  • public String getText(HighlightState highlightState);
  • public String getAttribute(String attr, HighlightState highlightState);
  • public String getCssValue(String propertyName, HighlightState highlightState).

All of them call this.getJsActions().highlightElement() inside, i.e. without passing the highlightState.
As a consequence the element is highlighted even if called with HighlightState.NOT_HIGHLIGHT which might be quite important e.g. when there is a need to get an element border color via css.

It seems that passing the value to this.getJsActions().highlightElement(highlightState) should solve the issue.

image

No deselect methods from selenium in framework's IComboBoxes

Reproduces when multiple values can be selected in a drop down.
If you select another value, this value is added to result list, if you select the selected value (set by default), the value remains selected. So it is unable to deselect default value or deselect all values from drop down (deselectByValue/Index() and deselectAll() methods in selenium)

Fix ConditionalWait mathods signature

Fix ConditionalWait mathods signature.
WaitFor should return object or exception,
WaitFor should return true or false,
WaitForTrue should return exception or just continue

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.