watir 6.0.3 → 6.1.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,7 +5,7 @@ module Watir
5
5
  attribute(String, :style, :style)
6
6
  attribute(String, :ownersvg_element, :ownerSVGElement)
7
7
  attribute(String, :viewport_element, :viewportElement)
8
- attribute(Fixnum, :tab_index, :tabIndex)
8
+ attribute(Integer, :tab_index, :tabIndex)
9
9
  end
10
10
  class SVGElementCollection < ElementCollection
11
11
  end
@@ -52,14 +52,14 @@ module Watir
52
52
  attribute(String, :view_target, :viewTarget)
53
53
  attribute(String, :view_box, :viewBox)
54
54
  attribute(String, :preserve_aspect_ratio, :preserveAspectRatio)
55
- attribute(Fixnum, :zoom_and_pan, :zoomAndPan)
55
+ attribute(Integer, :zoom_and_pan, :zoomAndPan)
56
56
  end
57
57
  class ViewCollection < ElementCollection
58
58
  end
59
59
 
60
60
  class Cursor < SVGElement
61
- attribute(Fixnum, :x, :x)
62
- attribute(Fixnum, :y, :y)
61
+ attribute(Integer, :x, :x)
62
+ attribute(Integer, :y, :y)
63
63
  attribute(String, :href, :href)
64
64
  end
65
65
  class CursorCollection < ElementCollection
@@ -69,10 +69,10 @@ module Watir
69
69
  attribute(String, :pattern_units, :patternUnits)
70
70
  attribute(String, :pattern_content_units, :patternContentUnits)
71
71
  attribute(String, :pattern_transform, :patternTransform)
72
- attribute(Fixnum, :x, :x)
73
- attribute(Fixnum, :y, :y)
74
- attribute(Fixnum, :width, :width)
75
- attribute(Fixnum, :height, :height)
72
+ attribute(Integer, :x, :x)
73
+ attribute(Integer, :y, :y)
74
+ attribute(Integer, :width, :width)
75
+ attribute(Integer, :height, :height)
76
76
  attribute(String, :view_box, :viewBox)
77
77
  attribute(String, :preserve_aspect_ratio, :preserveAspectRatio)
78
78
  attribute(String, :href, :href)
@@ -106,38 +106,38 @@ module Watir
106
106
  end
107
107
 
108
108
  class MeshGradient < Gradient
109
- attribute(Fixnum, :x, :x)
110
- attribute(Fixnum, :y, :y)
109
+ attribute(Integer, :x, :x)
110
+ attribute(Integer, :y, :y)
111
111
  end
112
112
  class MeshGradientCollection < ElementCollection
113
113
  end
114
114
 
115
115
  class RadialGradient < Gradient
116
- attribute(Fixnum, :cx, :cx)
117
- attribute(Fixnum, :cy, :cy)
118
- attribute(Fixnum, :r, :r)
119
- attribute(Fixnum, :fx, :fx)
120
- attribute(Fixnum, :fy, :fy)
121
- attribute(Fixnum, :fr, :fr)
116
+ attribute(Integer, :cx, :cx)
117
+ attribute(Integer, :cy, :cy)
118
+ attribute(Integer, :r, :r)
119
+ attribute(Integer, :fx, :fx)
120
+ attribute(Integer, :fy, :fy)
121
+ attribute(Integer, :fr, :fr)
122
122
  end
123
123
  class RadialGradientCollection < ElementCollection
124
124
  end
125
125
 
126
126
  class LinearGradient < Gradient
127
- attribute(Fixnum, :x1, :x1)
128
- attribute(Fixnum, :y1, :y1)
129
- attribute(Fixnum, :x2, :x2)
130
- attribute(Fixnum, :y2, :y2)
127
+ attribute(Integer, :x1, :x1)
128
+ attribute(Integer, :y1, :y1)
129
+ attribute(Integer, :x2, :x2)
130
+ attribute(Integer, :y2, :y2)
131
131
  end
132
132
  class LinearGradientCollection < ElementCollection
133
133
  end
134
134
 
135
135
  class Marker < SVGElement
