Sunday, February 11, 2018

Selenium Browser Automation

Selenium is for automating web applications.
Selenium has the support of some of the multiple browser vendors. 

You can download the Selenium library from http://www.seleniumhq.org/download/.


Sample Code:


using OpenQA.Selenium;
using OpenQA.Selenium.Support.UI;


FirefoxOptions options = new FirefoxOptions();
options.BrowserExecutableLocation = "Fire Fox Directory Path";

 IWebDriver driverOne = new FirefoxDriver(service, options, TimeSpan.FromMinutes(1));

driverOne.Navigate().GoToUrl("URL");

//You can find the Elements by ID, Tag Name, Class Name etc.


 IWebElement TagElement= driverOne.FindElement(By.Id("CtrlID"));

String Value =  TagElement.Text;

No comments:

Post a Comment