Reputation: 337
i've got an error by changing the profile for the watir-webdriver. I use the following code to disable loading images in firefox:
profile = Selenium::WebDriver::Firefox::Profile.from_name "default"
profile['permissions.default.image'] = 2
browser = Watir::Browser.new :firefox, :profile => profile
This error message occur:
/var/lib/gems/2.3.0/gems/selenium-webdriver-3.0.0/lib/selenium/webdriver/remote/w3c_bridge.rb:80:in `initialize': unknown option: {:profile=>#<Selenium::WebDriver::Firefox::Profile:0x00000000e90700 @model="/home/amvisor/.mozilla/firefox/9ud9suhs.default", @native_events=false, @secure_ssl=false, @untrusted_issuer=true, @load_no_focus_lib=false, @additional_prefs={"permissions.default.image"=>2}, @extensions={}>} (ArgumentError)
from /var/lib/gems/2.3.0/gems/selenium-webdriver-3.0.0/lib/selenium/webdriver/firefox/w3c_bridge.rb:34:in `initialize'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-3.0.0/lib/selenium/webdriver/common/driver.rb:49:in `new'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-3.0.0/lib/selenium/webdriver/common/driver.rb:49:in `for'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-3.0.0/lib/selenium/webdriver.rb:82:in `for'
from /var/lib/gems/2.3.0/gems/watir-webdriver-0.9.3/lib/watir-webdriver/browser.rb:46:in `initialize'
from xxx.rb:38:in `new'
from xxx.rb:38:in `<main>'
What means:
initialize: unknown option: {:Profile
Can anybody help? Thanks!
Upvotes: 1
Views: 434
Reputation: 4194
This works to use an existing Firefox profile with Firefox 48+:
profile = Selenium::WebDriver::Zipper.zip('/path/to/profile/xxx.default')
caps = Remote::Capabilities.firefox(firefox_options: {profile: profile})
browser = Watir::Browser.new :firefox, desired_capabilities: caps
Ruby bindings do not yet fully support all of the features of Firefox profiles from the old Firefox Driver in the new geckodriver. If you need these additional features you can use Firefox <48 (I recommend installing Extended Support Release) and pass in marionette: false
in capabilities.
Upvotes: 3