watir 6.17.0 → 7.0.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/.github/actions/enable-safari/action.yml +11 -0
  3. data/.github/actions/install-chrome/action.yml +12 -0
  4. data/.github/actions/setup-linux/action.yml +8 -0
  5. data/.github/workflows/tests.yml +104 -0
  6. data/.rubocop.yml +2 -7
  7. data/.rubocop_todo.yml +36 -0
  8. data/CHANGES.md +59 -0
  9. data/LICENSE +2 -2
  10. data/README.md +6 -10
  11. data/Rakefile +2 -2
  12. data/lib/watir.rb +4 -45
  13. data/lib/watir/adjacent.rb +1 -1
  14. data/lib/watir/alert.rb +4 -8
  15. data/lib/watir/attribute_helper.rb +2 -0
  16. data/lib/watir/browser.rb +20 -6
  17. data/lib/watir/capabilities.rb +79 -110
  18. data/lib/watir/cell_container.rb +4 -4
  19. data/lib/watir/container.rb +4 -26
  20. data/lib/watir/cookies.rb +2 -0
  21. data/lib/watir/element_collection.rb +21 -6
  22. data/lib/watir/elements/checkbox.rb +4 -4
  23. data/lib/watir/elements/date_field.rb +4 -4
  24. data/lib/watir/elements/date_time_field.rb +4 -4
  25. data/lib/watir/elements/element.rb +51 -59
  26. data/lib/watir/elements/file_field.rb +4 -4
  27. data/lib/watir/elements/font.rb +5 -4
  28. data/lib/watir/elements/hidden.rb +4 -4
  29. data/lib/watir/elements/html_elements.rb +444 -446
  30. data/lib/watir/elements/iframe.rb +6 -6
  31. data/lib/watir/elements/radio.rb +6 -6
  32. data/lib/watir/elements/select.rb +62 -90
  33. data/lib/watir/elements/svg_elements.rb +96 -96
  34. data/lib/watir/elements/text_field.rb +4 -4
  35. data/lib/watir/generator/base/generator.rb +4 -4
  36. data/lib/watir/generator/base/visitor.rb +0 -29
  37. data/lib/watir/generator/html/generator.rb +2 -1
  38. data/lib/watir/has_window.rb +22 -18
  39. data/lib/watir/http_client.rb +9 -0
  40. data/lib/watir/js_execution.rb +2 -2
  41. data/lib/watir/js_snippets.rb +2 -2
  42. data/lib/watir/locators.rb +6 -8
  43. data/lib/watir/locators/button/matcher.rb +0 -23
  44. data/lib/watir/locators/button/selector_builder/xpath.rb +4 -15
  45. data/lib/watir/locators/element/matcher.rb +4 -19
  46. data/lib/watir/locators/element/selector_builder.rb +3 -41
  47. data/lib/watir/locators/element/selector_builder/xpath.rb +34 -41
  48. data/lib/watir/locators/option/matcher.rb +24 -0
  49. data/lib/watir/locators/option/selector_builder.rb +8 -0
  50. data/lib/watir/locators/option/selector_builder/xpath.rb +37 -0
  51. data/lib/watir/logger.rb +4 -91
  52. data/lib/watir/radio_set.rb +5 -4
  53. data/lib/watir/row_container.rb +4 -4
  54. data/lib/watir/screenshot.rb +2 -8
  55. data/lib/watir/user_editable.rb +13 -2
  56. data/lib/watir/version.rb +1 -1
  57. data/lib/watir/wait.rb +6 -74
  58. data/lib/watir/wait/timer.rb +1 -1
  59. data/lib/watir/window.rb +24 -25
  60. data/lib/watir/window_collection.rb +79 -0
  61. data/lib/watirspec.rb +5 -2
  62. data/lib/watirspec/guards.rb +1 -1
  63. data/lib/watirspec/implementation.rb +7 -5
  64. data/lib/watirspec/runner.rb +2 -2
  65. data/lib/watirspec/server.rb +2 -2
  66. data/spec/spec_helper.rb +1 -21
  67. data/spec/unit/capabilities_spec.rb +504 -21
  68. data/spec/unit/match_elements/button_spec.rb +0 -13
  69. data/spec/unit/match_elements/element_spec.rb +55 -51
  70. data/spec/unit/match_elements/text_field_spec.rb +6 -6
  71. data/spec/unit/selector_builder/element_spec.rb +6 -23
  72. data/spec/unit/selector_builder/text_field_spec.rb +6 -7
  73. data/spec/unit/unit_helper.rb +2 -4
  74. data/spec/watirspec/after_hooks_spec.rb +23 -42
  75. data/spec/watirspec/alert_spec.rb +4 -21
  76. data/spec/watirspec/browser_spec.rb +186 -206
  77. data/spec/watirspec/cookies_spec.rb +47 -52
  78. data/spec/watirspec/drag_and_drop_spec.rb +5 -7
  79. data/spec/watirspec/elements/area_spec.rb +1 -5
  80. data/spec/watirspec/elements/button_spec.rb +4 -18
  81. data/spec/watirspec/elements/checkbox_spec.rb +10 -24
  82. data/spec/watirspec/elements/date_field_spec.rb +13 -16
  83. data/spec/watirspec/elements/date_time_field_spec.rb +14 -13
  84. data/spec/watirspec/elements/dd_spec.rb +3 -4
  85. data/spec/watirspec/elements/del_spec.rb +10 -12
  86. data/spec/watirspec/elements/div_spec.rb +45 -84
  87. data/spec/watirspec/elements/divs_spec.rb +2 -2
  88. data/spec/watirspec/elements/dl_spec.rb +4 -12
  89. data/spec/watirspec/elements/element_spec.rb +204 -181
  90. data/spec/watirspec/elements/elements_spec.rb +8 -9
  91. data/spec/watirspec/elements/filefield_spec.rb +5 -7
  92. data/spec/watirspec/elements/form_spec.rb +3 -5
  93. data/spec/watirspec/elements/forms_spec.rb +3 -5
  94. data/spec/watirspec/elements/frame_spec.rb +17 -22
  95. data/spec/watirspec/elements/iframe_spec.rb +25 -33
  96. data/spec/watirspec/elements/ins_spec.rb +10 -12
  97. data/spec/watirspec/elements/link_spec.rb +23 -23
  98. data/spec/watirspec/elements/links_spec.rb +8 -9
  99. data/spec/watirspec/elements/radio_spec.rb +11 -14
  100. data/spec/watirspec/elements/select_list_spec.rb +358 -209
  101. data/spec/watirspec/elements/span_spec.rb +12 -14
  102. data/spec/watirspec/elements/spans_spec.rb +1 -1
  103. data/spec/watirspec/elements/strong_spec.rb +1 -1
  104. data/spec/watirspec/elements/table_nesting_spec.rb +31 -34
  105. data/spec/watirspec/elements/table_spec.rb +11 -13
  106. data/spec/watirspec/elements/tbody_spec.rb +10 -12
  107. data/spec/watirspec/elements/td_spec.rb +4 -6
  108. data/spec/watirspec/elements/text_field_spec.rb +10 -12
  109. data/spec/watirspec/elements/tr_spec.rb +5 -7
  110. data/spec/watirspec/html/non_control_elements.html +8 -3
  111. data/spec/watirspec/html/special_chars.html +3 -0
  112. data/spec/watirspec/html/wait.html +5 -5
  113. data/spec/watirspec/html/window_switching.html +10 -0
  114. data/spec/watirspec/special_chars_spec.rb +10 -0
  115. data/spec/watirspec/support/rspec_matchers.rb +11 -24
  116. data/spec/watirspec/user_editable_spec.rb +26 -28
  117. data/spec/watirspec/wait_spec.rb +154 -201
  118. data/spec/watirspec/window_switching_spec.rb +359 -270
  119. data/spec/watirspec_helper.rb +52 -49
  120. data/support/doctest_helper.rb +0 -2
  121. data/watir.gemspec +4 -5
  122. metadata +30 -39
  123. data/.travis.yml +0 -87
  124. data/appveyor.yml +0 -13
  125. data/lib/watir/legacy_wait.rb +0 -123
  126. data/spec/implementation_spec.rb +0 -24
  127. data/spec/unit/container_spec.rb +0 -35
  128. data/spec/unit/logger_spec.rb +0 -81
  129. data/spec/watirspec/relaxed_locate_spec.rb +0 -109
