//using the namespace
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium;
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
//launch the browser as chrome and add the
//location of browser driver
IWebDriver driver = new ChromeDriver(@"D:\");
//driver takes to the particular page as
driver.Navigate().GoToUrl("http://www.google.com");
//finding the input element as id
IWebElement search_box=driver.FindElement(By.Id("gbqfq"));
//pass the value to element(search_box)
search_box.SendKeys("selenium webdriver tips and tricks");
//finding the input element as name
IWebElement Search_button =driver.FindElement(By.Name("btnG"));
//click the button(search_button)
Search_button.Click();
//getting the title of the browser window
String title = driver.Title;
//display the title
Console.Write(title);
//To close the driver
driver.Quit();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium;
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
//launch the browser as chrome and add the
//location of browser driver
IWebDriver driver = new ChromeDriver(@"D:\");
//driver takes to the particular page as
driver.Navigate().GoToUrl("http://www.google.com");
//finding the input element as id
IWebElement search_box=driver.FindElement(By.Id("gbqfq"));
//pass the value to element(search_box)
search_box.SendKeys("selenium webdriver tips and tricks");
//finding the input element as name
IWebElement Search_button =driver.FindElement(By.Name("btnG"));
//click the button(search_button)
Search_button.Click();
//getting the title of the browser window
String title = driver.Title;
//display the title
Console.Write(title);
//To close the driver
driver.Quit();
}
}
}
No comments:
Post a Comment