watir 6.16.5 → 6.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +5 -5
  2. data/.rubocop.yml +32 -107
  3. data/.travis.yml +24 -21
  4. data/CHANGES.md +16 -0
  5. data/Gemfile +3 -1
  6. data/Rakefile +3 -3
  7. data/appveyor.yml +2 -1
  8. data/lib/watir-webdriver.rb +1 -1
  9. data/lib/watir.rb +0 -1
  10. data/lib/watir/adjacent.rb +8 -10
  11. data/lib/watir/after_hooks.rb +4 -4
  12. data/lib/watir/browser.rb +5 -1
  13. data/lib/watir/capabilities.rb +9 -6
  14. data/lib/watir/cookies.rb +1 -1
  15. data/lib/watir/elements/element.rb +59 -46
  16. data/lib/watir/elements/file_field.rb +1 -0
  17. data/lib/watir/elements/iframe.rb +2 -2
  18. data/lib/watir/elements/link.rb +0 -9
  19. data/lib/watir/elements/radio.rb +1 -1
  20. data/lib/watir/elements/select.rb +2 -2
  21. data/lib/watir/generator/base/spec_extractor.rb +4 -4
  22. data/lib/watir/js_execution.rb +1 -1
  23. data/lib/watir/legacy_wait.rb +1 -1
  24. data/lib/watir/locators/element/selector_builder.rb +11 -12
  25. data/lib/watir/locators/element/selector_builder/xpath.rb +40 -13
  26. data/lib/watir/locators/text_field/selector_builder/xpath.rb +3 -1
  27. data/lib/watir/logger.rb +5 -2
  28. data/lib/watir/version.rb +1 -1
  29. data/lib/watir/window.rb +1 -1
  30. data/lib/watirspec.rb +1 -1
  31. data/lib/watirspec/guards.rb +1 -1
  32. data/lib/watirspec/rake_tasks.rb +2 -0
  33. data/lib/watirspec/runner.rb +4 -0
  34. data/spec/unit/container_spec.rb +1 -1
  35. data/spec/unit/logger_spec.rb +5 -7
  36. data/spec/unit/selector_builder/button_spec.rb +16 -15
  37. data/spec/unit/selector_builder/element_spec.rb +58 -9
  38. data/spec/unit/selector_builder/text_field_spec.rb +14 -14
  39. data/spec/watirspec/after_hooks_spec.rb +64 -78
  40. data/spec/watirspec/alert_spec.rb +69 -79
  41. data/spec/watirspec/browser_spec.rb +48 -46
  42. data/spec/watirspec/cookies_spec.rb +52 -37
  43. data/spec/watirspec/drag_and_drop_spec.rb +14 -38
  44. data/spec/watirspec/elements/button_spec.rb +2 -0
  45. data/spec/watirspec/elements/buttons_spec.rb +1 -1
  46. data/spec/watirspec/elements/checkbox_spec.rb +8 -4
  47. data/spec/watirspec/elements/date_field_spec.rb +18 -9
  48. data/spec/watirspec/elements/date_time_field_spec.rb +3 -4
  49. data/spec/watirspec/elements/div_spec.rb +62 -54
  50. data/spec/watirspec/elements/element_spec.rb +60 -78
  51. data/spec/watirspec/elements/elements_spec.rb +12 -3
  52. data/spec/watirspec/elements/filefield_spec.rb +25 -50
  53. data/spec/watirspec/elements/form_spec.rb +6 -8
  54. data/spec/watirspec/elements/frame_spec.rb +10 -13
  55. data/spec/watirspec/elements/iframe_spec.rb +17 -12
  56. data/spec/watirspec/elements/iframes_spec.rb +2 -2
  57. data/spec/watirspec/elements/link_spec.rb +18 -9
  58. data/spec/watirspec/elements/links_spec.rb +11 -3
  59. data/spec/watirspec/elements/option_spec.rb +15 -17
  60. data/spec/watirspec/elements/select_list_spec.rb +66 -80
  61. data/spec/watirspec/elements/text_field_spec.rb +8 -4
  62. data/spec/watirspec/elements/tr_spec.rb +0 -9
  63. data/spec/watirspec/html/forms_with_input_elements.html +1 -0
  64. data/spec/watirspec/html/iframes.html +3 -0
  65. data/spec/watirspec/html/non_control_elements.html +4 -4
  66. data/spec/watirspec/html/right_click.html +12 -0
  67. data/spec/watirspec/html/wait.html +1 -1
  68. data/spec/watirspec/relaxed_locate_spec.rb +16 -20
  69. data/spec/watirspec/support/rspec_matchers.rb +7 -6
  70. data/spec/watirspec/user_editable_spec.rb +1 -1
  71. data/spec/watirspec/wait_spec.rb +13 -17
  72. data/spec/watirspec/window_switching_spec.rb +162 -163
  73. data/spec/watirspec_helper.rb +7 -5
  74. data/watir.gemspec +4 -5
  75. metadata +14 -16
  76. data/lib/watir/elements/area.rb +0 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: fa8314c42d13abbcf8c23676254674e9f7db6072
