7
votes

I would kindly like to ask for help an issue I have running selenium on on a windows server without an interface, I get the following error:

Cannot start the driver service on http://localhost:49906/ 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)

4
ran it in headless mode and I still get the error - THATO MOLEFE
As stated, please show us your code. - HaR

4 Answers

1
votes

Changed my Target Framework to .NET Core 2.1 (previously set to .net core 3.0) now its working.

0
votes

Browser opened with Selenium requires to run in Session 0 (GUI interface in Windows). Most possible that error that you provided is references to this problems.

You can try to solve Session 0 problem with running browser in headless mode, as it doesn't require to render in UI.

How to do it you can check it with this link Headless Chrome

0
votes

As I wrote here:

When the service start the only things executed are a process with the driver service and an api call to that service.
The problems that can rise could be:

  • you can't execute the process, because the executable is not reachable
    • executable not there
    • wrong permissions
  • some configurations are preventing you from executing successfully the api call and reach http://localhost:60623/
    • proxy settings (adding NO_PROXY environment variable excluding localhost might help)
    • firewall settings
    • port already used
0
votes

Having a VPN client running? In order to fully isolate (for amateurs), the loopback both as Ip and/or hostname are not directly accessible (unless the client is giving a possibility to exclude localhost or 127.0.0.1(and its Ipv6 equivalent) - was freaking me out once like crazy when i couldnt get the driver to work just because I still had my Cyberghost client running, but back to the most likely reason:

Especially when working a lot with ports, and possibily a ton of drivers, manually managing ports or at least manually checking/setting the port for the driver service can help.

I do this like this: I get all currently active TcpConnections(local endpoints). I create a random port from a given range for the driver service until the assigned port is not currently being used.

var ipGlobalProperties = IPGlobalProperties.GetIPGlobalProperties();
var tcpConnInfoArray = ipGlobalProperties.GetActiveTcpConnections();
do
{
   driverService.Port = Random.Next(29999,65535);
} while (tcpConnInfoArray.Any(d => d.LocalEndPoint.Port == driverService.Port));