3

I'm trying to get Selenium tests running. I'm using C#. I'm having a problem with every driver I tried.

Chrome

var options = new OpenQA.Selenium.Chrome.ChromeOptions();
options.BinaryLocation = @"C:\Users\Vilem\AppData\Local\Google\Chrome\Application\";

using (IWebDriver driver = new OpenQA.Selenium.Chrome.ChromeDriver(options))
{
...

Seems like chromedriver.exe was found but it could find the Chrome binary. I set up the path to chrome.exe explicitly after automatic search failed. I even tried it with "chrome.exe" at the end. I always get the same result:

Could not find Chrome binary at:

C:\Users\Vilem\AppData\Local\Google\Chrome\Application

Firefox

new OpenQA.Selenium.Firefox.FirefoxDriver();

I also tried it with a profile set:

FirefoxProfile profile = new FirefoxProfile(@"E:\...\FirefoxProfile"); 
new OpenQA.Selenium.Firefox.FirefoxDriver();

Error I'm getting:

Unable to bind to locking port 7054 within 45000 ms

IE

var ieOptions = new InternetExplorerOptions();
ieOptions.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
new InternetExplorerDriver(@"C:\Program Files (x86)\IEDriver\", ieOptions);

The folder with the driver is also set in PATH.

The error I'm getting:

No response from server for url http://localhost:6955/session

Is there something I'm missing? I would be happy if any of them got working.

Thanks

Vilém Procházka
  • 1,060
  • 2
  • 17
  • 28
  • What happens if you keep the drivers in the same directory as the test assembly? So that you do not need to tell Selenium where to look, since it's first port of call is to look in the same directory as the assembly, so is there any difference if you keep the driver in the same folder? – Arran Jul 13 '12 at 22:26
  • I tried that as well, no change unfortunately. – Vilém Procházka Jul 16 '12 at 15:23

3 Answers3

1

I got Chrome and IE working by putting the .exe for ChromeDriver and IE_driver in the project /bin/ folder

Ex.

VisualStudio2010/Projects/ProjName/ProjName/bin/chromedriver.exe

Then when setting up my tests I did:

using OpenQA.Selenium.Chrome;
...
private IWebDriver chrome;
...
[SetUp]
public void SetupTest()
    {
        chrome= new ChromeDriver();
        baseURL = "url-goes-here";
        verificationErrors = new StringBuilder();
    }
...

You can download the .exe from here if you haven't already

TheLifeOfSteve
  • 3,208
  • 6
  • 37
  • 53
0

Chrome

Could not find Chrome binary at:
C:\Users\Vilem\AppData\Local\Google\Chrome\Application

I think you have to specify the whole path including the executable. Like C:\Users\Vilem\AppData\Local\Google\Chrome\Application\chrome.exe (just guessing, have currently no access to a Windows machine)

Firefox

Unable to bind to locking port 7054 within 45000 ms

You should not get that permanently. Quickest solution to tell you without asking a lot of questions back: Restart (or logout-login). If you still get that after reboot, have a look at questions about it and maybe post your own.

zpea
  • 1,072
  • 6
  • 23
0

You should specify the path including .exe. So, your code would be as follows:

options.BinaryLocation = @"C:\Users\Vilem\AppData\Local\Google\Chrome\Application\chrome.exe";
new InternetExplorerDriver(@"C:\Program Files (x86)\IEDriver\iexplore.exe", ieOptions);
Ripon Al Wasim
  • 36,924
  • 42
  • 155
  • 176