Reputation: 81
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)
Upvotes: 8
Views: 14784
Reputation: 413
It seems that Selenium hosts a webserver on the localhost, which is not accessible. I disabled using a proxy for local addresses, and this solved the problem.
Upvotes: 0
Reputation: 53
In my case, it was because there are too many background chrome process running. Run cmd as admin and use taskkill /f /im chromedriver.exe
to kill all chrome driver instances and use taskkill /f /im chrome.ext /t
to kill all chrome instances made it work.
Upvotes: 1
Reputation: 184
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));
Upvotes: 0
Reputation: 3052
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:
NO_PROXY
environment variable excluding localhost
might help)Upvotes: 1
Reputation: 109
Changed my Target Framework to .NET Core 2.1 (previously set to .net core 3.0) now its working.
Upvotes: 1
Reputation: 46
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
Upvotes: 0