@@ -44,8 +44,9 @@ module Watir
44
44
  # @see Watir::Browser#execute_script
45
45
  #
46
46
 
47
- def execute_script(script, *args)
47
+ def execute_script(script, *args, function_name: nil)
48
48
  args.map! do |e|
49
+ Watir.logger.info "Executing Script on Frame: #{function_name}" if function_name
49
50
  e.is_a?(Element) ? e.wait_until(&:exists?).wd : e
50
51
  end
51
52
  returned = driver.execute_script(script, *args)
@@ -90,12 +91,12 @@ module Watir
90
91
  end # FrameCollection
91
92
 
92
93
  module Container
93
- def frame(*args)
94
- Frame.new(self, extract_selector(args).merge(tag_name: 'frame'))
94
+ def frame(opts = {})
95
+ Frame.new(self, opts.merge(tag_name: 'frame'))
95
96
  end
96
97
 
97
- def frames(*args)
98
- FrameCollection.new(self, extract_selector(args).merge(tag_name: 'frame'))
98
+ def frames(opts = {})
99
+ FrameCollection.new(self, opts.merge(tag_name: 'frame'))
99
100
  end
100
101
  end # Container
101
102
 
@@ -125,7 +126,6 @@ module Watir
125
126
  def switch!
126
127
  @driver.switch_to.frame @element
