Selenium chrome not working

I still can't figure it out. I had selenium working fine a couple of days ago; now he is throwing me some mistakes. First I use NuGet, then I tried to manually install 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: exception with a null response An HTTP request was sent to a remote WebDriver server for the URL http: // localhost: 60695 / session . The exception status was ReceiveFailure, and the message was: The main connection was closed: An unexpected error occurred while receiving. ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred while receiving. ---> System.IO.IOException: Unable to read data from transport connection: existing connection was forcibly closed by the remote host. ---> System.Net.Socket

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

went to VS and added single dlls to links

+6
source share
2 answers

Install the nuget package in the following order:

 Install-Package Selenium.WebDriver Install-Package Selenium.WebDriver.ChromeDriver 

I hope this works.

+11
source

I just fixed a problem in our system and decided that I would share or install and solve.

We have a wrapper library on top of Selenium. This shell uses Nuget packages, but the projects that we have for each of our software suites link to our library. In this case, the Chrome driver will not be copied to the output directory and will provide this error.

Each project that links to our wrapper library has a link to a chrome recorder from the output of the wrapper library. Thus, we can support different versions of our library.

Our fix is ​​to set copy local to true for chromedriver.exe. The fact is that if you do not have chomedriver.exe, you will create a folder after the assembly, you may get this error.

0
source

Source: https://habr.com/ru/post/1011753/


All Articles