How to specify installation of Firefox to use for watir-webdriver script execution
-
27-10-2019 - |
题
For testing purposes I have multiple Firefox installations/versions on one machine made by using Utilu FF collection.
If there`s
b = Watir::Browser.new :ff
in test script, it is automatically executed with oldest FF version which is 3.6.22 in my case. I was surprised, because I assumed that by default script will be executed in Windows default browser which is Firefox6 not Firefox 3.6.22.
How to specify which installation/version of Firefox must be used for Watir-webdriver test script execution?
解决方案
You can specify a path to your firefox executable:
require 'watir-webdriver'
Selenium::WebDriver::Firefox.path = "/path/to/firefox.exe"
b = Watir::Browser.new :firefox
其他提示
For those using chromedriver
use:
Selenium::WebDriver::Chrome.driver_path = "path/to/chromedriver"
For phantomjs:
Selenium::WebDriver::PhantomJS.path="/usr/bin/phantomjs"
不隶属于 StackOverflow