127
128
  @browser.default_context = false
128
- @browser.after_hooks.run
129
129
  rescue Selenium::WebDriver::Error::NoSuchFrameError => e
130
130
  raise UnknownFrameException, e.message
131
131
  end
@@ -9,8 +9,8 @@ module Watir
9
9
  # Selects this radio button.
10
10
  #
11
11
 
12
- def set
13
- click unless set?
12
+ def set(bool = true)
13
+ click if bool && !set?
14
14
  end
15
15
  alias select set
16
16
 
@@ -39,12 +39,12 @@ module Watir
39
39
  end # Radio
40
40
 
41
41
  module Container
42
- def radio(*args)
43
- Radio.new(self, extract_selector(args).merge(tag_name: 'input', type: 'radio'))
42
+ def radio(opts = {})
43
+ Radio.new(self, opts.merge(tag_name: 'input', type: 'radio'))
44
44
  end
45
45
 
46
- def radios(*args)
47
- RadioCollection.new(self, extract_selector(args).merge(tag_name: 'input', type: 'radio'))
46
+ def radios(opts = {})
47
+ RadioCollection.new(self, opts.merge(tag_name: 'input', type: 'radio'))
48
48
  end
49
49
  end # Container
50
50
 
@@ -5,7 +5,7 @@ module Watir
5
5
  #
6
6
 
7
7
  def clear
8
- raise Exception::Error, 'you can only clear multi-selects' unless multiple?
8
+ raise Exception::Error, 'you can only clear multi-selects' unless multiple_select_list?
9
9
 
10
10
  selected_options.each(&:click)
11
11
  end
@@ -18,7 +18,7 @@ module Watir
18
18
  #
19
19
 
20
20
  def include?(str_or_rx)
21
- option(text: str_or_rx).exist? || option(label: str_or_rx).exist?
21
+ option(text: str_or_rx).exist? || option(label: str_or_rx).exist? || option(value: str_or_rx).exist?
22
22
  end
23
23
 
24
24
  #
@@ -29,23 +29,16 @@ module Watir
29
29
  # @return [String] The text of the option selected. If multiple options match, returns the first match.
30
30
  #
31
31
 
32
- def select(*str_or_rx)
33
- results = str_or_rx.flatten.map { |v| select_by v }
34
- results.first
35
- end
32
+ def select(*str_or_rx, text: nil, value: nil, label: nil)
33
+ key, value = parse_select_args(str_or_rx, text, value, label)
36
34
 
37
- #
38
- # Select all options whose text or label matches the given string.
39
- #
40
- # @param [String, Regexp] str_or_rx
41
- # @raise [Watir::Exception::NoValueFoundException] if the value does not exist.
42
- # @return [String] The text of the first option selected.
43
- #
44
-
45
- def select_all(*str_or_rx)
46
- results = str_or_rx.flatten.map { |v| select_all_by v }
47
- results.first
35
+ if value.size > 1 || value.first.is_a?(Array)
36
+ value.flatten.map { |v| select_all_by key, v }.first
37
+ else
38
+ select_matching([find_option(key, value.flatten.first)])
39
+ end
48
40
  end
41
+ alias set select
49
42
 
50
43
  #
51
44
  # Uses JavaScript to select the option whose text matches the given string.
@@ -54,36 +47,14 @@ module Watir
54
47
  # @raise [Watir::Exception::NoValueFoundException] if the value does not exist.
55
48
  #
56
49
 
57
- def select!(*str_or_rx)
58
- results = str_or_rx.flatten.map { |v| select_by!(v, :single) }
59
- results.first
60
- end
61
-
62
- #
63
- # Uses JavaScript to select all options whose text matches the given string.
64
- #
65
- # @param [String, Regexp] str_or_rx
66
- # @raise [Watir::Exception::NoValueFoundException] if the value does not exist.
67
- #
68
-
69
- def select_all!(*str_or_rx)
70
- results = str_or_rx.flatten.map { |v| select_by!(v, :multiple) }
71
- results.first
72
- end
50
+ def select!(*str_or_rx, text: nil, value: nil, label: nil)
51
+ key, value = parse_select_args(str_or_rx, text, value, label)
73
52
 
