lib/watir/capabilities.rb in watir-6.16.5 vs lib/watir/capabilities.rb in watir-6.17.0
- old
+ new
@@ -23,11 +23,15 @@
private
def process_arguments
url = @options.delete(:url)
- @selenium_opts[:url] = url if url
+ if url
+ @selenium_opts[:url] = url
+ elsif @options.key?(:service)
+ @selenium_opts[:service] = options.delete(:service)
+ end
create_http_client
@selenium_opts[:port] = @options.delete(:port) if @options.key?(:port)
@selenium_opts[:driver_opts] = @options.delete(:driver_opts) if @options.key?(:driver_opts)
@@ -61,11 +65,10 @@
http_client.read_timeout = read_timeout if read_timeout
@selenium_opts[:http_client] = http_client
end
# TODO: - this will get addressed with Capabilities Update
- # rubocop:disable Metrics/AbcSize
# rubocop:disable Metrics/MethodLength
# rubocop:disable Metrics/PerceivedComplexity:
# rubocop:disable Metrics/CyclomaticComplexity::
def process_browser_options
browser_options = @options.delete(:options) || {}
@@ -80,11 +83,11 @@
browser_options ||= {}
browser_options[:args] ||= []
browser_options[:args] += ['--headless', '--disable-gpu']
end
@selenium_opts[:options] = browser_options if browser_options.is_a? Selenium::WebDriver::Chrome::Options
- @selenium_opts[:options] ||= Selenium::WebDriver::Chrome::Options.new(browser_options)
+ @selenium_opts[:options] ||= Selenium::WebDriver::Chrome::Options.new(**browser_options)
when :firefox
profile = @options.delete(:profile)
if browser_options.is_a? Selenium::WebDriver::Firefox::Options
@selenium_opts[:options] = browser_options
if profile
@@ -95,11 +98,11 @@
if @options.delete(:headless)
browser_options ||= {}
browser_options[:args] ||= []
browser_options[:args] += ['--headless']
end
- @selenium_opts[:options] ||= Selenium::WebDriver::Firefox::Options.new(browser_options)
+ @selenium_opts[:options] ||= Selenium::WebDriver::Firefox::Options.new(**browser_options)
@selenium_opts[:options].profile = profile if profile
when :safari
Selenium::WebDriver::Safari.technology_preview! if @options.delete(:technology_preview)
when :remote
if @browser == :chrome && @options.delete(:headless)
@@ -118,16 +121,16 @@
browser_options ||= {}
browser_options[:args] = @options.delete(:args).dup
end
unless browser_options.is_a? Selenium::WebDriver::IE::Options
ie_caps = browser_options.select { |k| Selenium::WebDriver::IE::Options::CAPABILITIES.include?(k) }
- browser_options = Selenium::WebDriver::IE::Options.new(browser_options)
+ browser_options = Selenium::WebDriver::IE::Options.new(**browser_options)
ie_caps.each { |k, v| browser_options.add_option(k, v) }
end
@selenium_opts[:options] = browser_options
end
end
- # rubocop:enable Metrics/AbcSize
+
# rubocop:enable Metrics/MethodLength
# rubocop:enable Metrics/PerceivedComplexity:
# rubocop:enable Metrics/CyclomaticComplexity::
def process_capabilities