Selenium automation using C # page

Work often need a lot of time to fill in the data or nets to catch data to the site, which will use Selenium Automation is a good choice. Selenium is actually a tool for Web application testing, test whether your application look well have to work on different browsers and operating systems. It can be run directly in the browser, just as real users in the same operation. Supported browsers include IE (7, 8, 9, 10, 11), Mozilla Firefox, Safari, Google Chrome, Opera and so on.

1, the download NuGet Selenium.Chrome.WebDriver (v2.45.0) and Selenium.WebDriver (v3.141.0), then reference using OpenQA.Selenium; and using OpenQA.Selenium.Chrome;

2, and declare an instance of an object ChromeDriver

IWebDriver browser = new ChromeDriver(System.AppDomain.CurrentDomain.BaseDirectory.ToString());

ChromeDriver total of eight constructor, I use here are four methods.

ChromeDriver (), ChromeDriver (ChromeDriverService service) specified initialization ChromeDriver service options ChromeDriver (ChromeOptions options) is specified ChromeDriver, ChromeDriver (string chromeDriverDirectory) of the specified directory path ChromeDriver.exe, ChromeDriver (ChromeDriverService service, ChromeOptions options), ChromeDriver (string chromeDriverDirectory, ChromeOptions options), ChromeDriver (ChromeDriverService service, ChromeOptions options, TimeSpan commandTimeOut) specifies the time awaiting execution command, ChromeDriver (string chromeDriverDirectory, ChromeOptions options, TimeSpan commandTimeOut)

 

 

--- end --- restore content

Guess you like

Origin www.cnblogs.com/JTCLASSROOM/p/10972516.html
Recommended