Best strategy to organise drivers (and: ChromeOptions.BinaryLocation not working?)

179 views
Skip to first unread message

Michael Baas

unread,
May 8, 2020, 1:31:17 PM5/8/20
to Selenium Users
I would like to test my app against diverse versions of Chrome & Firefox on multiple machines & platforms and avoid duplicating webdriver.dll into every driver-folder. So I came up with the following folder-structure for the drivers:

--Drivers / Chrome80  / Win / 
              +------ / Unix /
              +----- /Mac /
          / Chrome 81 ...
          / Firefox73 / ...
          / WebDriver3
          / WebDriver4

So then my code uses the webdriver.dll from the appropriate dir (and in case of v3 also webdriver.support.dll) and I'm instantiating i.e. ChromeDriver by using the constructor-syntax that gets an instance of ChromeOptions. The only option that I set is BinaryLocation, its value is "C:\blah\Drivers\ChromeDriver81\Win\chromedriver.exe" and that file exists.

However, I do get this:

OpenQA.Selenium.DriverServiceNotFoundException: The chromedriver.exe file does not exist 
in the current directory or in a directory on the PATH environment variable.
The driver can be downloaded at http://chromedriver.storage.googleapis.com/index.html.    
   bei OpenQA.Selenium.DriverService.FindDriverServiceExecutable(String executableName, Uri downloadUrl)    
   bei OpenQA.Selenium.Chrome.ChromeDriverService.CreateDefaultService()   
   bei OpenQA.Selenium.Chrome.ChromeDriver..ctor(ChromeOptions options)


It also happens with WebDriver 3.1 and also with Firefox (geckodriver73) when setting options.BrowserExecutableLocation.  I can't imagine an error in Selenium would have gone undetected for so long. But I also can't see what I might be doing wrong - so any insight will be much appreciated.

Gajanan Mahajan

unread,
May 9, 2020, 12:55:06 AM5/9/20
to seleniu...@googlegroups.com
Can you please check if  https://github.com/bonigarcia/webdrivermanager  helps which dynamically downloads driver for respective OS/Browser? and you do not have to care of maintaining drivers.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/4f8ca641-11b6-456f-ac95-7584635ed0ee%40googlegroups.com.

Jim Evans

unread,
May 10, 2020, 2:03:44 AM5/10/20
to Selenium Users
I think you may be misunderstanding the purpose of the BinaryLocation and BrowserExecutableLocation properties. Those properties are used to describe the location of the *browser*. The location of the *driver* executable is specified in the overload of CreateDefaulfService() that takes a string, indicating the path to the driver. 

Michael Baas

unread,
May 11, 2020, 5:32:56 AM5/11/20
to Selenium Users
THANKS Jim - you are absolutely right! That was the bit I got wrong - it now happily creates that instance :)
Reply all
Reply to author
Forward
0 new messages