FluffySpoon.Automation.Web.JQuery
1.112.0
Prefix Reserved
dotnet add package FluffySpoon.Automation.Web.JQuery --version 1.112.0
NuGet\Install-Package FluffySpoon.Automation.Web.JQuery -Version 1.112.0
<PackageReference Include="FluffySpoon.Automation.Web.JQuery" Version="1.112.0" />
paket add FluffySpoon.Automation.Web.JQuery --version 1.112.0
#r "nuget: FluffySpoon.Automation.Web.JQuery, 1.112.0"
// Install FluffySpoon.Automation.Web.JQuery as a Cake Addin #addin nuget:?package=FluffySpoon.Automation.Web.JQuery&version=1.112.0 // Install FluffySpoon.Automation.Web.JQuery as a Cake Tool #tool nuget:?package=FluffySpoon.Automation.Web.JQuery&version=1.112.0
Yet another Selenium/Puppeteer framework
But done right this time. Contributions are welcome.
Example
The following test searches for something in Google and asserts that the results are present in both Chrome, Edge and Firefox on Selenium, and Chromium on Puppeteer. All browsers execute their actions in parallel.
var serviceCollection = new ServiceCollection();
serviceCollection.AddJQueryDomSelector();
//use 3 different browsers via Selenium
serviceCollection.AddSeleniumWebAutomationFrameworkInstance(GetEdgeDriver);
serviceCollection.AddSeleniumWebAutomationFrameworkInstance(GetFirefoxDriver);
serviceCollection.AddSeleniumWebAutomationFrameworkInstance(GetChromeDriver);
//also use Chromium via Puppeteer
serviceCollection.AddPuppeteerWebAutomationFrameworkInstance(GetPuppeteerDriverAsync);
var serviceProvider = serviceCollection.BuildServiceProvider();
using (var automationEngine = serviceProvider.GetRequiredService<IWebAutomationEngine>())
{
await automationEngine.InitializeAsync();
await automationEngine
.Open("https://google.com");
await automationEngine
.Enter("this is a very long test that works").In("input[type=text]:visible")
.Wait(until =>
until.Exists("input[type=submit]:visible"));
var elements = await automationEngine
.Click.On("input[type=submit]:visible:first")
.Wait(until =>
until.Exists("#rso .g:visible"))
.Expect
.Count(10).Of("#rso .g:visible");
Console.WriteLine("Test done!");
}
Selectors
A selector determines how to select elements. Right now, only jQuery selectors are supported.
Css
install-package FluffySpoon.Automation.Css
serviceCollection.AddJQueryDomSelector();
jQuery
install-package FluffySpoon.Automation.JQuery
serviceCollection.AddCssDomSelector();
Automation frameworks
An automation framework decides how the automation is done. Can use either Selenium or Puppeteer currently.
Selenium
install-package FluffySpoon.Automation.Selenium
Puppeteer
install-package FluffySpoon.Automation.Puppeteer
Features
Opening a URL
await automationEngine.Open("https://example.com");
Taking a screenshot
await automationEngine
.TakeScreenshot
.Of("selector")
.SaveAs((engine, i) =>
engine.UserAgentName + "_" + i + ".jpg");
Mouse operations
Single clicking
var elementsClicked = await automationEngine.Click.On("selector");
Double clicking
var elementsClicked = await automationEngine.DoubleClick.On("selector");
Right clicking
var elementsClicked = await automationEngine.RightClick.On("selector");
Hovering an element
var elementsHovered = await automationEngine.Hover.On("selector");
Dragging & dropping
var elementsDragged = await automationEngine.Drag.From("selector").To("selector");
Typing in elements
var elementsTypedIn = await automationEngine.Enter("some text").In("selector");
Finding elements
var elements = await automationEngine.Find("selector");
Focusing an element
Currently only supports a single element.
var elementsFocused = await automationEngine.Focus.On("selector");
Selecting from a select
combo-box
Multiple selections
Selecting by texts
await automationEngine.Select.ByTexts("Bar", "Baz", ...).From("selector");
Selecting by indices
await automationEngine.Select.ByIndices(0, 2, ...).From("selector");
Selecting by values
await automationEngine.Select.ByValues("value1", "value2", ...).From("selector");
await automationEngine.Select.ByValues(1337, 1338, ...).From("selector");
Single selection
Selecting by text
await automationEngine.Select.ByText("Bar").From("selector");
Selecting by index
await automationEngine.Select.ByIndex(0).From("selector");
Selecting by value
await automationEngine.Select.ByValue("value").From("selector");
await automationEngine.Select.ByValue(1337).From("selector");
Waiting
await automationEngine.Wait(until => until.???);
All methods that are available on the until
object are the same as are available on the Expect
object (see "Expectations" below).
Expectations
Any expecation made that is not met, will throw an ExpectationNotMetException
. If you want to wait until a specific expectation is met, see "Waiting" above instead.
Specific class on an element
await automationEngine.Expect.Class.Of("selector");
Amount of elements that exist
await automationEngine.Expect.Count(10).Of("selector");
At least one element exists
await automationEngine.Expect.Exists.Of("selector");
Text in element
await automationEngine.Expect.Text("my text").In("selector");
Value of element
await automationEngine.Expect.Value("value").Of("selector");
More?
Open an issue if there's something missing. I want to make this library the best there is! Pull requests are also very welcome.
Performance issues
There is a known bug in .NET Core that will slow down Selenium, which has a workaround described.
If you see performance issues outside .NET Core or what you are seeing is unrelated, please open an issue.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- FluffySpoon.Automation.Web (>= 1.112.0)
- FluffySpoon.Http (>= 1.0.21)
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 |
---|---|---|
1.112.0 | 889 | 3/12/2022 |
1.104.0 | 937 | 4/19/2021 |
1.103.0 | 756 | 4/2/2021 |
1.102.0 | 576 | 3/23/2021 |
1.98.0 | 516 | 3/17/2021 |
1.96.0 | 410 | 3/16/2021 |
1.94.0 | 702 | 3/2/2021 |
1.92.0 | 541 | 2/24/2021 |
1.89.0 | 7,829 | 4/15/2020 |
1.88.0 | 9,946 | 3/21/2019 |
1.87.0 | 625 | 3/20/2019 |
1.84.0 | 639 | 3/20/2019 |
1.82.0 | 607 | 3/20/2019 |
1.81.0 | 625 | 3/20/2019 |
1.78.0 | 591 | 3/20/2019 |
1.72.0 | 600 | 3/20/2019 |
1.71.0 | 701 | 3/17/2019 |
1.70.0 | 608 | 3/17/2019 |
1.69.0 | 893 | 3/6/2019 |
1.68.0 | 696 | 3/3/2019 |
1.63.0 | 610 | 3/3/2019 |
1.61.0 | 716 | 2/22/2019 |
1.60.0 | 622 | 2/22/2019 |
1.58.0 | 635 | 2/22/2019 |
1.57.0 | 745 | 2/20/2019 |
1.56.0 | 679 | 2/20/2019 |
1.52.0 | 1,003 | 2/6/2019 |
1.51.0 | 714 | 2/6/2019 |
1.50.0 | 665 | 2/5/2019 |
1.49.0 | 677 | 2/5/2019 |
1.48.0 | 769 | 2/2/2019 |
1.47.0 | 709 | 2/2/2019 |
1.46.0 | 1,210 | 1/13/2019 |
1.0.46 | 1,431 | 11/11/2018 |
1.0.45 | 1,846 | 7/12/2018 |
1.0.43 | 4,611 | 2/10/2018 |
1.0.42 | 1,243 | 2/2/2018 |
1.0.41 | 1,030 | 2/1/2018 |
1.0.40 | 1,144 | 1/30/2018 |
1.0.37 | 1,054 | 1/29/2018 |
1.0.34 | 1,014 | 1/28/2018 |
1.0.33 | 923 | 1/28/2018 |
1.0.32 | 996 | 1/28/2018 |
1.0.29 | 1,017 | 1/28/2018 |
1.0.22 | 1,050 | 1/25/2018 |
1.0.21 | 1,079 | 1/22/2018 |
1.0.20 | 1,001 | 1/22/2018 |
1.0.19 | 1,003 | 1/22/2018 |
1.0.17 | 982 | 1/21/2018 |
1.0.13 | 1,021 | 1/18/2018 |
1.0.12 | 1,033 | 1/18/2018 |
1.0.11 | 1,051 | 1/17/2018 |