I'm trying to get a few demo test to run using chrome, but i got the following error:
An exception of type 'OpenQA.Selenium.WebDriverException' occurred in WebDriver.dll but was not handled in user code
Additional information: The HTTP request to the remote WebDriver server for URL http://localhost:57523/session timed out after 60 seconds.
I already added the chromedriver to the solution, first I hardcoded the path when declaring the driver, but then I found this post: Selenium WebDriver.ChromeDriver Nuget package installed, but not working for MSTest and followed some of the steps (from 2 to 4).
This is the code i'm using:
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Support.UI;
namespace TestDemo1
{
[TestClass]
public class UnitTest1
{
static IWebDriver driver;
[AssemblyInitialize]
public static void SetUp(TestContext context)
{
//driver = new FirefoxDriver();
driver = new ChromeDriver();
}
[TestMethod]
public void TestMethod1()
{
driver.Navigate().GoToUrl("http://www.hazmeelchingadofavor.com");
}
[TestMethod]
public void TestMethod2()
{
driver.Navigate().GoToUrl("http://www.google.com");
driver.FindElement(By.Id("gbqfq")).SendKeys("Selenium");
driver.FindElement(By.Id("gbqfq")).SendKeys(Keys.Enter);
}
[AssemblyCleanup]
public static void TearDown()
{
driver.Quit();
}
}
}
I'm using VS Express 2013 for Web, in case you were wondering, also when I use the firefox driver, everything works perfectly
EDIT 10/23/2014:
- Chrome Version: 38.0.2125.104 m
- Chrome Driver: 2.11
- Selenium .Net: 2.43.1
- Windows: 7 Enterprise 64 bit