aquality selenium dotnet

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.

Build Status
Quality Gate
NuGet

Aquality Selenium for .NET

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 NLog, 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.

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 nuget dependency Aquality.Selenium to your project.

  2. Create instance of Browser in your test method:

var browser = AqualityServices.Browser;
  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:
var emailTextBox = AqualityServices.Get<IElementFactory>().GetTextBox(By.Id("email_create"), "Email");

Or you can inherit a class from Form class and use existing ElementFactory:

private ITextBox EmailTextBox => ElementFactory.GetTextBox(By.Id("email_create"), "Email");
  1. Call element’s methods to perform action with element:
emailTextBox.Type("[email protected]");
  1. Handle basic authentication:
Assert.DoesNotThrowAsync(() => browser.RegisterBasicAuthenticationAndStartMonitoring("domain.com", "username", "password"),
                "Should be possible to set basic authentication async");

or intercept network requests/responses:

browser.Network.AddRequestHandler(
    new NetworkRequestHandler 
    { 
        RequestMatcher = req => true,
        ResponseSupplier = req => new HttpResponseData { Body = "my body content", StatusCode = 200 }
    });
Assert.DoesNotThrowAsync(() => browser.Network.StartMonitoring());

see more examples at NetworkHandlingTests.

  1. Emulate GeoLocation, Device, Touch, Media, UserAgent overrides, Disable script execution and more using DevTools extensions:
const double latitude = 35.8235;
const double longitude = -78.8256;
const double accuracy = 0.97;
Assert.DoesNotThrowAsync(() => DevTools.SetGeoLocationOverride(latitude, longitude, accuracy), "Should be possible to override geoLocation")
  1. Quit browser at the end:
browser.Quit();

Documentation

To get more details please look at wiki:

License

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