lib/selenium/webdriver/ie/bridge.rb in selenium-webdriver-3.0.0.beta3.1 vs lib/selenium/webdriver/ie/bridge.rb in selenium-webdriver-3.0.0.beta4.0
- old
+ new
@@ -24,34 +24,22 @@
# @api private
#
class Bridge < Remote::Bridge
def initialize(opts = {})
- caps = opts.delete(:desired_capabilities) { Remote::Capabilities.internet_explorer }
- port = opts.delete(:port) { Service::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
-
- @service = Service.new(IE.driver_path, port, *extract_service_args(opts))
-
- unless opts.empty?
- raise ArgumentError, "unknown option#{'s' if opts.size != 1}: #{opts.inspect}"
- end
-
+ port = opts.delete(:port) || Service::DEFAULT_PORT
+ service_args = opts.delete(:service_args) || {}
+ service_args = match_legacy(opts, service_args)
+ @service = Service.new(IE.driver_path, port, *extract_service_args(service_args))
@service.start
+ opts[:url] = @service.uri
- caps['ignoreProtectedModeSettings'] = true if ignore_mode
- caps['nativeEvents'] = native_events
+ caps = opts[:desired_capabilities] ||= Remote::Capabilities.internet_explorer
+ caps[:ignore_protected_mode_settings] = true if opts.delete(:introduce_flakiness_by_ignoring_security_domains)
+ caps[:native_events] = opts.delete(:native_events) != false
- remote_opts = {
- url: @service.uri,
- desired_capabilities: caps
- }
- remote_opts[:http_client] = http_client if http_client
-
- super(remote_opts)
+ super(opts)
end
def browser
:internet_explorer
end
@@ -66,15 +54,22 @@
@service.stop if @service
end
private
- def extract_service_args(opts)
- args = []
- args << "--log-level=#{opts.delete(:log_level).to_s.upcase}" if opts[:log_level]
- args << "--log-file=#{opts.delete(:log_file)}" if opts[:log_file]
- args << "--implementation=#{opts.delete(:implementation).to_s.upcase}" if opts[:implementation]
+ def match_legacy(opts, args)
+ args[:log_level] = opts.delete(:log_level) if opts.key?(:log_level)
+ args[:log_file] = opts.delete(:log_file) if opts.key?(:log_file)
+ args[:implementation] = opts.delete(:implementation) if opts.key?(:implementation)
args
+ end
+
+ def extract_service_args(args)
+ service_args = []
+ service_args << "--log-level=#{args.delete(:log_level).to_s.upcase}" if args.key?(:log_level)
+ service_args << "--log-file=#{args.delete(:log_file)}" if args.key?(:log_file)
+ service_args << "--implementation=#{args.delete(:implementation).to_s.upcase}" if args.key?(:implementation)
+ service_args
end
end # Bridge
end # IE
end # WebDriver
end # Selenium