Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sample/tutorial of using selenium 2.0 web driver in .net?

is there any tutorial/sample for using selenium 2.0 web driver with .net ?

I've tried searching but could find only java, nothing about .net and selenium 2.0 web driver

like image 640
Omu Avatar asked Jan 20 '23 14:01

Omu


1 Answers

The docs here has an example in C#: http://seleniumhq.org/docs/03_webdriver.html

using OpenQA.Selenium.Firefox;
using OpenQA.Selenium;

class GoogleSuggest
{

    static void Main(string[] args)
    {
        IWebDriver driver = new FirefoxDriver();

        //Notice navigation is slightly different than the Java version
        //This is because 'get' is a keyword in C#
        driver.Navigate().GoToUrl("http://www.google.com/");
        IWebElement query = driver.FindElement(By.Name("q"));
        query.SendKeys("Cheese");
        System.Console.WriteLine("Page title is: " + driver.Title);
        driver.Quit();
    }

}
like image 129
Mike Kwan Avatar answered Feb 11 '23 09:02

Mike Kwan