4
- data.tar.gz: aab0634d0461fb0f67749b48625ef6b86f337929
2
+ SHA256:
3
+ metadata.gz: c587621e41c1ab878d2e9ff3cfd6c5166c5df9dc66cd02c0719d492aaba48d1e
4
+ data.tar.gz: 509ba43afa0272d7b154eb5885e403578e2bc3956ab93803123b519093e7b430
5
5
  SHA512:
6
- metadata.gz: 42511b036683635c9f960753ed429a332f91a6917af42c71b2d619f8004d1e4147f76e41f89e0eebd39a2043129662ccd7ce673521edac87ad759e52d9ba27c3
7
- data.tar.gz: 3d581c12b5be6ae282824b7ec9ce9785d2a7991b95f520f108017ba2c93bb3bda6881fb535ee38799b31521319e36585e194bd230af5ae1d70f2e09f24cf3dec
6
+ metadata.gz: 5215ff9fc1cfce6fa050532583167e6ed16be6f74b0d305b8d186b83361162c711ae9b63689a00882bf60d559783508ea2369ed9e8d5e25b504688eb2914db01
7
+ data.tar.gz: 1b0ba276ea5c83f217151c125b0f645aab7011d86d9049ea7850ea83af4fbeeb9bdfa14ca60d7205c55bee3c0d6f817143bd9f979c7dc5adc368af446367ab8a
@@ -1,46 +1,36 @@
1
- # Offense count: 144
2
- # Cop supports --auto-correct.
3
- # Configuration parameters: AllowAdjacentOneLineDefs, NumberOfEmptyLines.
4
- Layout/EmptyLineBetweenDefs:
5
- Exclude:
6
- - 'lib/watir/elements/html_elements.rb'
7
- - 'lib/watir/elements/svg_elements.rb'
1
+ inherit_from: .rubocop_todo.yml
8
2
 
9
- # Offense count: 2
10
- # Cop supports --auto-correct.
11
- Layout/EmptyLines:
3
+ AllCops:
4
+ TargetRubyVersion: 2.5.8
5
+ NewCops: enable
12
6
  Exclude:
13
7
  - 'lib/watir/elements/html_elements.rb'
14
8
  - 'lib/watir/elements/svg_elements.rb'
15
9
 
16
- # Offense count: 2
17
- # Cop supports --auto-correct.
18
- # Configuration parameters: EnforcedStyle.
19
- # SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines
20
- Layout/EmptyLinesAroundModuleBody:
21
- Exclude:
22
- - 'lib/watir/elements/html_elements.rb'
23
- - 'lib/watir/elements/svg_elements.rb'
10
+ Layout/LineLength:
11
+ Max: 120
24
12
 