74
- #
75
- # Selects the option(s) whose value attribute matches the given string.
76
- #
77
- # @see +select+
78
- #
79
- # @param [String, Regexp] str_or_rx
80
- # @raise [Watir::Exception::NoValueFoundException] if the value does not exist.
81
- # @return [String] The option selected. If multiple options match, returns the first match
82
- #
83
-
84
- def select_value(str_or_rx)
85
- Watir.logger.deprecate '#select_value', '#select', ids: [:select_value]
86
- select_by str_or_rx
53
+ if value.size > 1 || value.first.is_a?(Array)
54
+ value.flatten.map { |v| select_by! key, v, :multiple }.first
55
+ else
56
+ value.flatten.map { |v| select_by! key, v, :single }.first
57
+ end
87
58
  end
88
59
 
89
60
  #
@@ -94,16 +65,10 @@ module Watir
94
65
  # @return [Boolean]
95
66
  #
96
67
 
97
- def selected?(str_or_rx)
98
- by_text = options(text: str_or_rx)
99
- return true if by_text.find(&:selected?)
100
-
101
- by_label = options(label: str_or_rx)
102
- return true if by_label.find(&:selected?)
68
+ def selected?(*str_or_rx, text: nil, value: nil, label: nil)
69
+ key, value = parse_select_args(str_or_rx, text, value, label)
103
70
 
104
- return false unless (by_text.size + by_label.size).zero?
105
-
106
- raise(UnknownObjectException, "Unable to locate option matching #{str_or_rx.inspect}")
71
+ find_option(key, value.first).selected?
107
72
  end
108
73
 
109
74
  #
@@ -114,8 +79,7 @@ module Watir
114
79
  #
115
80
 
116
81
  def value
117
- option = selected_options.first
118
- option&.value
82
+ selected_options.first&.value
119
83
  end
120
84
 
121
85
  #
@@ -125,9 +89,9 @@ module Watir
125
89
  # @return [String, nil]
126
90
  #
127
91
 
92
+ # TODO: What is default behavior without #first ?
128
93
  def text
129
- option = selected_options.first
130
- option&.text
94
+ selected_options.first&.text
131
95
  end
132
96
 
133
97
  # Returns an array of currently selected options.
@@ -141,20 +105,29 @@ module Watir
141
105
 
142
106
  private
143
107
 
144
- def select_by(str_or_rx)
145
- found = find_options(:value, str_or_rx)
108
+ def multiple_select_list?
109
+ @multiple_select = @multiple_select.nil? ? multiple? : @multiple_select
110
+ end
146
111
 
147
- if found.size > 1
148
- Watir.logger.deprecate 'Selecting Multiple Options with #select', '#select_all',
149
- ids: [:select_by]
150
- end
151
- select_matching(found)
112
+ def parse_select_args(str_or_rx, text, value, label)
113
+ selectors = {}
114
+ selectors[:any] = str_or_rx unless str_or_rx.empty?
115
+ selectors[:text] = Array[text] if text
116
+ selectors[:value] = Array[value] if value
117
+ selectors[:label] = Array[label] if label
118
+
119
+ raise ArgumentError, "too many arguments used for Select#select: #{selectors}" if selectors.size > 1
120
+
121
+ selectors.first
152
122
  end
153
123
 
154
- def select_by!(str_or_rx, number)
124
+ def select_by!(key, str_or_rx, number)
125
+ str_or_rx = type_check(str_or_rx)
126
+
155
127
  js_rx = process_str_or_rx(str_or_rx)
128
+ approaches = key == :any ? %w[Text Label Value] : [key.to_s.capitalize]
156
129
 
157
- %w[Text Label Value].each do |approach|
130
+ approaches.each do |approach|
158
131
  element_call { execute_js("selectOptions#{approach}", self, js_rx, number.to_s) }
159
132
  return selected_options.first.text if matching_option?(approach.downcase, str_or_rx)
160
133
  end
@@ -190,44 +163,43 @@ module Watir
190
163
  false
191
164
  end
192
165
 
193
- def select_all_by(str_or_rx)
194
- raise Error, 'you can only use #select_all on multi-selects' unless multiple?
195
-
196
- found = find_options :text, str_or_rx
166
+ def select_all_by(key, str_or_rx)
167
+ raise Error, 'you can only use #select_all on multi-selects' unless multiple_select_list?
197
168
 
198
- select_matching(found)
169
+ select_matching(find_options(key, str_or_rx))
199
170
  end
