From c471d95cf2cb2921dd2baba741abc7b63df7af47 Mon Sep 17 00:00:00 2001 From: Sidane Date: Mon, 4 May 2009 16:32:00 +0100 Subject: [PATCH] Added support for specifying additional selenium server startup arguments --- lib/webrat/core/configuration.rb | 6 ++++++ lib/webrat/selenium/selenium_rc_server.rb | 1 + spec/private/core/configuration_spec.rb | 4 ++++ 3 files changed, 11 insertions(+), 0 deletions(-) diff --git a/lib/webrat/core/configuration.rb b/lib/webrat/core/configuration.rb index fcf2525..0e383c7 100755 --- a/lib/webrat/core/configuration.rb +++ b/lib/webrat/core/configuration.rb @@ -58,6 +58,11 @@ module Webrat # loop? Defaults to 10 attr_accessor :infinite_redirect_limit + # Extra startup arguments to pass to the Selenium remote control + # e.g. to specify a particular firefox profile to use + # config.selenium_additional_startup_args = ["-firefoxProfileTemplate /path/to/profile"] + attr_accessor :selenium_additional_startup_args + def initialize # :nodoc: self.open_error_files = true self.parse_with_nokogiri = !Webrat.on_java? @@ -68,6 +73,7 @@ module Webrat self.selenium_server_port = 4444 self.infinite_redirect_limit = 10 self.selenium_browser_key = '*firefox' + self.selenium_additional_startup_args = [] end def parse_with_nokogiri? #:nodoc: diff --git a/lib/webrat/selenium/selenium_rc_server.rb b/lib/webrat/selenium/selenium_rc_server.rb index 0d0b651..3c12f37 100644 --- a/lib/webrat/selenium/selenium_rc_server.rb +++ b/lib/webrat/selenium/selenium_rc_server.rb @@ -32,6 +32,7 @@ module Webrat @remote_control = ::Selenium::RemoteControl::RemoteControl.new("0.0.0.0", Webrat.configuration.selenium_server_port, 5) @remote_control.jar_file = jar_path + @remote_control.additional_args = Webrat.configuration.selenium_additional_startup_args return @remote_control end diff --git a/spec/private/core/configuration_spec.rb b/spec/private/core/configuration_spec.rb index 2022947..e57f12b 100755 --- a/spec/private/core/configuration_spec.rb +++ b/spec/private/core/configuration_spec.rb @@ -99,6 +99,10 @@ describe Webrat::Configuration do it 'should default selenium browser key to *firefox' do @config.selenium_browser_key.should == '*firefox' end + + it 'should default additional selenium remote control startup args to empty array' do + @config.selenium_additional_startup_args.should == [] + end end end -- 1.5.4.5