136
- attribute(Fixnum, :refx, :refX)
137
- attribute(Fixnum, :refy, :refY)
136
+ attribute(Integer, :refx, :refX)
137
+ attribute(Integer, :refy, :refY)
138
138
  attribute(String, :marker_units, :markerUnits)
139
- attribute(Fixnum, :marker_width, :markerWidth)
140
- attribute(Fixnum, :marker_height, :markerHeight)
139
+ attribute(Integer, :marker_width, :markerWidth)
140
+ attribute(Integer, :marker_height, :markerHeight)
141
141
  attribute(String, :orient_type, :orientType)
142
142
  attribute(String, :orient_angle, :orientAngle)
143
143
  attribute(String, :orient, :orient)
@@ -174,23 +174,23 @@ module Watir
174
174
  end
175
175
 
176
176
  class ForeignObject < Graphics
177
- attribute(Fixnum, :x, :x)
178
- attribute(Fixnum, :y, :y)
179
- attribute(Fixnum, :width, :width)
180
- attribute(Fixnum, :height, :height)
177
+ attribute(Integer, :x, :x)
178
+ attribute(Integer, :y, :y)
179
+ attribute(Integer, :width, :width)
180
+ attribute(Integer, :height, :height)
181
181
  end
182
182
  class ForeignObjectCollection < ElementCollection
183
183
  end
184
184
 
185
185
  class TextContent < Graphics
186
- attribute(Fixnum, :text_length, :textLength)
186
+ attribute(Integer, :text_length, :textLength)
187
187
  attribute(String, :length_adjust, :lengthAdjust)
188
188
  end
189
189
  class TextContentCollection < ElementCollection
190
190
  end
191
191
 
192
192
  class TextPath < TextContent
193
- attribute(Fixnum, :start_offset, :startOffset)
193
+ attribute(Integer, :start_offset, :startOffset)
194
194
  attribute(String, :method, :method)
195
195
  attribute(String, :spacing, :spacing)
196
196
  attribute(String, :href, :href)
@@ -221,10 +221,10 @@ module Watir
221
221
  end
222
222
 
223
223
  class Use < Graphics
224
- attribute(Fixnum, :x, :x)
225
- attribute(Fixnum, :y, :y)
226
- attribute(Fixnum, :width, :width)
227
- attribute(Fixnum, :height, :height)
224
+ attribute(Integer, :x, :x)
225
+ attribute(Integer, :y, :y)
226
+ attribute(Integer, :width, :width)
227
+ attribute(Integer, :height, :height)
228
228
  attribute(String, :href, :href)
229
229
  end
230
230
  class UseCollection < ElementCollection
@@ -241,10 +241,10 @@ module Watir
241
241
  end
242
242
 
243
243
  class SVG < Graphics
244
- attribute(Fixnum, :x, :x)
245
- attribute(Fixnum, :y, :y)
246
- attribute(Fixnum, :width, :width)
247
- attribute(Fixnum, :height, :height)
244
+ attribute(Integer, :x, :x)
245
+ attribute(Integer, :y, :y)
246
+ attribute(Integer, :width, :width)
247
+ attribute(Integer, :height, :height)
248
248
  attribute(String, :viewport, :viewport)
249
249
  attribute("Boolean", :use_current_view?, :useCurrentView)
250
250
  attribute(String, :current_view, :currentView)
@@ -252,7 +252,7 @@ module Watir
252
252
  attribute(String, :current_translate, :currentTranslate)
253
253
  attribute(String, :view_box, :viewBox)
254
254
  attribute(String, :preserve_aspect_ratio, :preserveAspectRatio)
255
- attribute(Fixnum, :zoom_and_pan, :zoomAndPan)
255
+ attribute(Integer, :zoom_and_pan, :zoomAndPan)
256
256
  end
257
257
  class SVGCollection < ElementCollection
258
258
  end
@@ -277,38 +277,38 @@ module Watir
277
277
  end
278
278
 
279
279
  class Line < Geometry
280
- attribute(Fixnum, :x1, :x1)
281
- attribute(Fixnum, :y1, :y1)
282
- attribute(Fixnum, :x2, :x2)
283
- attribute(Fixnum, :y2, :y2)
280
+ attribute(Integer, :x1, :x1)
281
+ attribute(Integer, :y1, :y1)
282
+ attribute(Integer, :x2, :x2)
283
+ attribute(Integer, :y2, :y2)
284
284
  end