200
171
 
201
- def find_options(how, str_or_rx)
202
- wait_while do
203
- case str_or_rx
204
- when String, Numeric, Regexp
205
- @found = how == :value ? options(value: str_or_rx) : []
206
- @found = options(text: str_or_rx) if @found.empty?
207
- @found = options(label: str_or_rx) if @found.empty?
208
- @found.empty? && Watir.relaxed_locate?
209
- else
210
- raise TypeError, "expected String or Regexp, got #{str_or_rx.inspect}:#{str_or_rx.class}"
211
- end
212
- end
213
- # TODO: Remove conditional when remove relaxed_locate toggle
214
- return @found unless @found.empty?
172
+ def find_option(key, str_or_rx)
173
+ val = type_check(str_or_rx)
215
174
 
175
+ option(key => val).wait_until(&:exists?)
176
+ rescue Wait::TimeoutError
216
177
  raise_no_value_found(str_or_rx)
178
+ end
179
+
180
+ def find_options(key, str_or_rx)
181
+ val = type_check(str_or_rx)
182
+
183
+ options(key => val).wait_until(&:exists?)
217
184
  rescue Wait::TimeoutError
218
185
  raise_no_value_found(str_or_rx)
219
186
  end
220
187
 
188
+ def type_check(str_or_rx)
189
+ str_or_rx = str_or_rx.to_s if str_or_rx.is_a?(Numeric)
190
+ return str_or_rx if [String, Regexp].any? { |k| str_or_rx.is_a?(k) }
191
+
192
+ raise TypeError, "expected String, Numeric or Regexp, got #{str_or_rx.inspect}:#{str_or_rx.class}"
193
+ end
194
+
221
195
  # TODO: Consider locating the Select List before throwing the exception
222
196
  def raise_no_value_found(str_or_rx)
223
197
  raise NoValueFoundException, "#{str_or_rx.inspect} not found in #{inspect}"
224
198
  end
225
199
 
226
200
  def select_matching(elements)
227
- elements = [elements.first] unless multiple?
228
201
  elements.each { |e| e.click unless e.selected? }
229
- # TODO: this can go back to #exist? after `:stale_exists` deprecation removed
230
- elements.first.stale? ? '' : elements.first.text
202
+ elements.first.exists? ? elements.first.text : ''
231
203
  end
232
204
  end # Select
233
205
 
@@ -255,242 +255,242 @@ module Watir
255
255
  module Container
256
256
 
257
257
  # @return [Circle]
258
- def circle(*args)
259
- Circle.new(self, extract_selector(args).merge(tag_name: "circle"))
258
+ def circle(opts = {})
259
+ Circle.new(self, opts.merge(tag_name: "circle"))
260
260
  end
261
261
  # @return [CircleCollection]
262
- def circles(*args)
263
- CircleCollection.new(self, extract_selector(args).merge(tag_name: "circle"))
262
+ def circles(opts = {})
263
+ CircleCollection.new(self, opts.merge(tag_name: "circle"))
264
264
  end
265
265
  Watir.tag_to_class[:circle] = Circle
266
266
 
267
267
  # @return [Defs]
268
- def defs(*args)
269
- Defs.new(self, extract_selector(args).merge(tag_name: "defs"))
268
+ def defs(opts = {})
269
+ Defs.new(self, opts.merge(tag_name: "defs"))
270
270
  end
271
271
  # @return [DefsCollection]
272
- def defss(*args)
273
- DefsCollection.new(self, extract_selector(args).merge(tag_name: "defs"))
272
+ def defss(opts = {})
273
+ DefsCollection.new(self, opts.merge(tag_name: "defs"))
274
274
  end
275
275
  Watir.tag_to_class[:defs] = Defs
276
276
 
277
277
  # @return [Desc]
278
- def desc(*args)
279
- Desc.new(self, extract_selector(args).merge(tag_name: "desc"))
278
+ def desc(opts = {})
279
+ Desc.new(self, opts.merge(tag_name: "desc"))
280
280
  end
281
281
  # @return [DescCollection]
282
- def descs(*args)
283
- DescCollection.new(self, extract_selector(args).merge(tag_name: "desc"))
282
+ def descs(opts = {})
283
+ DescCollection.new(self, opts.merge(tag_name: "desc"))
284
284
  end
285
285
  Watir.tag_to_class[:desc] = Desc
286
286
 
287
287
  # @return [Ellipse]
288
- def ellipse(*args)
289
- Ellipse.new(self, extract_selector(args).merge(tag_name: "ellipse"))
288
+ def ellipse(opts = {})
289
+ Ellipse.new(self, opts.merge(tag_name: "ellipse"))
290
290
  end
