Reputation:
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
Upvotes: 8
Views: 7658
Reputation: 1
I just fixed the issue on our system and figured I would share or setup and solution.
We have a wrapper library on top of Selenium. That wrapper uses Nuget packages, but the projects we have for each of our software sets reference our library. In this scenario the Chrome driver will not be copied to the output directory and will give this error.
Each project referencing our wrapper library has a link to the chromedriver from the wrapper library output. This way we can maintain different versions of our library.
Our fix is just to set copy local to true for the chromedriver.exe. The point is if you do not have chomedriver.exe in you build folder after build you can get this error.
Upvotes: 0
Reputation: 266
Install nuget package in following order:
Install-Package Selenium.WebDriver
Install-Package Selenium.WebDriver.ChromeDriver
I hope it should work.
Upvotes: 11