capybara 3.31.0 → 3.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,192 +5,248 @@ require 'minitest/spec'
5
5
  module Capybara
6
6
  module Minitest
7
7
  module Expectations
8
- %w[text content title current_path].each do |assertion|
9
- infect_an_assertion "assert_#{assertion}", "must_have_#{assertion}", :reverse
10
- infect_an_assertion "refute_#{assertion}", "wont_have_#{assertion}", :reverse
11
- end
8
+ ##
9
+ # Expectation that there is an ancestor
10
+ #
11
+ # @!method must_have_ancestor
12
+ # See {Capybara::Node::Matchers#has_ancestor?}
12
13
 
13
- # rubocop:disable Style/MultilineBlockChain
14
- (%w[selector xpath css link button field select table checked_field unchecked_field
15
- ancestor sibling].flat_map do |assertion|
16
- [%W[assert_#{assertion} must_have_#{assertion}],
17
- %W[refute_#{assertion} wont_have_#{assertion}]]
18
- end + [%w[assert_all_of_selectors must_have_all_of_selectors],
19
- %w[assert_none_of_selectors must_have_none_of_selectors],
20
- %w[assert_any_of_selectors must_have_any_of_selectors],
21
- %w[assert_matches_style must_match_style]] +
22
- %w[selector xpath css].flat_map do |assertion|
23
- [%W[assert_matches_#{assertion} must_match_#{assertion}],
24
- %W[refute_matches_#{assertion} wont_match_#{assertion}]]
25
- end).each do |(meth, new_name)|
26
- class_eval <<-ASSERTION, __FILE__, __LINE__ + 1
27
- def #{new_name} *args, &block
28
- ::Minitest::Expectation.new(self, ::Minitest::Spec.current).#{new_name}(*args, &block)
29
- end
30
- ASSERTION
14
+ ##
15
+ # Expectation that there is button
16
+ #
17
+ # @!method must_have_button
18
+ # See {Capybara::Node::Matchers#has_button?}
31
19
 
32
- ::Minitest::Expectation.class_eval <<-ASSERTION, __FILE__, __LINE__ + 1
33
- def #{new_name} *args, &block
34
- ctx.#{meth}(target, *args, &block)
35
- end
36
- ASSERTION
37
- end
38
- # rubocop:enable Style/MultilineBlockChain
20
+ ##
21
+ # Expectation that there is no button
22
+ #
23
+ # @!method wont_have_button
24
+ # See {Capybara::Node::Matchers#has_no_button?}
39
25
 
40
26
  ##
41
- # @deprecated
42
- def must_have_style(*args, &block)
43
- warn 'must_have_style is deprecated, please use must_match_style'
44
- must_match_style(*args, &block)
45
- end
27
+ # Expectation that there is checked_field
28
+ #
29
+ # @!method must_have_checked_field
30
+ # See {Capybara::Node::Matchers#has_checked_field?}
46
31
 
47
32
  ##
48
- # Expectation that there is xpath
33
+ # Expectation that there is no checked_field
49
34
  #
50
- # @!method must_have_xpath
51
- # see Capybara::Node::Matchers#has_xpath?
35
+ # @!method wont_have_checked_field
36
+ # See {Capybara::Node::Matchers#has_no_checked_field?}
52
37
 
53
38
  ##
54
- # Expectation that there is no xpath
39
+ # Expectation that there is unchecked_field
55
40
  #
56
- # @!method wont_have_xpath
57
- # see Capybara::Node::Matchers#has_no_xpath?
41
+ # @!method must_have_unchecked_field
42
+ # See {Capybara::Node::Matchers#has_unchecked_field?}
58
43
 
59
44
  ##
60
- # Expectation that there is css
45
+ # Expectation that there is no unchecked_field
61
46
  #
62
- # @!method must_have_css
63
- # see Capybara::Node::Matchers#has_css?
47
+ # @!method wont_have_unchecked_field
48
+ # See {Capybara::Node::Matchers#has_no_unchecked_field?}
64
49
 
65
50
  ##
66
- # Expectation that there is no css
51
+ # Expectation that page content does match
67
52
  #
68
- # @!method wont_have_css
69
- # see Capybara::Node::Matchers#has_no_css?
53
+ # @!method must_have_content
54
+ # See {Capybara::Node::Matchers#has_content?}
70
55
 
71
56
  ##
72
- # Expectation that there is link
57
+ # Expectation that page content does not match
73
58
  #
74
- # @!method must_have_link
75
- # see {Capybara::Node::Matchers#has_link?}
59
+ # @!method wont_have_content
60
+ # See {Capybara::Node::Matchers#has_no_content?}
76
61
 
77
62
  ##
78
- # Expectation that there is no link
63
+ # Expectation that there is css
79
64
  #
80
- # @!method wont_have_link
81
- # see {Capybara::Node::Matchers#has_no_link?}
65
+ # @!method must_have_css
66
+ # See {Capybara::Node::Matchers#has_css?}
82
67
 
83
68
  ##
84
- # Expectation that there is button
69
+ # Expectation that there is no css
85
70
  #
86
- # @!method must_have_button
87
- # see {Capybara::Node::Matchers#has_button?}
71
+ # @!method wont_have_css
72
+ # See {Capybara::Node::Matchers#has_no_css?}
88
73
 
89
74
  ##
90
- # Expectation that there is no button
75
+ # Expectation that current path matches
91
76
  #
92
- # @!method wont_have_button
93
- # see {Capybara::Node::Matchers#has_no_button?}
77
+ # @!method must_have_current_path
78
+ # See {Capybara::SessionMatchers#has_current_path?}
79
+
80
+ ##
81
+ # Expectation that current page does not match
82
+ #
83
+ # @!method wont_have_current_path
84
+ # See {Capybara::SessionMatchers#has_no_current_path?}
94
85
 
95
86
  ##
96
87
  # Expectation that there is field
97
88
  #
98
89
  # @!method must_have_field
99
- # see {Capybara::Node::Matchers#has_field?}
90
+ # See {Capybara::Node::Matchers#has_field?}
100
91
 
101
92
  ##
102
93
  # Expectation that there is no field
103
94
  #
104
95
  # @!method wont_have_field
105
- # see {Capybara::Node::Matchers#has_no_field?}
96
+ # See {Capybara::Node::Matchers#has_no_field?}
106
97
 
107
98
  ##
108
- # Expectation that there is checked_field
99
+ # Expectation that there is link
109
100
  #
110
- # @!method must_have_checked_field
111
- # see {Capybara::Node::Matchers#has_checked_field?}
101
+ # @!method must_have_link
102
+ # See {Capybara::Node::Matchers#has_link?}
112
103
 
113
104
  ##
114
- # Expectation that there is no checked_field
105
+ # Expectation that there is no link
115
106
  #
116
- # @!method wont_have_chceked_field
107
+ # @!method wont_have_link
108
+ # See {Capybara::Node::Matchers#has_no_link?}
117
109
 
118
110
  ##
119
- # Expectation that there is unchecked_field
111
+ # Expectation that page text does match
120
112
  #
121
- # @!method must_have_unchecked_field
122
- # see {Capybara::Node::Matchers#has_unchecked_field?}
113
+ # @!method must_have_text
114
+ # See {Capybara::Node::Matchers#has_text?}
123
115
 
124
116
  ##
125
- # Expectation that there is no unchecked_field
117
+ # Expectation that page text does not match
118
+ #
119
+ # @!method wont_have_text
120
+ # See {Capybara::Node::Matchers#has_no_text?}
121
+
122
+ ##
123
+ # Expectation that page title does match
124
+ #
125
+ # @!method must_have_title
126
+ # See {Capybara::Node::DocumentMatchers#has_title?}
127
+
128
+ ##
129
+ # Expectation that page title does not match
126
130
  #
127
- # @!method wont_have_unchceked_field
131
+ # @!method wont_have_title
132
+ # See {Capybara::Node::DocumentMatchers#has_no_title?}
128
133
 
129
134
  ##
130
135
  # Expectation that there is select
131
136
  #
132
137
  # @!method must_have_select
133
- # see {Capybara::Node::Matchers#has_select?}
138
+ # See {Capybara::Node::Matchers#has_select?}
134
139
 
135
140
  ##
136
141
  # Expectation that there is no select
137
142
  #
138
143
  # @!method wont_have_select
139
- # see {Capybara::Node::Matchers#has_no_select?}
144
+ # See {Capybara::Node::Matchers#has_no_select?}
140
145
 
141
146
  ##
142
- # Expectation that there is table
147
+ # Expectation that there is a selector
143
148
  #
144
- # @!method must_have_table
145
- # see {Capybara::Node::Matchers#has_table?}
149
+ # @!method must_have_selector
150
+ # See {Capybara::Node::Matchers#has_selector?}
146
151
 
147
152
  ##
148
- # Expectation that there is no table
153
+ # Expectation that there is no selector
149
154
  #
150
- # @!method wont_have_table
151
- # see {Capybara::Node::Matchers#has_no_table?}
155
+ # @!method wont_have_selector
156
+ # See {Capybara::Node::Matchers#has_no_selector?}
152
157
 
153
158
  ##
154
- # Expectation that page title does match
159
+ # Expectation that all of the provided selectors are present
155
160
  #
156
- # @!method must_have_title
157
- # see {Capybara::Node::DocumentMatchers#assert_title}
161
+ # @!method must_have_all_of_selectors
162
+ # See {Capybara::Node::Matchers#assert_all_of_selectors}
158
163
 
159
164
  ##
160
- # Expectation that page title does not match
165
+ # Expectation that none of the provided selectors are present
161
166
  #
162
- # @!method wont_have_title
163
- # see {Capybara::Node::DocumentMatchers#assert_no_title}
167
+ # @!method must_have_none_of_selectors
168
+ # See {Capybara::Node::Matchers#assert_none_of_selectors}
164
169
 
165
170
  ##
166
- # Expectation that current path matches
171
+ # Expectation that any of the provided selectors are present
167
172
  #
168
- # @!method must_have_current_path
169
- # see {Capybara::SessionMatchers#assert_current_path}
173
+ # @!method must_have_any_of_selectors
174
+ # See {Capybara::Node::Matchers#assert_any_of_selectors}
170
175
 
171
176
  ##
172
- # Expectation that current page does not match
177
+ # Expectation that there is a sibling
173
178
  #
174
- # @!method wont_have_current_path
175
- # see {Capybara::SessionMatchers#assert_no_current_path}
179
+ # @!method must_have_sibling
180
+ # See {Capybara::Node::Matchers#has_sibling?}
176
181
 
177
182
  ##
178
183
  # Expectation that element has style
179
184
  #
180
185
  # @!method must_match_style
181
- # see {Capybara::Node::Matchers#assert_matches_style}
186
+ # See {Capybara::Node::Matchers#matches_style?}
182
187
 
183
188
  ##
184
- # Expectation that there is an ancestor
189
+ # Expectation that there is table
185
190
  #
186
- # @!method must_have_ancestor
187
- # see Capybara::Node::Matchers#has_ancestor?
191
+ # @!method must_have_table
192
+ # See {Capybara::Node::Matchers#has_table?}
188
193
 
189
194
  ##
190
- # Expectation that there is a sibling
195
+ # Expectation that there is no table
191
196
  #
192
- # @!method must_have_sibling
193
- # see Capybara::Node::Matchers#has_sibling?
197
+ # @!method wont_have_table
198
+ # See {Capybara::Node::Matchers#has_no_table?}
199
+
200
+ ##
201
+ # Expectation that there is xpath
202
+ #
203
+ # @!method must_have_xpath
204
+ # See {Capybara::Node::Matchers#has_xpath?}
205
+
206
+ ##
207
+ # Expectation that there is no xpath
208
+ #
209
+ # @!method wont_have_xpath
210
+ # See {Capybara::Node::Matchers#has_no_xpath?}
211
+
212
+ %w[text content title current_path].each do |assertion|
213
+ infect_an_assertion "assert_#{assertion}", "must_have_#{assertion}", :reverse
214
+ infect_an_assertion "refute_#{assertion}", "wont_have_#{assertion}", :reverse
215
+ end
216
+
217
+ # rubocop:disable Style/MultilineBlockChain
218
+ (%w[selector xpath css link button field select table checked_field unchecked_field
219
+ ancestor sibling].flat_map do |assertion|
220
+ [%W[assert_#{assertion} must_have_#{assertion}],
221
+ %W[refute_#{assertion} wont_have_#{assertion}]]
222
+ end + [%w[assert_all_of_selectors must_have_all_of_selectors],
223
+ %w[assert_none_of_selectors must_have_none_of_selectors],
224
+ %w[assert_any_of_selectors must_have_any_of_selectors],
225
+ %w[assert_matches_style must_match_style]] +
226
+ %w[selector xpath css].flat_map do |assertion|
227
+ [%W[assert_matches_#{assertion} must_match_#{assertion}],
228
+ %W[refute_matches_#{assertion} wont_match_#{assertion}]]
229
+ end).each do |(meth, new_name)|
230
+ class_eval <<-ASSERTION, __FILE__, __LINE__ + 1
231
+ def #{new_name} *args, &block
232
+ ::Minitest::Expectation.new(self, ::Minitest::Spec.current).#{new_name}(*args, &block)
233
+ end
234
+ ASSERTION
235
+
236
+ ::Minitest::Expectation.class_eval <<-ASSERTION, __FILE__, __LINE__ + 1
237
+ def #{new_name} *args, &block
238
+ ctx.#{meth}(target, *args, &block)
239
+ end
240
+ ASSERTION
241
+ end
242
+ # rubocop:enable Style/MultilineBlockChain
243
+
244
+ ##
245
+ # @deprecated
246
+ def must_have_style(*args, &block)
247
+ warn 'must_have_style is deprecated, please use must_match_style'
248
+ must_match_style(*args, &block)
249
+ end
194
250
  end
195
251
  end
196
252
  end
@@ -165,6 +165,7 @@ module Capybara
165
165
  # offset will be from the element center, otherwise it will be from the top left corner of the element
166
166
  # @option options [Integer] y Y coordinate to offset the click location. If {Capybara.configure w3c_click_offset} is `true` the
167
167
  # offset will be from the element center, otherwise it will be from the top left corner of the element
168
+ # @option options [Float] delay Delay between the mouse down and mouse up events in seconds (0)
168
169
  # @return [Capybara::Node::Element] The element
169
170
  def click(*keys, **options)
170
171
  perform_click_action(keys, **options) do |k, opts|
@@ -178,6 +179,7 @@ module Capybara
178
179
  #
179
180
  # @macro action_waiting_behavior
180
181
  # @macro click_modifiers
182
+ # @option options [Float] delay Delay between the mouse down and mouse up events in seconds (0)
181
183
  # @return [Capybara::Node::Element] The element
182
184
  def right_click(*keys, **options)
183
185
  perform_click_action(keys, **options) do |k, opts|
@@ -30,7 +30,9 @@ class Capybara::RackTest::Browser
30
30
 
31
31
  def submit(method, path, attributes)
32
32
  path = request_path if path.nil? || path.empty?
33
- process_and_follow_redirects(method, path, attributes, 'HTTP_REFERER' => current_url)
33
+ uri = build_uri(path)
34
+ uri.query = '' if method&.to_s&.downcase == 'get'
35
+ process_and_follow_redirects(method, uri.to_s, attributes, 'HTTP_REFERER' => current_url)
34
36
  end
35
37
 
36
38
  def follow(method, path, **attributes)
@@ -63,6 +63,7 @@ module Capybara
63
63
  # idx.max is broken with beginless ranges
64
64
  # idx.end && idx.max # endless range will have end == nil
65
65
  max = idx.end
66
+ max = nil if max&.negative?
66
67
  max -= 1 if max && idx.exclude_end?
67
68
  max
68
69
  end
@@ -2,17 +2,17 @@
2
2
 
3
3
  module Capybara
4
4
  module RSpecMatcherProxies
5
- def all(*args, &block)
5
+ def all(*args, **kwargs, &block)
6
6
  if defined?(::RSpec::Matchers::BuiltIn::All) && args.first.respond_to?(:matches?)
7
7
  ::RSpec::Matchers::BuiltIn::All.new(*args)
8
8
  else
9
- find_all(*args, &block)
9
+ find_all(*args, **kwargs, &block)
10
10
  end
11
11
  end
12
12
 
13
- def within(*args, &block)
13
+ def within(*args, **kwargs, &block)
14
14
  if block_given?
15
- within_element(*args, &block)
15
+ within_element(*args, **kwargs, &block)
16
16
  else
17
17
  be_within(*args)
18
18
  end
@@ -1 +1 @@
1
- (function(){function u(e){var t=e.tagName.toUpperCase();if("OPTION"==t)return!0;if("INPUT"!=t)return!1;var r=e.type.toLowerCase();return"checkbox"==r||"radio"==r}function s(e){var t="selected",r=e.type&&e.type.toLowerCase();return"checkbox"!=r&&"radio"!=r||(t="checked"),!!e[t]}function c(e,t){var r=e.getAttributeNode(t);return r&&r.specified?r.value:null}var i=["allowfullscreen","allowpaymentrequest","allowusermedia","async","autofocus","autoplay","checked","compact","complete","controls","declare","default","defaultchecked","defaultselected","defer","disabled","ended","formnovalidate","hidden","indeterminate","iscontenteditable","ismap","itemscope","loop","multiple","muted","nohref","nomodule","noresize","noshade","novalidate","nowrap","open","paused","playsinline","pubdate","readonly","required","reversed","scoped","seamless","seeking","selected","truespeed","typemustmatch","willvalidate"],d={"class":"className",readonly:"readOnly"};return function f(e,t){var r=null,a=t.toLowerCase();if("style"==a)return(r=e.style)&&"string"!=typeof r&&(r=r.cssText),r;if(("selected"==a||"checked"==a)&&u(e))return s(e)?"true":null;if(tagName=e.tagName.toUpperCase(),"IMG"==tagName&&"src"==a||"A"==tagName&&"href"==a)return(r=c(e,a))&&(r=e[a]),r;if("spellcheck"==a){if(null===!(r=c(e,a))){if("false"==r.toLowerCase())return"false";if("true"==r.toLowerCase())return"true"}return e[a]+""}var l,n=d[t]||t;if(i.some(function(e){e==a}))return(r=!(null===(r=c(e,a)))||e[n])?"true":null;try{l=e[n]}catch(o){}return null!=(r=null==l||"object"==typeof l||"function"==typeof l?c(e,t):l)?r.toString():null}})()
1
+ (function(){function u(e){var t=e.tagName.toUpperCase();if("OPTION"==t)return!0;if("INPUT"!=t)return!1;var r=e.type.toLowerCase();return"checkbox"==r||"radio"==r}function s(e){var t="selected",r=e.type&&e.type.toLowerCase();return"checkbox"!=r&&"radio"!=r||(t="checked"),!!e[t]}function c(e,t){var r=e.getAttributeNode(t);return r&&r.specified?r.value:null}var i=["allowfullscreen","allowpaymentrequest","allowusermedia","async","autofocus","autoplay","checked","compact","complete","controls","declare","default","defaultchecked","defaultselected","defer","disabled","ended","formnovalidate","hidden","indeterminate","iscontenteditable","ismap","itemscope","loop","multiple","muted","nohref","nomodule","noresize","noshade","novalidate","nowrap","open","paused","playsinline","pubdate","readonly","required","reversed","scoped","seamless","seeking","selected","truespeed","typemustmatch","willvalidate"],d={"class":"className",readonly:"readOnly"};return function f(e,t){var r=null,a=t.toLowerCase();if("style"==a)return(r=e.style)&&"string"!=typeof r&&(r=r.cssText),r;if(("selected"==a||"checked"==a)&&u(e))return s(e)?"true":null;if(tagName=e.tagName.toUpperCase(),"IMG"==tagName&&"src"==a||"A"==tagName&&"href"==a)return(r=c(e,a))&&(r=e[a]),r;if("spellcheck"==a){if(null!==(r=c(e,a))){if("false"==r.toLowerCase())return"false";if("true"==r.toLowerCase())return"true"}return e[a]+""}var l,n=d[t]||t;if(i.some(function(e){e==a}))return(r=!(null===(r=c(e,a)))||e[n])?"true":null;try{l=e[n]}catch(o){}return null!=(r=null==l||"object"==typeof l||"function"==typeof l?c(e,t):l)?r.toString():null}})()
@@ -117,7 +117,7 @@
117
117
 
118
118
  if ("spellcheck" == name) {
119
119
  value = getAttributeValue(element, name);
120
- if (!value === null) {
120
+ if (!(value === null)) {
121
121
  if (value.toLowerCase() == "false") {
122
122
  return "false";
123
123
  } else if (value.toLowerCase() == "true") {
@@ -20,6 +20,7 @@ class Capybara::Selenium::Driver < Capybara::Driver::Base
20
20
  require 'capybara/selenium/logger_suppressor'
21
21
  require 'capybara/selenium/patches/atoms'
22
22
  require 'capybara/selenium/patches/is_displayed'
23
+ require 'capybara/selenium/patches/action_pauser'
23
24
  if Gem.loaded_specs['selenium-webdriver'].version < Gem::Version.new('3.5.0')
24
25
  warn "Warning: You're using an unsupported version of selenium-webdriver, please upgrade."
25
26
  end
@@ -104,7 +104,20 @@ class Capybara::Selenium::Node < Capybara::Driver::Node
104
104
  click_options = ClickOptions.new(keys, options)
105
105
  return native.click if click_options.empty?
106
106
 
107
- click_with_options(click_options)
107
+ perform_with_options(click_options) do |action|
108
+ target = click_options.coords? ? nil : native
109
+ if click_options.delay.zero?
110
+ action.click(target)
111
+ else
112
+ action.click_and_hold(target)
113
+ if w3c?
114
+ action.pause(action.pointer_inputs.first, click_options.delay)
115
+ else
116
+ action.pause(click_options.delay)
117
+ end
118
+ action.release
119
+ end
120
+ end
108
121
  rescue StandardError => e
109
122
  if e.is_a?(::Selenium::WebDriver::Error::ElementClickInterceptedError) ||
110
123
  e.message.match?(/Other element would receive the click/)
@@ -116,14 +129,26 @@ class Capybara::Selenium::Node < Capybara::Driver::Node
116
129
 
117
130
  def right_click(keys = [], **options)
118
131
  click_options = ClickOptions.new(keys, options)
119
- click_with_options(click_options) do |action|
120
- click_options.coords? ? action.context_click : action.context_click(native)
132
+ perform_with_options(click_options) do |action|
133
+ target = click_options.coords? ? nil : native
134
+ if click_options.delay.zero?
135
+ action.context_click(target)
136
+ elsif w3c?
137
+ action.move_to(target) if target
138
+ action.pointer_down(:right)
139
+ .pause(action.pointer_inputs.first, click_options.delay)
140
+ .pointer_up(:right)
141
+ else
142
+ raise ArgumentError, 'Delay is not supported when right clicking with legacy (non-w3c) selenium driver'
143
+ end
121
144
  end
122
145
  end
123
146
 
124
147
  def double_click(keys = [], **options)
125
148
  click_options = ClickOptions.new(keys, options)
126
- click_with_options(click_options) do |action|
149
+ raise ArgumentError, "double_click doesn't support a delay option" unless click_options.delay.zero?
150
+
151
+ perform_with_options(click_options) do |action|
127
152
  click_options.coords? ? action.double_click : action.double_click(native)
128
153
  end
129
154
  end
@@ -242,7 +267,7 @@ private
242
267
  find_xpath(XPath.ancestor(:select)[1]).first
243
268
  end
244
269
 
245
- def set_text(value, clear: nil, **_unused)
270
+ def set_text(value, clear: nil, rapid: nil, **_unused)
246
271
  value = value.to_s
247
272
  if value.empty? && clear.nil?
248
273
  native.clear
@@ -254,11 +279,19 @@ private
254
279
  send_keys(*clear, value)
255
280
  else
256
281
  driver.execute_script 'arguments[0].select()', self unless clear == :none
257
- send_keys(value)
282
+ if rapid == true || (value.length > 30 && rapid != false)
283
+ send_keys(value[0..3])
284
+ driver.execute_script 'arguments[0].value += arguments[1]', self, value[4...-3]
285
+ send_keys(value[-3..-1])
286
+ else
287
+ send_keys(value)
288
+ end
258
289
  end
259
290
  end
260
291
 
261
- def click_with_options(click_options)
292
+ def perform_with_options(click_options, &block)
293
+ raise ArgumentError, 'A block must be provided' unless block
294
+
262
295
  scroll_if_needed do
263
296
  action_with_modifiers(click_options) do |action|
264
297
  if block_given?
@@ -407,6 +440,15 @@ private
407
440
  browser.action
408
441
  end
409
442
 
443
+ def capabilities
444
+ browser.capabilities
445
+ end
446
+
447
+ def w3c?
448
+ (defined?(Selenium::WebDriver::VERSION) && (Selenium::WebDriver::VERSION.to_f >= 4)) ||
449
+ capabilities.is_a?(::Selenium::WebDriver::Remote::W3C::Capabilities)
450
+ end
451
+
410
452
  def normalize_keys(keys)
411
453
  keys.map do |key|
412
454
  case key
@@ -544,7 +586,11 @@ private
544
586
  end
545
587
 
546
588
  def empty?
547
- keys.empty? && !coords?
589
+ keys.empty? && !coords? && delay.zero?
590
+ end
591
+
592
+ def delay
593
+ options[:delay] || 0
548
594
  end
549
595
  end
550
596
  private_constant :ClickOptions