291
291
  # @return [EllipseCollection]
292
- def ellipses(*args)
293
- EllipseCollection.new(self, extract_selector(args).merge(tag_name: "ellipse"))
292
+ def ellipses(opts = {})
293
+ EllipseCollection.new(self, opts.merge(tag_name: "ellipse"))
294
294
  end
295
295
  Watir.tag_to_class[:ellipse] = Ellipse
296
296
 
297
297
  # @return [ForeignObject]
298
- def foreign_object(*args)
299
- ForeignObject.new(self, extract_selector(args).merge(tag_name: "foreignObject"))
298
+ def foreign_object(opts = {})
299
+ ForeignObject.new(self, opts.merge(tag_name: "foreignObject"))
300
300
  end
301
301
  # @return [ForeignObjectCollection]
302
- def foreign_objects(*args)
303
- ForeignObjectCollection.new(self, extract_selector(args).merge(tag_name: "foreignObject"))
302
+ def foreign_objects(opts = {})
303
+ ForeignObjectCollection.new(self, opts.merge(tag_name: "foreignObject"))
304
304
  end
305
305
  Watir.tag_to_class[:foreignObject] = ForeignObject
306
306
 
307
307
  # @return [G]
308
- def g(*args)
309
- G.new(self, extract_selector(args).merge(tag_name: "g"))
308
+ def g(opts = {})
309
+ G.new(self, opts.merge(tag_name: "g"))
310
310
  end
311
311
  # @return [GCollection]
312
- def gs(*args)
313
- GCollection.new(self, extract_selector(args).merge(tag_name: "g"))
312
+ def gs(opts = {})
313
+ GCollection.new(self, opts.merge(tag_name: "g"))
314
314
  end
315
315
  Watir.tag_to_class[:g] = G
316
316
 
317
317
  # @return [Line]
318
- def line(*args)
319
- Line.new(self, extract_selector(args).merge(tag_name: "line"))
318
+ def line(opts = {})
319
+ Line.new(self, opts.merge(tag_name: "line"))
320
320
  end
321
321
  # @return [LineCollection]
322
- def lines(*args)
323
- LineCollection.new(self, extract_selector(args).merge(tag_name: "line"))
322
+ def lines(opts = {})
323
+ LineCollection.new(self, opts.merge(tag_name: "line"))
324
324
  end
325
325
  Watir.tag_to_class[:line] = Line
326
326
 
327
327
  # @return [LinearGradient]
328
- def linear_gradient(*args)
329
- LinearGradient.new(self, extract_selector(args).merge(tag_name: "linearGradient"))
328
+ def linear_gradient(opts = {})
329
+ LinearGradient.new(self, opts.merge(tag_name: "linearGradient"))
330
330
  end
331
331
  # @return [LinearGradientCollection]
332
- def linear_gradients(*args)
333
- LinearGradientCollection.new(self, extract_selector(args).merge(tag_name: "linearGradient"))
332
+ def linear_gradients(opts = {})
333
+ LinearGradientCollection.new(self, opts.merge(tag_name: "linearGradient"))
334
334
  end
335
335
  Watir.tag_to_class[:linearGradient] = LinearGradient
336
336
 
337
337
  # @return [Marker]
338
- def marker(*args)
339
- Marker.new(self, extract_selector(args).merge(tag_name: "marker"))
338
+ def marker(opts = {})
339
+ Marker.new(self, opts.merge(tag_name: "marker"))
340
340
  end
341
341
  # @return [MarkerCollection]
342
- def markers(*args)
343
- MarkerCollection.new(self, extract_selector(args).merge(tag_name: "marker"))
342
+ def markers(opts = {})
343
+ MarkerCollection.new(self, opts.merge(tag_name: "marker"))
344
344
  end
345
345
  Watir.tag_to_class[:marker] = Marker
346
346
 
347
347
  # @return [Metadata]
348
- def metadata(*args)
349
- Metadata.new(self, extract_selector(args).merge(tag_name: "metadata"))
348
+ def metadata(opts = {})
349
+ Metadata.new(self, opts.merge(tag_name: "metadata"))
350
350
  end
351
351
  # @return [MetadataCollection]
352
- def metadatas(*args)
353
- MetadataCollection.new(self, extract_selector(args).merge(tag_name: "metadata"))
352
+ def metadatas(opts = {})
353
+ MetadataCollection.new(self, opts.merge(tag_name: "metadata"))
354
354
  end
355
355
  Watir.tag_to_class[:metadata] = Metadata
356
356
 
357
357
  # @return [Path]
