2

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:

  1. Chrome Version: 38.0.2125.104 m
  2. Chrome Driver: 2.11
  3. Selenium .Net: 2.43.1
  4. Windows: 7 Enterprise 64 bit
Community
  • 1
  • 1
Lukas Quatro
  • 41
  • 4
  • 11
  • Go to the command prompt and check whether you're able to invoke chromedriver.exe. It should display something like this: Starting ChromeDriver (v2.8.241075) on port 9515 – Rishi Khanna Oct 23 '14 at 05:25
  • Hi Rishi, when I invoke the driver in cmd I get the following message: Starting ChromeDriver (v2.11.298604 (75ea2fdb5c87f133a8e1b8da16f6091fb7d5321e)) on port 9515 Only local connections are allowed. but when I run my test I don't get any message – Lukas Quatro Oct 23 '14 at 14:40
  • And what version of Chrome and what version of Windows (and is it 32/64bit?) – Arran Oct 23 '14 at 17:59
  • @Arran I just updated the question and added the information – Lukas Quatro Oct 23 '14 at 21:23

2 Answers2

0

It is a known bug: https://code.google.com/p/chromedriver/issues/detail?id=928 try to update to Chrome Driver: 2.12, this version fix another issue: Resolved issue 916: Selenium (javascript) fails when switching to webview window in Chrome apps [Pri-2] - https://code.google.com/p/chromedriver/issues/detail?id=916

may be it solves your problem. For me downgrading chrome and using old driver solved problem

razon
  • 3,882
  • 2
  • 33
  • 46
0

Found the solution, we put a bit more attention into the error message and found a message about the sockets (can't recall it really good) so we call the IT department and ask for someone to come over, we talked the issue and the possible solution, so the solution:

Long Story Short:

The anti-virus was blocking the chromedriver so it couldn't connect, so the IT guy added a rule to allow full execution on chromedriver and that was it, hours and hours of research and the issue was the anti-virus, if you have a similar problem check with your IT department

Lukas Quatro
  • 41
  • 4
  • 11