Quickstart: Use Selenium in C#

  • In Visual Studio: Project -> New -> Console Project
  • Download C#-Selenium client here: http://www.seleniumhq.org/download/
  • Create references to all .dlls there
  • Download Mozilla GeckoDriver here: https://github.com/mozilla/geckodriver/releases/tag/v0.11.1
  • Unzip geckodriver.exe into /bin/Debug
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;


namespace SeleniumExampleInCSharp
{
    class Program
    {
        static void Main(string[] args)
        {
            IWebDriver driver = new FirefoxDriver();
            driver.Url = "http://www.google.de";

            driver.FindElement(By.Id("lst-ib")).SendKeys("Projektfisch");
            driver.FindElement(By.ClassName("sfsbc")).Click();
        }
    }
}