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.
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:
-
Add the nuget dependency Aquality.Selenium to your project.
-
Create instance of Browser in your test method:
var browser = AqualityServices.Browser;
- 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();
- 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");
- Call element's methods to perform action with element:
emailTextBox.Type("[email protected]");
- 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.
- 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")
- Quit browser at the end:
browser.Quit();
To get more details please look at wiki:
Library's source code is made available under the Apache 2.0 license.