0

I am using latest Selenium.WebDriver NuGet package v3.141.0

latest Selenium.WebDriver.ChromeDriver package v80.0.3987.1600

my chrome version is 80.0.3987.87

the chromedriver.exe is in the same folder as my program executable

var driver = new ChromeDriver();
driver.Navigate().GoToUrl("https://www.google.com/");
Starting ChromeDriver 80.0.3987.16 (320f6526c1632ad4f205ebce69b99a062ed78647-refs/branch-heads/3987@{#185}) on port #
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
The remote server returned an error: (404) Not Found.
The remote server returned an error: (404) Not Found.
The remote server returned an error: (404) Not Found.
The remote server returned an error: (404) Not Found.
The remote server returned an error: (404) Not Found.
The remote server returned an error: (404) Not Found.
The remote server returned an error: (404) Not Found.
The remote server returned an error: (404) Not Found.
The remote server returned an error: (404) Not Found.
The remote server returned an error: (404) Not Found.
The remote server returned an error: (404) Not Found.
The remote server returned an error: (404) Not Found.
The remote server returned an error: (404) Not Found.
The remote server returned an error: (404) Not Found.

followed by the whole stacktrace -

OpenQA.Selenium.WebDriverException
  HResult=0x80131500
  Message=Cannot start the driver service on http://localhost:port/
  Source=WebDriver
  StackTrace:
   at OpenQA.Selenium.DriverService.Start()
   at OpenQA.Selenium.Remote.DriverServiceCommandExecutor.Execute(Command commandToExecute)
   at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities)
   at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
   at OpenQA.Selenium.Chrome.ChromeDriver..ctor(ChromeDriverService service, ChromeOptions options, TimeSpan commandTimeout)
   at OpenQA.Selenium.Chrome.ChromeDriver..ctor(ChromeOptions options)
   at OpenQA.Selenium.Chrome.ChromeDriver..ctor()
   at snow_net.Program.create_chg_mypruit() in C:\Users\username\source\repos\snow-net\Program.cs:line 119
   at snow_net.Program.Main(String[] args) in C:\Users\username\source\repos\snow-net\Program.cs:line 66

edit: i have also tried

IWebDriver driver;
            using (driver = new ChromeDriver())
            {
                driver.Navigate().GoToUrl(@"https://www.google.com/");
            }

which fails with the same error and tried the IE and Firefox drivers as well

Update:

So i tried this at home (not on my companies network) and it worked with this exact code... am i being blocked by firewall ?

scocuzza
  • 21
  • 2
  • 6
  • See if the following SO post helps https://stackoverflow.com/questions/56435676/openqa-selenium-webdriverexception-cannot-start-the-driver-service-on-http-l – SomeStudent Feb 11 '20 at 19:40
  • I looked through this post and my driver matches my browser chrome Version **80.0.3987**.87 (Official Build) (64-bit) ChromeWebDriver **80.0.3987**.1600 – scocuzza Feb 11 '20 at 20:19

1 Answers1

0

You have to take care of a few things:

  • You need to pass the entire url, i.e. add www to https://google.com, so effectively the url will be https://www.google.com/.
  • Additionally, as you have initialized the instance of ChromeDriver as driver, you have to invoke Navigate() with the driver instance only, but not with drive.
  • Effectively your code block will be:

    var driver = new ChromeDriver();
    driver.Navigate().GoToUrl("https://www.google.com/"); 
    
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352