Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium InternetExplorerDriver on AppHarbor: Cannot start the driver service on localhost

I created some selenium tests which work pretty fine on localhost, but when I deploy the application on appharbor, I'm getting an exception thrown.

This code throws the exception on creating a new instance of InternetExplorerDriver:

var options = new InternetExplorerOptions();
options.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
Driver = new InternetExplorerDriver(DriverDirectory, options);

Here is the exception:

OpenQA.Selenium.WebDriverException: Cannot start the driver service on http://localhost:35187/ 
    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.IE.InternetExplorerDriver..ctor(String internetExplorerDriverServerDirectory, InternetExplorerOptions options)
    ...

Could you please advice what could be the reason and is there any way to solve it?

like image 283
Vasilev Avatar asked Apr 22 '17 11:04

Vasilev


2 Answers

Adding to Niels answer, sometimes you have to download the .exe file of IE and specify it's path in the webdriver call. If you have selenium drivers installed previously i.e. during installation then it automatically searches for the drivers. Or you have to download explicitly and mention the path to IE .exe file.

To download .exe file,visit the link http://docs.seleniumhq.org/download/

like image 125
bigbounty Avatar answered Oct 12 '22 07:10

bigbounty


The port 333 specified for the InternetExplorerDriverService falls within the well-known-port-numbers range:

On most systems, a well-known port number can only be used by a system (root) process or by a program run by a privileged user. Allow the driver service to select its own port by not specifying one explicitly, or provide an available port.

Check a couple of things:

  • Drivers are located in the expected location
  • Double clicking IEDriverServer.exe will give you a Listening on port message to see what it automatically picks up as available.
  • Check the Firwall is not blocking traffic to the loopback
like image 32
Niels Avatar answered Oct 12 '22 08:10

Niels