285
285
  class LineCollection < ElementCollection
286
286
  end
287
287
 
288
288
  class Ellipse < Geometry
289
- attribute(Fixnum, :cx, :cx)
290
- attribute(Fixnum, :cy, :cy)
291
- attribute(Fixnum, :rx, :rx)
292
- attribute(Fixnum, :ry, :ry)
289
+ attribute(Integer, :cx, :cx)
290
+ attribute(Integer, :cy, :cy)
291
+ attribute(Integer, :rx, :rx)
292
+ attribute(Integer, :ry, :ry)
293
293
  end
294
294
  class EllipseCollection < ElementCollection
295
295
  end
296
296
 
297
297
  class Circle < Geometry
298
- attribute(Fixnum, :cx, :cx)
299
- attribute(Fixnum, :cy, :cy)
300
- attribute(Fixnum, :r, :r)
298
+ attribute(Integer, :cx, :cx)
299
+ attribute(Integer, :cy, :cy)
300
+ attribute(Integer, :r, :r)
301
301
  end
302
302
  class CircleCollection < ElementCollection
303
303
  end
304
304
 
305
305
  class Rect < Geometry
306
- attribute(Fixnum, :x, :x)
307
- attribute(Fixnum, :y, :y)
308
- attribute(Fixnum, :width, :width)
309
- attribute(Fixnum, :height, :height)
310
- attribute(Fixnum, :rx, :rx)
311
- attribute(Fixnum, :ry, :ry)
306
+ attribute(Integer, :x, :x)
307
+ attribute(Integer, :y, :y)
308
+ attribute(Integer, :width, :width)
309
+ attribute(Integer, :height, :height)
310
+ attribute(Integer, :rx, :rx)
311
+ attribute(Integer, :ry, :ry)
312
312
  end
313
313
  class RectCollection < ElementCollection
314
314
  end
@@ -30,7 +30,7 @@ module Watir
30
30
  #
31
31
  # Returns row of this table with given index.
32
32
  #
33
- # @param [Fixnum] idx
33
+ # @param [Integer] idx
34
34
  # @return Watir::Row
35
35
  #
36
36
 
@@ -5,7 +5,7 @@ module Watir
5
5
  #
6
6
  # Returns table section row with given index.
7
7
  #
8
- # @param [Fixnum] idx
8
+ # @param [Integer] idx
9
9
  #
10
10
 
11
11
  def [](idx)
@@ -133,7 +133,7 @@ module Watir
133
133
  String
134
134
  when 'UnsignedLong', 'Long', 'Integer', 'Short', 'UnsignedShort',
135
135
  'SVGAnimatedLength'
136
- Fixnum
136
+ Integer
137
137
  when 'Float', /.*Double$/
138
138
  Float
139
139
  when 'Boolean'
@@ -74,7 +74,7 @@ module Watir
74
74
  # browser.text_field(name: "new_user_first_name").when_present { |field| field.set "Watir" }
75
75
  # browser.text_field(name: "new_user_first_name").when_present(60).text
76
76
  #
77
- # @param [Fixnum] timeout seconds to wait before timing out
77
+ # @param [Integer] timeout seconds to wait before timing out
78
78
  #
79
79
  # @see Watir::Wait
80
80
  # @see Watir::Element#present?
@@ -102,7 +102,7 @@ module Watir
102
102
  # @example
103
103
  # browser.button(name: "new_user_button_2").when_enabled.click
104
104
  #
105
- # @param [Fixnum] timeout seconds to wait before timing out
105
+ # @param [Integer] timeout seconds to wait before timing out
106
106
  #
107
107
  # @see Watir::Wait
108
108
  # @see Watir::Element#enabled?
@@ -132,17 +132,20 @@ module Watir
132
132
 
133
133
  def find_all_by_multiple
134
134
  selector = selector_builder.normalized_selector
135
+ visible = selector.delete(:visible)
135
136
 
136
137
  if selector.key? :index