25
- # Offense count: 85
26
- # Cop supports --auto-correct.
27
- # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
28
- # SupportedStyles: space, no_space, compact
29
- # SupportedStylesForEmptyBraces: space, no_space
30
13
  Layout/SpaceInsideHashLiteralBraces:
31
14
  EnforcedStyle: no_space
32
15
 
33
- # Offense count: 1
34
- Lint/HandleExceptions:
35
- Exclude:
36
- - 'lib/watirspec.rb'
37
-
38
16
  Lint/UnifiedInteger:
39
17
  Exclude:
40
18
  - 'lib/watir/locators/element/selector_builder.rb'
41
19
 
42
- # Configuration parameters: CountComments, ExcludedMethods.
43
- # ExcludedMethods: refine
20
+ # Default: 17
21
+ Metrics/AbcSize:
22
+ Max: 20
23
+ Exclude:
24
+ - 'lib/watir/capabilities.rb'
25
+ - 'lib/watir/locators/element/selector_builder.rb'
26
+ - 'lib/watir/locators/element/selector_builder/regexp_disassembler.rb'
27
+ - 'lib/watir/locators/element/selector_builder/xpath.rb'
28
+ - 'lib/watir/locators/element/locator.rb'
29
+ - 'lib/watir/generator/base/generator.rb'
30
+ - 'lib/watir/generator/base/visitor.rb'
31
+ - 'spec/locator_spec_helper.rb'
32
+ - 'spec/watirspec_helper.rb'
33
+
44
34
  Metrics/BlockLength:
45
35
  Exclude:
46
36
  - 'spec/**/*'
@@ -48,21 +38,6 @@ Metrics/BlockLength:
48
38
  - 'watir.gemspec'
49
39
  - 'Rakefile'
50
40
 
51
- ## Configuration parameters: CountComments.
52
- Metrics/ModuleLength:
53
- Exclude:
54
- - 'lib/watir/elements/html_elements.rb'
55
- - 'lib/watir/elements/svg_elements.rb'
56
-
57
- # Configuration parameters: CountComments.
58
- Metrics/MethodLength:
59
- Max: 18
60
- Exclude:
61
- - 'lib/watir/locators/element/selector_builder.rb'
62
- - 'lib/watir/locators/element/selector_builder/xpath.rb'
63
- - 'lib/watir/locators/element/selector_builder/regexp_disassembler.rb'
64
-
65
- # Configuration parameters: CountComments.
66
41
  Metrics/ClassLength:
67
42
  Max: 93
68
43
  Exclude:
@@ -77,42 +52,24 @@ Metrics/ClassLength:
77
52
  - 'lib/watir/generator/base/spec_extractor.rb'
78
53
  - 'lib/watir/element_collection.rb'
79
54
 
80
- Metrics/PerceivedComplexity:
81
- Max: 10
82
-
55
+ # Default: 7
83
56
  Metrics/CyclomaticComplexity:
84
- Max: 8
57
+ Max: 9
85
58
  Exclude:
86
- - 'lib/watir/locators/element/selector_builder.rb'
59
+ - 'lib/watir/locators/element/selector_builder.rb'
87
60
 
88
- Metrics/AbcSize:
89
- Max: 20
61
+ # Configuration parameters: CountComments.
62
+ Metrics/MethodLength:
63
+ Max: 18
90
64
  Exclude:
91
65
  - 'lib/watir/locators/element/selector_builder.rb'
92
- - 'lib/watir/locators/element/selector_builder/regexp_disassembler.rb'
93
66
  - 'lib/watir/locators/element/selector_builder/xpath.rb'
94
- - 'lib/watir/locators/element/locator.rb'
95
- - 'lib/watir/generator/base/generator.rb'
96
- - 'lib/watir/generator/base/visitor.rb'
97
- - 'spec/locator_spec_helper.rb'
98
-
99
- # TODO: fix with Watir 7
100
- # Configuration parameters: CountKeywordArgs.
101
- Metrics/ParameterLists:
102
- Exclude:
103
- - 'lib/watir/wait.rb'
67
+ - 'lib/watir/locators/element/selector_builder/regexp_disassembler.rb'
104
68
 
