aquality-automation/aquality-selenium-dotnet
소개
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.
개발 도구측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalAquality 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:
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")
It is also possible to set mobile emulation capabilities (for chromium-based browsers) in Resources/settings.json file, as well as to configure other arguments and options there:
{
"browserName": "chrome",
"isRemote": false,
"remoteConnectionUrl": "http://qa-auto-nexus:4444/wd/hub",
"isElementHighlightEnabled": true,
"driverSettings": {
"chrome": {
"capabilities": {
"selenoid:options":
{
"enableVNC": true
},
"mobileEmulation": {
"userAgent": "Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nexus 5 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19",
"deviceMetrics": {
"width": 660,
"height": 1040,
"pixelRatio": 3.0
}
},
"unhandledPromptBehavior": "ignore"
},
"options": {
"download.prompt_for_download": "false",
"download.default_directory": "./downloads"
},
"loggingPreferences": {
"Performance": "All"
},
"excludedArguments": [ "enable-automation" ],
"startArguments": [ "--disable-search-engine-choice-screen" ],
"pageLoadStrategy": "Normal"
},
"safari": {
"options": {
"safari.options.dataDir": "/Users/username/Downloads"
}
}
},
"timeouts": {
"timeoutImplicit": 0,
"timeoutCondition": 30,
"timeoutScript": 10,
"timeoutPageLoad": 60,
"timeoutPollingInterval": 300,
"timeoutCommand": 60
},
"retry": {
"number": 2,
"pollingInterval": 300
},
"logger": {
"language": "en",
"logPageSource": true
},
"elementCache": {
"isEnabled": false
},
"visualization": {
"defaultThreshold": 0.012,
"comparisonWidth": 16,
"comparisonHeight": 16,
"pathToDumps": "../../../Resources/VisualDumps/"
}
}
- 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.
관련 프로젝트 살펴보기
불러오는 중…