137
138
  raise ArgumentError, "can't locate all elements by :index"
138
139
  end
139
140
 
140
141
  how, what = selector_builder.build(selector)
141
- if how
142
- @query_scope.wd.find_elements(how, what)
143
- else
144
- wd_find_by_regexp_selector(selector, :select)
145
- end
142
+ found = if how
143
+ @query_scope.wd.find_elements(how, what)
144
+ else
145
+ wd_find_by_regexp_selector(selector, :select)
146
+ end
147
+ found.select! { |el| el.displayed? == visible } unless visible.nil?
148
+ found
146
149
  end
147
150
 
148
151
  def wd_find_all_by(how, what)
@@ -27,8 +27,8 @@ module Watir
27
27
  def check_type(how, what)
28
28
  case how
29
29
  when :index
30
- unless what.is_a?(Fixnum)
31
- raise TypeError, "expected Fixnum, got #{what.inspect}:#{what.class}"
30
+ unless what.is_a?(Integer)
31
+ raise TypeError, "expected Integer, got #{what.inspect}:#{what.class}"
32
32
  end
33
33
  when :visible
34
34
  unless what.is_a?(TrueClass) || what.is_a?(FalseClass)
@@ -29,20 +29,20 @@ module Watir
29
29
  # @example
30
30
  # Watir::Wait.until { browser.text_field(name: "new_user_first_name").visible? }
31
31
  #
32
- # @param [Fixnum] timeout How long to wait in seconds
32
+ # @param [Integer] timeout How long to wait in seconds
33
33
  # @param [String] message Message to raise if timeout is exceeded
34
34
  # @param [Object, NilClass] object Object to evaluate block against
35
35
  # @raise [TimeoutError] if timeout is exceeded
36
36
  #
37
37
 
38
- def until(deprecated_timeout = nil, deprecated_message = nil, timeout: nil, message: nil, object: nil)
38
+ def until(deprecated_timeout = nil, deprecated_message = nil, timeout: nil, message: nil, interval: nil, object: nil)
39
39
  if deprecated_message || deprecated_timeout
40
40
  warn "Instead of passing arguments into Wait#until method, use keywords"
41
41
  timeout = deprecated_timeout
42
42
  message = deprecated_message
43
43
  end
44
44
  timeout ||= Watir.default_timeout
45
- run_with_timer(timeout) do
45
+ run_with_timer(timeout, interval) do
46
46
  result = yield(object)
47
47
  return result if result
48
48
  end
@@ -55,20 +55,20 @@ module Watir
55
55
  # @example
56
56
  # Watir::Wait.while { browser.text_field(name: "abrakadbra").present? }
57
57
  #
58
- # @param [Fixnum] timeout How long to wait in seconds
58
+ # @param [Integer] timeout How long to wait in seconds
59
59
  # @param [String] message Message to raise if timeout is exceeded
60
60
  # @param [Object, NilClass] object Object to evaluate block against
61
61
  # @raise [TimeoutError] if timeout is exceeded
62
62
  #
63
63
 
64
- def while(deprecated_timeout = nil, deprecated_message = nil, timeout: nil, message: nil, object: nil)
64
+ def while(deprecated_timeout = nil, deprecated_message = nil, timeout: nil, message: nil, interval: nil, object: nil)
65
65
  if deprecated_message || deprecated_timeout
66
66
  warn "Instead of passing arguments into Wait#while method, use keywords"
67
67
  timeout = deprecated_timeout
68
68
  message = deprecated_message
69
69
  end
70
70
  timeout ||= Watir.default_timeout
71
- run_with_timer(timeout) { return unless yield(object) }
71
+ run_with_timer(timeout, interval) { return unless yield(object) }
72
72
  raise TimeoutError, message_for(timeout, message)
73
73
  end
74
74
 
@@ -81,13 +81,13 @@ module Watir
81
81
  err
82
82
  end
83
83
 
84
- def run_with_timer(timeout, &block)
84
+ def run_with_timer(timeout, interval, &block)
85
85
  if timeout.zero?
86
86
  block.call
87
87
  else
88
88
  timer.wait(timeout) do
89
89
  block.call
90
- sleep INTERVAL
90
+ sleep interval || INTERVAL
91
91
  end
