I want to use Watir to start a chrome for an older version of chrome, say /Application/Google Chrome 30.app
Here's a ref link saying chromedriver expects Chrome install at specific location:
Mac /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome
Here's a ref link for setting up Chrome executable in a non-standard location
ChromeOptions options = new ChromeOptions();
options.setBinary("/path/to/other/chrome/binary");
How can I do that using Watir, given syntax like
driver = Watir::Browser.new :chrome
Thanks!
Set Binary For Specific Browser Instance
The Chrome options can be passed from Watir to Selenium using the :desired_capabilities
as "chromeOptions":
caps = {"chromeOptions" => {"binary" => 'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe'}}
browser = Watir::Browser.new(:chrome, desired_capabilities: caps)
Note about the binary
value (from the Chromedriver page):
Path to the Chrome executable to use (on Mac OS X, this should be the actual binary, not just the app. e.g., '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome')
Set Default Binary
Instead of setting the binary for each browser, you can also set the default binary location:
Selenium::WebDriver::Chrome.path = 'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe'
browser = Watir::Browser.new :chrome