From 8ce922962b8f30e6f3405254d0aba10f67ba899e Mon Sep 17 00:00:00 2001 From: Yoshinobu Wakamatsu Date: Sun, 9 Feb 2014 22:03:12 +0900 Subject: [PATCH] fix user-agent-option for firefox --- lib/wbench/browser.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/wbench/browser.rb b/lib/wbench/browser.rb index 9ff27e1..2d27440 100644 --- a/lib/wbench/browser.rb +++ b/lib/wbench/browser.rb @@ -10,7 +10,13 @@ def initialize(url, options = {}) selenium_options = { :browser => browser, :http_client => http_client } if options[:user_agent] - add_selenium_args(selenium_options, "--user-agent='#{options[:user_agent]}'") + add_selenif browser == :firefox + profile = Selenium::WebDriver::Firefox::Profile.new + profile['general.useragent.override'] = options[:user_agent] + selenium_options[:profile] = profile + else + add_selenium_args(selenium_options, "--user-agent='#{options[:user_agent]}'") + end end SeleniumDriver.new(app, selenium_options)