358
- def path(*args)
359
- Path.new(self, extract_selector(args).merge(tag_name: "path"))
358
+ def path(opts = {})
359
+ Path.new(self, opts.merge(tag_name: "path"))
360
360
  end
361
361
  # @return [PathCollection]
362
- def paths(*args)
363
- PathCollection.new(self, extract_selector(args).merge(tag_name: "path"))
362
+ def paths(opts = {})
363
+ PathCollection.new(self, opts.merge(tag_name: "path"))
364
364
  end
365
365
  Watir.tag_to_class[:path] = Path
366
366
 
367
367
  # @return [Pattern]
368
- def pattern(*args)
369
- Pattern.new(self, extract_selector(args).merge(tag_name: "pattern"))
368
+ def pattern(opts = {})
369
+ Pattern.new(self, opts.merge(tag_name: "pattern"))
370
370
  end
371
371
  # @return [PatternCollection]
372
- def patterns(*args)
373
- PatternCollection.new(self, extract_selector(args).merge(tag_name: "pattern"))
372
+ def patterns(opts = {})
373
+ PatternCollection.new(self, opts.merge(tag_name: "pattern"))
374
374
  end
375
375
  Watir.tag_to_class[:pattern] = Pattern
376
376
 
377
377
  # @return [Polygon]
378
- def polygon(*args)
379
- Polygon.new(self, extract_selector(args).merge(tag_name: "polygon"))
378
+ def polygon(opts = {})
379
+ Polygon.new(self, opts.merge(tag_name: "polygon"))
380
380
  end
381
381
  # @return [PolygonCollection]
382
- def polygons(*args)
383
- PolygonCollection.new(self, extract_selector(args).merge(tag_name: "polygon"))
382
+ def polygons(opts = {})
383
+ PolygonCollection.new(self, opts.merge(tag_name: "polygon"))
384
384
  end
385
385
  Watir.tag_to_class[:polygon] = Polygon
386
386
 
387
387
  # @return [Polyline]
388
- def polyline(*args)
389
- Polyline.new(self, extract_selector(args).merge(tag_name: "polyline"))
388
+ def polyline(opts = {})
389
+ Polyline.new(self, opts.merge(tag_name: "polyline"))
390
390
  end
391
391
  # @return [PolylineCollection]
392
- def polylines(*args)
393
- PolylineCollection.new(self, extract_selector(args).merge(tag_name: "polyline"))
392
+ def polylines(opts = {})
393
+ PolylineCollection.new(self, opts.merge(tag_name: "polyline"))
394
394
  end
395
395
  Watir.tag_to_class[:polyline] = Polyline
396
396
 
397
397
  # @return [RadialGradient]
398
- def radial_gradient(*args)
399
- RadialGradient.new(self, extract_selector(args).merge(tag_name: "radialGradient"))
398
+ def radial_gradient(opts = {})
399
+ RadialGradient.new(self, opts.merge(tag_name: "radialGradient"))
400
400
  end
401
401
  # @return [RadialGradientCollection]
402
- def radial_gradients(*args)
403
- RadialGradientCollection.new(self, extract_selector(args).merge(tag_name: "radialGradient"))
402
+ def radial_gradients(opts = {})
403
+ RadialGradientCollection.new(self, opts.merge(tag_name: "radialGradient"))
404
404
  end
405
405
  Watir.tag_to_class[:radialGradient] = RadialGradient
406
406
 
407
407
  # @return [Rect]
408
- def rect(*args)
409
- Rect.new(self, extract_selector(args).merge(tag_name: "rect"))
408
+ def rect(opts = {})
409
+ Rect.new(self, opts.merge(tag_name: "rect"))
410
410
  end
411
411
  # @return [RectCollection]
412
- def rects(*args)
413
- RectCollection.new(self, extract_selector(args).merge(tag_name: "rect"))
412
+ def rects(opts = {})
413
+ RectCollection.new(self, opts.merge(tag_name: "rect"))
414
414
  end
415
415
  Watir.tag_to_class[:rect] = Rect
416
416
 
417
417
  # @return [Stop]
418
- def stop(*args)
419
- Stop.new(self, extract_selector(args).merge(tag_name: "stop"))
418
+ def stop(opts = {})
419
+ Stop.new(self, opts.merge(tag_name: "stop"))
420
420
  end
421
421
  # @return [StopCollection]
422
- def stops(*args)
423
- StopCollection.new(self, extract_selector(args).merge(tag_name: "stop"))
422
+ def stops(opts = {})
423
+ StopCollection.new(self, opts.merge(tag_name: "stop"))
424
424
  end
425
425
  Watir.tag_to_class[:stop] = Stop