105
- # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
106
- # URISchemes: http, https
107
- Metrics/LineLength:
108
- Max: 120
69
+ # Default: 8
70
+ Metrics/PerceivedComplexity:
71
+ Max: 10
109
72
 
110
- # Cop supports --auto-correct.
111
- # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, IgnoredMethods.
112
- # SupportedStyles: line_count_based, semantic, braces_for_chaining
113
- # ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
114
- # FunctionalMethods: let, let!, subject, watch
115
- # IgnoredMethods: lambda, proc, it
116
73
  Style/BlockDelimiters:
117
74
  EnforcedStyle: braces_for_chaining
118
75
 
@@ -122,44 +79,12 @@ Style/CommentedKeyword:
122
79
  Style/DoubleNegation:
123
80
  Enabled: false
124
81
 
125
- ## Configuration parameters: AllowedVariables.
126
82
  Style/GlobalVars:
127
83
  AllowedVariables:
128
84
  - $browser
129
85
 
130
- Style/RegexpLiteral:
131
- Exclude:
132
- - 'spec/watirspec/selector_builder/element_spec.rb'
133
-
134
- ### Cop supports --auto-correct.
135
- ### Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
136
- ## SupportedStyles: single_quotes, double_quotes
137
- Style/StringLiterals:
138
- Exclude:
139
- - 'lib/watir/elements/html_elements.rb'
140
- - 'lib/watir/elements/svg_elements.rb'
141
-
142
- Style/MethodCallWithoutArgsParentheses:
86
+ Style/HashEachMethods:
143
87
  Enabled: false
144
88
 
145
- # TODO: I can't tell if this applies
146
- ## Configuration parameters: EnforcedStyle.
147
- ## SupportedStyles: annotated, template, unannotated
148
- Style/FormatStringToken:
149
- Exclude:
150
- - 'lib/watir/browser.rb'
151
- - 'lib/watir/locators/text_field/selector_builder/xpath.rb'
152
- - 'lib/watir/window.rb'
153
-
154
- Style/Documentation:
89
+ Style/OptionalBooleanParameter:
155
90
  Enabled: false
156
-
157
- # Cop supports --auto-correct.
158
- # Configuration parameters: EnforcedStyle.
159
- # SupportedStyles: when_needed, always, never
160
- Style/FrozenStringLiteralComment:
161
- Enabled: false
162
-
163
- Naming/FileName:
164
- Exclude:
165
- - 'lib/watir-webdriver.rb'
@@ -18,15 +18,15 @@ before_script:
18
18
  script: bundle exec rake $RAKE_TASK
19
19
 
20
20
  _version:
21
- three: &three
21
+ five: &five
22
22
  language: ruby
23
- rvm: 2.3.8
24
- four: &four
23
+ rvm: 2.5.8
24
+ six: &six
25
25
  language: ruby
26
- rvm: 2.4.5
27
- five: &five
26
+ rvm: 2.6.6
27
+ seven: &seven
28
28
  language: ruby
29
- rvm: 2.5.3
29
+ rvm: 2.7.1
30
30
 
31
31
  _browsers:
32
32
  firefox: &firefox-latest
@@ -39,46 +39,49 @@ _browsers:
39
39
  matrix:
40
40
  include:
41
41
  - env: RAKE_TASK=spec:remote_firefox
42
- <<: *five
42
+ <<: *seven
43
43
  <<: *firefox-latest
44
44
  - env: RAKE_TASK=spec:remote_chrome
45
- <<: *five
45
+ <<: *seven
46
46
  <<: *chrome
47
47
  - env: RAKE_TASK=spec:firefox RELAXED_LOCATE=false
48
- <<: *five
48
+ <<: *seven
49
49
  <<: *firefox-latest
50
50
  - env: RAKE_TASK=spec:firefox
51
- <<: *five
51
+ <<: *seven
52
52
  <<: *firefox-latest
