Giter Site home page Giter Site logo

wanglin2019 / aquality-selenium-dotnet Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aquality-automation/aquality-selenium-dotnet

0.0 1.0 0.0 529 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

JavaScript 1.20% C# 98.80%

aquality-selenium-dotnet's Introduction

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.

aquality-selenium-dotnet's People

Contributors

apavar avatar aqualityautomation avatar dmitrybogatko avatar knysh avatar mialeska avatar mikhailkalyn avatar paveliam avatar runetsk-zz avatar

Watchers

 avatar

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.