Kirean Watkins Kirean Watkins - 1 month ago 130
C# Question

Selenium chromedriver not working

I still cannot figure this out. I've had selenium working fine a couple days ago; now it's throwing me some errors. I use NuGet at first then I tried manually installing it.

how to reproduce the problem:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using System.Threading.Tasks;

namespace Debug
{
class Program
{
static void Main(string[] args)
{
try
{
IWebDriver driver = new ChromeDriver();
driver.Navigate().GoToUrl("http://stackoverflow.com/");
}
catch (Exception ex)
{
Console.Clear();
Console.WriteLine(ex);
Console.ReadKey();
}
}
}
}


Error:


OpenQA.Selenium.WebDriverException: A exception with a null response
was thrown sending an HTTP request to the remote WebDriver server for
URL http://localhost:60695/session. The status of the exception was
ReceiveFailure, and the message was: The underlying connection was
closed: An unexpected error occurred on a receive. --->
System.Net.WebException: The underlying connection was closed: An
unexpected error occurred on a receive. ---> System.IO.IOException:
Unable to read data from the transport connection: An existing
connection was forcibly closed by the remote host. --->
System.Net.Socket


How I installed selenium,
download from
http://selenium-release.storage.googleapis.com/3.0/selenium-dotnet-3.0.0.zip


went onto VS and added the only the dlls to references

Answer

Install nuget package in following order:

Install-Package Selenium.WebDriver


Install-Package Selenium.WebDriver.ChromeDriver

I hope it should work.