53
53
  - env: RAKE_TASK=spec:firefox
54
- <<: *four
54
+ <<: *six
55
55
  <<: *firefox-latest
56
56
  - env: RAKE_TASK=spec:firefox
57
- <<: *three
57
+ <<: *five
58
58
  <<: *firefox-latest
59
59
  - env: RAKE_TASK=spec:chrome
60
- <<: *five
60
+ <<: *seven
61
61
  <<: *chrome
62
62
  - env: RAKE_TASK=spec:chrome
63
- <<: *four
63
+ <<: *six
64
64
  <<: *chrome
65
65
  - env: RAKE_TASK=spec:chrome
66
- <<: *three
66
+ <<: *five
67
67
  <<: *chrome
68
68
  - env: RAKE_TASK=spec:chrome RELAXED_LOCATE=false
69
- <<: *five
69
+ <<: *seven
70
+ <<: *chrome
71
+ - env: RAKE_TASK=spec:chrome W3C=true
72
+ <<: *seven
70
73
  <<: *chrome
71
74
  - env: RAKE_TASK=spec:chrome HEADLESS=true
72
- <<: *five
75
+ <<: *seven
73
76
  <<: *chrome
74
77
  - env: RAKE_TASK=spec:unit
75
- <<: *five
78
+ <<: *seven
76
79
  - env: RAKE_TASK=spec:stats
77
- <<: *five
80
+ <<: *seven
78
81
  <<: *chrome
79
82
  - env: RAKE_TASK=yard:doctest
80
- <<: *five
83
+ <<: *seven
81
84
  <<: *chrome
82
85
  - env: RAKE_TASK=rubocop
83
- <<: *three
86
+ <<: *five
84
87
  <<: *chrome
