How do I use Selenium in C#?

0
0

Selenium.

I downloaded the C# client drivers and the IDE. I managed to record some tests and successfully ran them from the IDE. But now I want to do that using C#. I added all relevant DLLs (Firefox) to the project, but I don’t have the Selenium class. Some hello world would be nice.

  • You must to post comments
0
0

From the Selenium Documentation:

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();
}
}
  • You must to post comments
Showing 1 result
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
Name*
E-mail*
Website