'Cannot start the driver service on http://localhost
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)
Solution 1:[1]
Changed my Target Framework to .NET Core 2.1 (previously set to .net core 3.0) now its working.
Solution 2:[2]
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.
Solution 3:[3]
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
Solution 4:[4]
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_PROXYenvironment variable excludinglocalhostmight help) - firewall settings
- port already used
- proxy settings (adding
Solution 5:[5]
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));
Solution 6:[6]
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.
Solution 7:[7]
Turning off vpn works for me :)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Suresh Bhandari |
| Solution 2 | Grace |
| Solution 3 | Werewolfas |
| Solution 4 | Giulio Caccin |
| Solution 5 | TronTronic Entertainment |
| Solution 6 | Tamás Kovács |
| Solution 7 | akbar |
