![]() |
VOOZH | about |
dotnet add package Automation.Web.NUnit --version 2.5.1
NuGet\Install-Package Automation.Web.NUnit -Version 2.5.1
<PackageReference Include="Automation.Web.NUnit" Version="2.5.1" />
<PackageVersion Include="Automation.Web.NUnit" Version="2.5.1" />Directory.Packages.props
<PackageReference Include="Automation.Web.NUnit" />Project file
paket add Automation.Web.NUnit --version 2.5.1
#r "nuget: Automation.Web.NUnit, 2.5.1"
#:package Automation.Web.NUnit@2.5.1
#addin nuget:?package=Automation.Web.NUnit&version=2.5.1Install as a Cake Addin
#tool nuget:?package=Automation.Web.NUnit&version=2.5.1Install as a Cake Tool
This is the web automation test library that can help use early to create an automation web test on many browsers and many OS without setup the corresponding webdriver such as ChromeDriver, FirefoxDriver or IEDriver. This library is still developing, so please keep looking. Thanks!
BrowserSourceAttribute. It is used to configure your browser source which decides all browsers will be used to execute on the target Test Class.BrowserInjectionFeature to extend your generated class xxx.feature.cs to inject multiple browser into the same feature. If will help you to execute multiple browsers using the same Feature/scenarioBrowserInjectionHook. It is used to inject the IBrowser into the scenario context, and setting auto take screenshot per steps, or auto take the video record per scenario.v2.x.x → v2.2.0
DefaultBrowser into the browsers.jsonRemoteServer instead of ServerUrlv2.2.x → v2.3.x
ForceUsingDefaultBrowser into browsers.json to force using DefaultBrowser in-case don't want to use ExecutableBrowsers, then only execute DefaultBrowser instead.v2.3.x → v2.4.x
IsAutoRecordVideoOnFailure to the BrowserInjectionHookv2.4.x → v2.5.x
Automation.Web.NUnitbrowsers.json file as below in your test project and set it as a Content in the Build action and Copy to Output Directory.
Notice that
ExecutableBrowsers is the browsers that will be executed in parallel when you run your test cases.
Browsers is the configuration of each browser that you wanna support.{
"ExecutableBrowsers": [ "Chrome", "Firefox" ],
"DefaultBrowser": "Chrome",
"ForceUsingDefaultBrowser": false,
"Browsers": [
{
"Id": "Android",
"Browser": "Chrome",
"Platform": "Android",
"PlatformVersion": "11.0",
"DeviceName": "Pixel5",
"AutomationName": "UIAutomator2",
"ServerUrl": "http://127.0.0.1:4723",
"IsHeadless": false,
"LogLevel": "Debug",
"Arguments": [],
"ImplicitTimeoutInSecond": 30,
"DefaultWaitTimeInSecond": 3000
},
{
"Id": "Chrome",
"Browser": "Chrome",
"Version": "Latest",
"IsHeadless": false,
"LogLevel": "Debug",
"Arguments": [],
"ImplicitTimeoutInSecond": 30,
"DefaultWaitTimeInSecond": 30
},
{
"Id": "Firefox",
"Browser": "Firefox",
"Version": "Latest",
"IsHeadless": false,
"LogLevel": "Debug",
"Arguments": [],
"ImplicitTimeoutInSecond": 30,
"DefaultWaitTimeInSecond": 30
},
{
"Id": "InternetExplorer",
"Browser": "InternetExplorer",
"Platform": "X32",
"LogLevel": "Debug",
"Arguments": [],
"ImplicitTimeoutInSecond": 30,
"DefaultWaitTimeInSecond": 30
},
{
"Id": "Edge",
"Browser": "Edge",
"Version": "Latest",
"LogLevel": "Debug",
"Arguments": [],
"ImplicitTimeoutInSecond": 30,
"DefaultWaitTimeInSecond": 30
},
{
"Id": "Safari",
"Browser": "Safari",
"LogLevel": "Debug",
"ImplicitTimeoutInSecond": 30,
"DefaultWaitTimeInSecond": 30
}
]
}
This configuration is based on your browser version & your expection browser behaviours.
public class HomePage : PageBase
{
private readonly string url = @"https://www.google.com/";
public HomePage(IBrowser browser) : base(browser)
{
}
public void GoHere()
{
Browser.Navigation.GoToUrl(url);
Browser.WaitUntilTitleIs("Google");
}
public void GotoLogin()
{
LinkLogin.Click();
}
public void GotoGmail()
{
LinkGmail.Click();
}
public void Search(string text)
{
SearchInput.SendKeys(text);
//SearchInput.SendKeys(Keys.Enter);
SearchBtn.Click();
}
public bool IsDisplaying()
{
return Browser.WaitUntilTitleIs("Google");
}
public IWebElement SearchInput => Browser.FindElementByName("q");
public IWebElement SearchBtn => Browser.FindElementByName("btnK");
public IWebElement LinkGmail => Browser.FindElementByLinkText("Gmail");
public IWebElement LinkLogin => Browser.FindElementById("gb_70");
}
public class LoginPage : PageBase
{
public LoginPage(IBrowser browser) : base(browser)
{
}
public void WaitUntilReady()
{
Browser.WaitUntilElementExists("identifierId", SelectorType.Id);
}
public void Login(string username, string password)
{
UsernameInput.SendKeys(username);
NextBtn.Click();
PasswordInput.SendKeys(password);
PasswordNextBtn.Click();
}
public IWebElement UsernameInput => Browser.FindElementById("identifierId");
public IWebElement PasswordInput => Browser.FindElementByName("password");
public IWebElement NextBtn => Browser.FindElementById("identifierNext");
public IWebElement PasswordNextBtn => Browser.FindElementById("passwordNext");
}
public class GooglePages
{
public readonly HomePage HomePage;
public readonly LoginPage LoginPage;
public GooglePages(IBrowser browser)
{
HomePage = new HomePage(browser);
LoginPage = new LoginPage(browser);
}
}
public class LoginScenario : WebTestBase
{
private GooglePages pages;
public LoginScenario(BrowserType browserType) : base(browserType)
{
}
public override void SetUp()
{
base.SetUp();
pages = new GooglePages(Browser);
}
[Test]
public void LoginSuccess()
{
pages.HomePage.GoHere();
pages.HomePage.GotoLogin();
pages.LoginPage.Login("**************", "****************");
Assert.True(pages.HomePage.IsDisplaying());
}
}
Run your test cases and see the magic^^
Browser configuration details 6.1 Desktop web testing
6.2 Mobile web testing
ServerUrl to the Appium server such as http://127.0.0.1:4723.6.3 Execute multiple browsers with the same Test case
ExecutableBrowsers in above browser.json.DefaultBrowser: default browserIdExecutableBrowsers: a list of browserId which will be executed parallelForceUsingDefaultBrowser: force to use DefaultBrowser setting even ExecutableBrowsers is being configured.Will update later.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.5.2-preview.302 | 168 | 12/25/2024 |
| 2.5.1 | 298 | 4/29/2024 |
| 2.5.0 | 288 | 12/5/2023 |
| 2.5.0-preview.285 | 166 | 11/28/2023 |
| 2.4.0-preview.279 | 181 | 11/16/2023 |
| 2.4.0-preview.278 | 154 | 11/14/2023 |
| 2.3.4-preview.266 | 179 | 11/3/2023 |
| 2.3.3-preview.264 | 164 | 11/2/2023 |
| 2.3.3-preview.262 | 155 | 11/2/2023 |
| 2.3.2 | 341 | 11/2/2023 |
| 2.3.2-preview.257 | 168 | 11/2/2023 |
| 2.3.2-preview.256 | 174 | 11/2/2023 |
| 2.3.2-preview.254 | 163 | 10/31/2023 |
| 2.3.1 | 323 | 7/4/2023 |
| 2.3.0 | 298 | 6/21/2023 |
| 2.3.0-preview.227 | 257 | 6/21/2023 |
| 2.2.1-preview.224 | 193 | 6/20/2023 |
| 2.2.0 | 277 | 6/19/2023 |
| 2.2.0-preview.212 | 211 | 6/7/2023 |
| 2.1.0-preview.191 | 434 | 1/18/2023 |