426
426
 
427
427
  # @return [SVG]
428
- def svg(*args)
429
- SVG.new(self, extract_selector(args).merge(tag_name: "svg"))
428
+ def svg(opts = {})
429
+ SVG.new(self, opts.merge(tag_name: "svg"))
430
430
  end
431
431
  # @return [SVGCollection]
432
- def svgs(*args)
433
- SVGCollection.new(self, extract_selector(args).merge(tag_name: "svg"))
432
+ def svgs(opts = {})
433
+ SVGCollection.new(self, opts.merge(tag_name: "svg"))
434
434
  end
435
435
  Watir.tag_to_class[:svg] = SVG
436
436
 
437
437
  # @return [Switch]
438
- def switch(*args)
439
- Switch.new(self, extract_selector(args).merge(tag_name: "switch"))
438
+ def switch(opts = {})
439
+ Switch.new(self, opts.merge(tag_name: "switch"))
440
440
  end
441
441
  # @return [SwitchCollection]
442
- def switches(*args)
443
- SwitchCollection.new(self, extract_selector(args).merge(tag_name: "switch"))
442
+ def switches(opts = {})
443
+ SwitchCollection.new(self, opts.merge(tag_name: "switch"))
444
444
  end
445
445
  Watir.tag_to_class[:switch] = Switch
446
446
 
447
447
  # @return [Symbol]
448
- def symbol(*args)
449
- Symbol.new(self, extract_selector(args).merge(tag_name: "symbol"))
448
+ def symbol(opts = {})
449
+ Symbol.new(self, opts.merge(tag_name: "symbol"))
450
450
  end
451
451
  # @return [SymbolCollection]
452
- def symbols(*args)
453
- SymbolCollection.new(self, extract_selector(args).merge(tag_name: "symbol"))
452
+ def symbols(opts = {})
453
+ SymbolCollection.new(self, opts.merge(tag_name: "symbol"))
454
454
  end
455
455
  Watir.tag_to_class[:symbol] = Symbol
456
456
 
457
457
  # @return [TextPath]
458
- def text_path(*args)
459
- TextPath.new(self, extract_selector(args).merge(tag_name: "textPath"))
458
+ def text_path(opts = {})
459
+ TextPath.new(self, opts.merge(tag_name: "textPath"))
460
460
  end
461
461
  # @return [TextPathCollection]
462
- def text_paths(*args)
463
- TextPathCollection.new(self, extract_selector(args).merge(tag_name: "textPath"))
462
+ def text_paths(opts = {})
463
+ TextPathCollection.new(self, opts.merge(tag_name: "textPath"))
464
464
  end
465
465
  Watir.tag_to_class[:textPath] = TextPath
466
466
 
467
467
  # @return [TSpan]
468
- def tspan(*args)
469
- TSpan.new(self, extract_selector(args).merge(tag_name: "tspan"))
468
+ def tspan(opts = {})
469
+ TSpan.new(self, opts.merge(tag_name: "tspan"))
470
470
  end
471
471
  # @return [TSpanCollection]
472
- def tspans(*args)
473
- TSpanCollection.new(self, extract_selector(args).merge(tag_name: "tspan"))
472
+ def tspans(opts = {})
473
+ TSpanCollection.new(self, opts.merge(tag_name: "tspan"))
474
474
  end
475
475
  Watir.tag_to_class[:tspan] = TSpan
476
476
 
477
477
  # @return [Use]
478
- def use(*args)
479
- Use.new(self, extract_selector(args).merge(tag_name: "use"))
478
+ def use(opts = {})
479
+ Use.new(self, opts.merge(tag_name: "use"))
480
480
  end
481
481
  # @return [UseCollection]
482
- def uses(*args)
483
- UseCollection.new(self, extract_selector(args).merge(tag_name: "use"))
482
+ def uses(opts = {})
483
+ UseCollection.new(self, opts.merge(tag_name: "use"))
484
484
  end
485
485
  Watir.tag_to_class[:use] = Use
486
486
 
487
487
  # @return [View]
488
- def view(*args)
489
- View.new(self, extract_selector(args).merge(tag_name: "view"))
488
+ def view(opts = {})
489
+ View.new(self, opts.merge(tag_name: "view"))
490
490
  end
491
491
  # @return [ViewCollection]
492
- def views(*args)
493
- ViewCollection.new(self, extract_selector(args).merge(tag_name: "view"))
492
+ def views(opts = {})
493
+ ViewCollection.new(self, opts.merge(tag_name: "view"))
494
494
  end
495
495
  Watir.tag_to_class[:view] = View
496
496
  end # Container