92
92
  end
93
93
  end
@@ -111,18 +111,18 @@ module Watir
111
111
  # browser.text_field(name: "new_user_first_name").wait_until(message: 'foo') { |field| field.present? }
112
112
  # browser.text_field(name: "new_user_first_name").wait_until(timeout: 60, &:present?)
113
113
  #
114
- # @param [Fixnum] timeout seconds to wait before timing out
114
+ # @param [Integer] timeout seconds to wait before timing out
115
115
  # @param [String] message error message for when times out
116
116
  #
117
117
 
118
- def wait_until(deprecated_timeout = nil, deprecated_message = nil, timeout: nil, message: nil, &blk)
118
+ def wait_until(deprecated_timeout = nil, deprecated_message = nil, timeout: nil, message: nil, interval: nil, &blk)
119
119
  if deprecated_message || deprecated_timeout
120
120
  warn "Instead of passing arguments into #wait_until, use keywords"
121
121
  timeout = deprecated_timeout
122
122
  message = deprecated_message
123
123
  end
124
124
  message ||= "waiting for true condition on #{selector_string}"
125
- Wait.until(timeout: timeout, message: message, object: self, &blk)
125
+ Wait.until(timeout: timeout, message: message, interval: interval, object: self, &blk)
126
126
 
127
127
  self
128
128
  end
@@ -137,18 +137,18 @@ module Watir
137
137
  #
138
138
  # @todo add element example
139
139
  #
140
- # @param [Fixnum] timeout seconds to wait before timing out
140
+ # @param [Integer] timeout seconds to wait before timing out
141
141
  # @param [String] message error message for when times out
142
142
  #
143
143
 
144
- def wait_while(deprecated_timeout = nil, deprecated_message = nil, timeout: nil, message: nil, &blk)
144
+ def wait_while(deprecated_timeout = nil, deprecated_message = nil, timeout: nil, message: nil, interval: nil, &blk)
145
145
  if deprecated_message || deprecated_timeout
146
146
  warn "Instead of passing arguments into #wait_while method, use keywords"
147
147
  timeout = deprecated_timeout
148
148
  message = deprecated_message
149
149
  end
150
150
  message ||= "waiting for false condition on #{selector_string}"
151
- Wait.while(timeout: timeout, message: message, object: self, &blk)
151
+ Wait.while(timeout: timeout, message: message, interval: interval, object: self, &blk)
152
152
 
153
153
  self
154
154
  end
@@ -159,18 +159,18 @@ module Watir
159
159
  # @example
160
160
  # browser.text_field(name: "new_user_first_name").wait_until_present
161
161
  #
162
- # @param [Fixnum] timeout seconds to wait before timing out
162
+ # @param [Integer] timeout seconds to wait before timing out
163
163
  #
164
164
  # @see Watir::Wait
165
165
  # @see Watir::Element#present?
166
166
  #
167
167
 
168
- def wait_until_present(deprecated_timeout = nil, timeout: nil)
168
+ def wait_until_present(deprecated_timeout = nil, timeout: nil, interval: nil)
169
169
  if deprecated_timeout
170
170
  warn "Instead of passing arguments into #wait_until_present method, use keywords"
171
171
  timeout = deprecated_timeout
172
172
  end
173
- wait_until(timeout: timeout, &:present?)
173
+ wait_until(timeout: timeout, interval: interval, &:present?)
174
174
  end
175
175
 
176
176
  #
@@ -179,7 +179,7 @@ module Watir
179
179
  # @example
180
180
  # browser.text_field(name: "abrakadbra").wait_while_present
181
181
  #
182
- # @param [Fixnum] timeout seconds to wait before timing out
182
+ # @param [Integer] timeout seconds to wait before timing out
183
183
  #
184
184
  # @see Watir::Wait
185
185
  # @see Watir::Element#present?
@@ -8,7 +8,7 @@ module Watir
8
8
 
9
9
  #
10
10
  # Executes given block until it returns true or exceeds timeout.
11
- # @param [Fixnum] timeout
11
+ # @param [Integer] timeout
12
12
  # @yield block
13
13
  # @api private
14
14
  #