data/CHANGES.md CHANGED
@@ -1,3 +1,19 @@
1
+ ### 6.17.0 (2020-08-27)
2
+ * Require Ruby > 2.5
3
+ * Implement Logger#selenium= to set selenium level from Watir
4
+ * Implement FileField#upload
5
+ * Fix bug with staleness handling in #exist and #present? (#853 & #852)
6
+ * Fix bug when locating elements by text with RegExp (#866 #871)
7
+ * Implement modifiers for `Element#right_click` (thanks Lakshya Kapoor #861)
8
+ * Updated locator code to adhere to spec on what attributes are case sensitive (#507 #856)
9
+ * Fix locating bug when iframe is nested under another element (thanks Matthew Mazaika #885 #886)
10
+ * Deprecate Element#scroll_into_view in favor of the new Scroll methods (#884)
11
+ * Fix threading bugs by allowing each Browser instance its own Timer (#881)
12
+ * Allow adjacent locators to return Input subtype when applicable (#878)
13
+ * Removed unnecessary reference to rubyforge (thanks olleolleolle #874)
14
+ * Removed deprecated Selenium classes (thanks joesho112358 #867)
15
+ * Add support for :service parameter for initializing Browser
16
+
1
17
  ### 6.16.5 (2018-12-25)
2
18
 
3
19
  * Fix bug with nested elements using scopes (#842)
data/Gemfile CHANGED
@@ -1,8 +1,10 @@
1
- source 'http://rubygems.org'
1
+ source 'https://rubygems.org'
2
2
 
3
3
  gem 'webidl', path: File.expand_path('../webidl') if ENV['LOCAL_WEBIDL']
4
4
 
5
5
  gem 'selenium-webdriver', path: File.expand_path('../selenium/build/rb') if ENV['LOCAL_SELENIUM']
6
6
 
7
+ gem 'ffi' if Gem.win_platform? # For selenium-webdriver on Windows
8
+
7
9
  # Specify your gem's dependencies in watir.gemspec
8
10
  gemspec
data/Rakefile CHANGED
@@ -61,7 +61,7 @@ end
61
61
 
62
62
  if extractor.errors.any?
63
63
  puts "\n\n<======================= ERRORS =======================>\n\n"
64
- puts extractor.errors.join("\n" + '=' * 80 + "\n")
64
+ puts extractor.errors.join("\n#{'=' * 80}\n")
65
65
  end
66
66
  end
67
67
 
@@ -93,7 +93,7 @@ YARD::Rake::YardocTask.new do |task|
93
93
  task.options = %w[--debug] # this is pretty slow, so nice with some output
94
94
  end
95
95
 
96
- require 'yard-doctest'
96
+ require 'yard/doctest/rake'
97
97
  YARD::Doctest::RakeTask.new do |task|
98
98
  task.doctest_opts = ['-v']
99
99
  end
@@ -115,7 +115,7 @@ namespace :changes do
115
115
 
116
116
  desc 'Print latest diff'
117
117
  task print: :differ do
118
- VersionDiffer.new.print_latest(STDOUT)
118
+ VersionDiffer.new.print_latest($stdout)
119
119
  end
120
120
  end
121
121
 
@@ -2,7 +2,8 @@ version: "#{build}"
2
2
  build: off
3
3
  clone_depth: 100
4
4
  install:
5
- - set PATH=C:\Ruby23\bin;%PATH%
5
+ - set PATH=C:\Ruby25\bin;%PATH%
6
+ - gem update --system
6
7
  - bundle install
7
8
  test_script:
8
9
  - bundle exec rake %RAKE_TASK%
@@ -1,2 +1,2 @@
1
1
  require 'watir'
2
- warn Kernel.caller.first + ': `require "watir-webdriver"` is deprecated. Please, use `require "watir"`.'
2
+ warn "#{Kernel.caller.first}: `require 'watir-webdriver'` is deprecated. Please, use `require 'watir'`."
@@ -114,7 +114,6 @@ require 'watir/elements/element'
114
114
  require 'watir/elements/html_elements'
115
115
  require 'watir/elements/svg_elements'
116
116
 
117
- require 'watir/elements/area'
118
117
  require 'watir/elements/button'
119
118
  require 'watir/elements/cell'
120
119
  require 'watir/elements/checkbox'
@@ -113,16 +113,14 @@ module Watir
113
113
  def xpath_adjacent(opt = {})
114
114
  plural = opt.delete(:plural)
115
115
  opt[:index] ||= 0 unless plural || opt.values.any? { |e| e.is_a? Regexp }
116
- klass = if !plural && opt[:tag_name]
117
- Watir.element_class_for(opt[:tag_name])
118
- elsif !plural
119
- HTMLElement
120
- elsif opt[:tag_name]
121
- Object.const_get("#{Watir.element_class_for(opt[:tag_name])}Collection")
122
- else
123
- HTMLElementCollection
124
- end
125
- klass.new(self, opt)
116
+ if !plural
117
+ el = Watir.element_class_for(opt[:tag_name] || '').new(self, opt)
118
+ el.is_a?(Input) ? el.to_subtype : el
119
+ elsif opt[:tag_name]
120
+ Object.const_get("#{Watir.element_class_for(opt[:tag_name])}Collection").new(self, opt)
121
+ else
122
+ HTMLElementCollection.new(self, opt)
123
+ end
126
124
  end
127
125
  end # Adjacent
128
126
  end # Watir
@@ -69,8 +69,8 @@ module Watir
69
69
  return unless @after_hooks.any? && !@browser.alert.exists?
70
70
 
71
71
  each { |after_hook| after_hook.call(@browser) }
72
- rescue Selenium::WebDriver::Error::NoSuchWindowError => ex
73
- Watir.logger.info "Could not execute After Hooks because browser window was closed #{ex}"
72
+ rescue Selenium::WebDriver::Error::NoSuchWindowError => e
73
+ Watir.logger.info "Could not execute After Hooks because browser window was closed #{e}"
74
74
  end
75
75
 
76
76
  #
@@ -99,8 +99,8 @@ module Watir
99
99
  # @yieldparam [#call] after_hook Object responding to call
100
100
  #
101
101
 
102
- def each
103
- @after_hooks.each { |after_hook| yield after_hook }
102
+ def each(&blk)
103
+ @after_hooks.each { |after_hook| blk.call(after_hook) }
104
104
  end
105
105
 
106
106
  #
@@ -11,7 +11,7 @@ module Watir
11
11
  include Exception
12
12
  include Scrolling
13
13
 
14
- attr_writer :default_context, :original_window, :locator_namespace
14
+ attr_writer :default_context, :original_window, :locator_namespace, :timer
15
15
  attr_reader :driver, :after_hooks
16
16
  alias wd driver # ensures duck typing with Watir::Element
17
17
 
@@ -300,6 +300,10 @@ module Watir
300
300
  end
301
301
  end
302
302
 
303
+ def timer
304
+ @timer ||= Wait::Timer.new
305
+ end
306
+
303
307
  private
304
308
 
305
309
  def wrap_element(scope, element)
@@ -25,7 +25,11 @@ module Watir
25
25
 
26
26
  def process_arguments
27
27
  url = @options.delete(:url)
28
- @selenium_opts[:url] = url if url
28
+ if url
29
+ @selenium_opts[:url] = url
30
+ elsif @options.key?(:service)
31
+ @selenium_opts[:service] = options.delete(:service)
32
+ end
29
33
 
30
34
  create_http_client
31
35
 
@@ -63,7 +67,6 @@ module Watir
63
67
  end
64
68
 
65
69
  # TODO: - this will get addressed with Capabilities Update
66
- # rubocop:disable Metrics/AbcSize
67
70
  # rubocop:disable Metrics/MethodLength
68
71
  # rubocop:disable Metrics/PerceivedComplexity:
69
72
  # rubocop:disable Metrics/CyclomaticComplexity::
@@ -82,7 +85,7 @@ module Watir
82
85
  browser_options[:args] += ['--headless', '--disable-gpu']
83
86
  end
84
87
  @selenium_opts[:options] = browser_options if browser_options.is_a? Selenium::WebDriver::Chrome::Options
85
- @selenium_opts[:options] ||= Selenium::WebDriver::Chrome::Options.new(browser_options)
88
+ @selenium_opts[:options] ||= Selenium::WebDriver::Chrome::Options.new(**browser_options)
86
89
  when :firefox
87
90
  profile = @options.delete(:profile)
88
91
  if browser_options.is_a? Selenium::WebDriver::Firefox::Options
@@ -97,7 +100,7 @@ module Watir
97
100
  browser_options[:args] ||= []
98
101
  browser_options[:args] += ['--headless']
99
102
  end
100
- @selenium_opts[:options] ||= Selenium::WebDriver::Firefox::Options.new(browser_options)
103
+ @selenium_opts[:options] ||= Selenium::WebDriver::Firefox::Options.new(**browser_options)
101
104
  @selenium_opts[:options].profile = profile if profile
102
105
  when :safari
103
106
  Selenium::WebDriver::Safari.technology_preview! if @options.delete(:technology_preview)
@@ -120,13 +123,13 @@ module Watir
120
123
  end
121
124
  unless browser_options.is_a? Selenium::WebDriver::IE::Options
122
125
  ie_caps = browser_options.select { |k| Selenium::WebDriver::IE::Options::CAPABILITIES.include?(k) }
123
- browser_options = Selenium::WebDriver::IE::Options.new(browser_options)
126
+ browser_options = Selenium::WebDriver::IE::Options.new(**browser_options)
124
127
  ie_caps.each { |k, v| browser_options.add_option(k, v) }
125
128
  end
126
129
  @selenium_opts[:options] = browser_options
127
130
  end
128
131
  end
129
- # rubocop:enable Metrics/AbcSize
132
+
130
133
  # rubocop:enable Metrics/MethodLength
131
134
  # rubocop:enable Metrics/PerceivedComplexity:
132
135
  # rubocop:enable Metrics/CyclomaticComplexity::