AutoWeb 2021.4.22.43642

dotnet add package AutoWeb --version 2021.4.22.43642
                    
NuGet\Install-Package AutoWeb -Version 2021.4.22.43642
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AutoWeb" Version="2021.4.22.43642" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AutoWeb" Version="2021.4.22.43642" />
                    
Directory.Packages.props
<PackageReference Include="AutoWeb" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AutoWeb --version 2021.4.22.43642
                    
#r "nuget: AutoWeb, 2021.4.22.43642"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package AutoWeb@2021.4.22.43642
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AutoWeb&version=2021.4.22.43642
                    
Install as a Cake Addin
#tool nuget:?package=AutoWeb&version=2021.4.22.43642
                    
Install as a Cake Tool

<h1 align="center"> AutoWeb </h1> <h6 align="center"> Created by: <a href="https://github.com/lzinga" target="_blank">Lucas Elzinga</a> </h6>

<p align="center">This library wraps the <a href="https://github.com/SeleniumHQ/selenium" target="_blank">Selenium</a> library into an easy to use library for any automated tasks you may require in the browser.</p> <p align="center"> <a href="https://www.nuget.org/packages/AutoWeb/" title="Nuget"><img src="https://img.shields.io/nuget/v/AutoWeb?style=for-the-badge" /></a> </p>

<p align="center"> <a href="https://www.nuget.org/packages/AutoWeb/" title="Package Building"><img src="https://img.shields.io/github/workflow/status/lzinga/autoweb/Build-Packages/main?style=for-the-badge" /></a> <a href="https://github.com/lzinga/AutoWeb/actions/workflows/run-tests.yml" title="Unit Tests"><img src="https://img.shields.io/github/workflow/status/lzinga/autoweb/Run-Tests/main?label=Tests&style=for-the-badge" /></a> <a href="https://github.com/lzinga?tab=packages&repo_name=AutoWeb" title="GitHub Package"><img src="https://img.shields.io/github/workflow/status/lzinga/autoweb/Build-Packages/main?label=Packaging&style=for-the-badge" /></a> </p>

<p align="center"> <a href="https://github.com/lzinga/AutoWeb/blob/main/LICENSE" title="License"><img src="https://img.shields.io/github/license/lzinga/AutoWeb?style=for-the-badge" /></a> <a href="https://github.com/lzinga/AutoWeb/discussions" title="Discussions"><img src="https://img.shields.io/static/v1?label=Community&message=Discussions&style=for-the-badge" /></a> </p>

Why?

There were many times I wanted to create a quick project that would automate a process I do often, or tasks that are cumbersome and annoying. However from my experience Selenium had quite a bit of overhead and can feel clunky/messy if you wanted to spin up something quickly. So here we are.

As an example I have to open tickets in part of my job in a system that is not user friendly, does not give access to API, nor was it built with my group in mind. Alas we are still required to open tickets in said system. So... I will be using this library to automate the process to be much simpler and quicker for my team. I leave you with the hopes that this library can help in some way or another.

  1. Wiki Documentation

Usage

Only basic usage is the readme, view the wiki for more detailed information.

To properly load and open a browser you will need to include a web driver, by default AutoWeb uses Selenium.WebDriver.MSEdgeDriver as the default driver but you can view the [#tested-browsers](Tested Browsers). I have not tested with other browsers but it should be possible with some slight modifications.

AutoWeb uses a PageCollection object to add and manage your pages.

// Creates a default page collection. (uses msedgedriver)
new PageCollection();

// Creates a page collection with configured options.
new PageCollection(options => {

    // Option #1
    // Option to specify a different browser.
    options.Browser<IBrowser>("chromedriver.exe")

    // Option #2
    // Option to specify all options for the browser
    options.Browser<ChromeBrowser>(opts => {
        opts.Driver = "chromedriver.exe";
        opts.Timeout = new TimeSpan(0, 0, 30);
        opts.Arguments = new string[] {
            "--headless"
        };
    });

    // At times the driver will remain running in the background, this will
    // attempt to clear them before starting a new one.
    options.CleanOrphanedDrivers = true,
});

Once created you can add pages later or directly off the new object itself. Either of these methods are fine.

new PageCollection()
    .AddPage<LoginPage>()
    .AddPage<RepositoryPage>();

var pages = new PageCollection();
pages.Add<LoginPage>();

Once you have pages added to your collection you can execute them individually, or all in the order they were added.

// This will execute all pages starting at LoginPage and continuing to RepositoryPage
new PageCollection()
    .AddPage<LoginPage>()
    .AddPage<RepositoryPage>()
    .Execute()

// If executing against the variable itself you can execute a singular page.
pages.Execute<LoginPage>();

Fluent Control

When writing automation for a page things can get messy pretty quickly if the website has you jump around a lot. You can chain commands like in the example below.

browser.FindElement(Where.XPath, "//*[@id='sp_formfield_search']")
    .SendKeys("TicketVM01")
    .Wait(1000)
    .ThenFindElement(Where.XPath, "//*[@id='Add']/div/span/div/div/div[2]/input[2]")
    .Click();

Supported Drivers

The following browser drivers have been tested and currently built into unit tests.

  1. Selenium.WebDriver.MSEdgeDriver
  2. Selenium.WebDriver.ChromeDriver
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2021.4.22.43642 483 4/23/2021
2021.4.11.49737 374 4/12/2021
2021.4.8.42267 381 4/8/2021
2021.4.8.42266 383 4/8/2021
2021.4.6.32130 362 4/6/2021