Skip to content

Commit

Permalink
Add ability to pass --implementation to the IE server from Ruby.
Browse files Browse the repository at this point in the history
  • Loading branch information
jarib committed Sep 14, 2014
1 parent 9e59826 commit dfb5197
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 12 deletions.
17 changes: 9 additions & 8 deletions rb/lib/selenium/webdriver/ie/bridge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ class Bridge < Remote::Bridge
DEFAULT_TIMEOUT = 30

def initialize(opts = {})
caps = opts.delete(:desired_capabilities) { Remote::Capabilities.internet_explorer }
timeout = opts.delete(:timeout) { DEFAULT_TIMEOUT }
port = opts.delete(:port) { PortProber.above(DEFAULT_PORT) }
http_client = opts.delete(:http_client)
ignore_mode = opts.delete(:introduce_flakiness_by_ignoring_security_domains)
native_events = opts.delete(:native_events) != false

@server = Server.get
caps = opts.delete(:desired_capabilities) { Remote::Capabilities.internet_explorer }
timeout = opts.delete(:timeout) { DEFAULT_TIMEOUT }
port = opts.delete(:port) { PortProber.above(DEFAULT_PORT) }
http_client = opts.delete(:http_client)
ignore_mode = opts.delete(:introduce_flakiness_by_ignoring_security_domains)
native_events = opts.delete(:native_events) != false
implementation = opts.delete(:implementation)

@server = Server.get(:implementation => implementation)

@server.log_level = opts.delete(:log_level) if opts[:log_level]
@server.log_file = opts.delete(:log_file) if opts[:log_file]
Expand Down
12 changes: 8 additions & 4 deletions rb/lib/selenium/webdriver/ie/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ class Server

STOP_TIMEOUT = 5

def self.get
def self.get(opts = {})
binary = IE.driver_path || Platform.find_binary("IEDriverServer")

if binary
new(binary)
new binary, opts
else
raise Error::WebDriverError,
"Unable to find standalone executable. Please download the IEDriverServer from http://selenium-release.storage.googleapis.com/index.html and place the executable on your PATH."
Expand All @@ -24,8 +25,10 @@ def initialize(binary_path, opts = {})
@process = nil

opts = opts.dup
@log_level = opts.delete(:log_level)
@log_file = opts.delete(:log_file)

@log_level = opts.delete(:log_level)
@log_file = opts.delete(:log_file)
@implementation = opts.delete(:implementation)

unless opts.empty?
raise ArgumentError, "invalid option#{'s' if opts.size != 1}: #{opts.inspect}"
Expand Down Expand Up @@ -76,6 +79,7 @@ def server_args

args << "--log-level=#{@log_level.to_s.upcase}" if @log_level
args << "--log-file=#{@log_file}" if @log_file
args << "--implementation=#{@implementation.to_s.upcase}" if @implementation

args
end
Expand Down
9 changes: 9 additions & 0 deletions rb/spec/unit/selenium/webdriver/ie/bridge_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ module IE
)
end

it 'should be able to set implementation' do
Server.should_receive(:get).with(:implementation => :vendor).and_return(server)

Bridge.new(
:implementation => :vendor,
:http_client => http
)
end

it 'takes desired capabilities' do
custom_caps = Remote::Capabilities.new
custom_caps['ignoreProtectedModeSettings'] = true
Expand Down

0 comments on commit dfb5197

Please sign in to comment.