Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# Selenium Chrome port issue?

I am trying to use selenium with C# and chrome but it fails to connect.

My code:

string site = "https://google.de";
IWebDriver driver = new ChromeDriver(@"C:\test\");
driver.Navigate().GoToUrl(site);

Both, Chrome and the Chrome driver window are opening after a few seconds after the site has loaded and everything looks fine however, chrome driver is reporting the following:

Starting ChromeDriver 2.41.578737 (49da6702b16031c40d63e5618de03a32ff6c197e) on port 61455 Only local connections are allowed.

DevTools listening on ws://127.0.0.1:61458/devtools/browser/98bab62c-09d8-4714-b51b-4118ed7100c3 [1535800947.687][WARNING]: Timed out connecting to Chrome, retrying...

Is it possible that the application is using two different ports and this could lead to the timeout issue?

like image 889
Dennis Avatar asked Sep 01 '18 11:09

Dennis


1 Answers

To fix this issue in the past I simply had to make sure both, Chrome and the Chrome driver were compatible and up-to-date, the best way to do this is to download the latest available versions which at the time of writing are:

  • ChromeDriver 2.42
  • Chrome 69.0.3497.100

The latest driver can be downloaded using NuGet: https://www.nuget.org/packages/Selenium.Chrome.WebDriver

Install-Package Selenium.Chrome.WebDriver -Version 2.42.0 

Or from the official site if you want to download it manually: https://sites.google.com/a/chromium.org/chromedriver/

like image 136
Isma Avatar answered Sep 21 '22 13:09

Isma