watir-webdriver 0.9.1 → 0.9.2
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.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/.travis.yml +7 -3
- data/CHANGES.md +6 -0
- data/Rakefile +17 -5
- data/lib/watir-webdriver.rb +16 -6
- data/lib/watir-webdriver/after_hooks.rb +2 -2
- data/lib/watir-webdriver/browser.rb +5 -5
- data/lib/watir-webdriver/cell_container.rb +4 -10
- data/lib/watir-webdriver/element_collection.rb +28 -7
- data/lib/watir-webdriver/elements/button.rb +0 -18
- data/lib/watir-webdriver/elements/cell.rb +17 -0
- data/lib/watir-webdriver/elements/checkbox.rb +0 -3
- data/lib/watir-webdriver/elements/element.rb +37 -10
- data/lib/watir-webdriver/elements/file_field.rb +0 -3
- data/lib/watir-webdriver/elements/hidden.rb +0 -3
- data/lib/watir-webdriver/elements/html_elements.rb +0 -219
- data/lib/watir-webdriver/elements/iframe.rb +29 -19
- data/lib/watir-webdriver/elements/row.rb +17 -0
- data/lib/watir-webdriver/elements/svg_elements.rb +0 -120
- data/lib/watir-webdriver/elements/table.rb +1 -1
- data/lib/watir-webdriver/elements/table_cell.rb +0 -28
- data/lib/watir-webdriver/elements/table_row.rb +1 -30
- data/lib/watir-webdriver/elements/text_area.rb +0 -17
- data/lib/watir-webdriver/elements/text_field.rb +2 -8
- data/lib/watir-webdriver/generator/base/visitor.rb +1 -10
- data/lib/watir-webdriver/locators.rb +22 -0
- data/lib/watir-webdriver/locators/button/locator.rb +38 -0
- data/lib/watir-webdriver/locators/button/selector_builder.rb +27 -0
- data/lib/watir-webdriver/locators/button/selector_builder/xpath.rb +29 -0
- data/lib/watir-webdriver/locators/button/validator.rb +14 -0
- data/lib/watir-webdriver/locators/cell/locator.rb +17 -0
- data/lib/watir-webdriver/locators/cell/selector_builder.rb +24 -0
- data/lib/watir-webdriver/locators/element/locator.rb +249 -0
- data/lib/watir-webdriver/locators/element/selector_builder.rb +147 -0
- data/lib/watir-webdriver/locators/element/selector_builder/css.rb +65 -0
- data/lib/watir-webdriver/locators/element/selector_builder/xpath.rb +72 -0
- data/lib/watir-webdriver/locators/element/validator.rb +22 -0
- data/lib/watir-webdriver/locators/row/locator.rb +17 -0
- data/lib/watir-webdriver/locators/row/selector_builder.rb +29 -0
- data/lib/watir-webdriver/locators/text_area/locator.rb +13 -0
- data/lib/watir-webdriver/locators/text_area/selector_builder.rb +22 -0
- data/lib/watir-webdriver/locators/text_field/locator.rb +42 -0
- data/lib/watir-webdriver/locators/text_field/selector_builder.rb +34 -0
- data/lib/watir-webdriver/locators/text_field/selector_builder/xpath.rb +19 -0
- data/lib/watir-webdriver/locators/text_field/validator.rb +20 -0
- data/lib/watir-webdriver/row_container.rb +3 -9
- data/lib/watir-webdriver/version.rb +1 -1
- data/lib/watir-webdriver/wait.rb +6 -3
- data/spec/always_locate_spec.rb +2 -1
- data/spec/element_locator_spec.rb +1 -1
- data/spec/element_spec.rb +8 -40
- data/spec/implementation.rb +52 -45
- data/spec/locator_spec_helper.rb +8 -2
- data/support/travis.sh +17 -6
- metadata +25 -10
- data/lib/watir-webdriver/locators/button_locator.rb +0 -85
- data/lib/watir-webdriver/locators/child_cell_locator.rb +0 -32
- data/lib/watir-webdriver/locators/child_row_locator.rb +0 -37
- data/lib/watir-webdriver/locators/element_locator.rb +0 -470
- data/lib/watir-webdriver/locators/text_area_locator.rb +0 -24
- data/lib/watir-webdriver/locators/text_field_locator.rb +0 -93
@@ -4,7 +4,11 @@ module Watir
|
|
4
4
|
def locate
|
5
5
|
@parent.assert_exists
|
6
6
|
|
7
|
-
|
7
|
+
selector = @selector.merge(tag_name: frame_tag)
|
8
|
+
element_validator = element_validator_class.new
|
9
|
+
selector_builder = selector_builder_class.new(@parent, selector, self.class.attribute_list)
|
10
|
+
locator = locator_class.new(@parent, selector, selector_builder, element_validator)
|
11
|
+
|
8
12
|
element = locator.locate
|
9
13
|
element or raise UnknownFrameException, "unable to locate #{@selector[:tag_name]} using #{selector_string}"
|
10
14
|
|
@@ -23,12 +27,25 @@ module Watir
|
|
23
27
|
super
|
24
28
|
end
|
25
29
|
|
30
|
+
#
|
31
|
+
# Returns text of iframe body.
|
32
|
+
#
|
33
|
+
# @return [String]
|
34
|
+
#
|
35
|
+
|
36
|
+
def text
|
37
|
+
body.text
|
38
|
+
end
|
39
|
+
|
40
|
+
#
|
41
|
+
# Returns HTML code of iframe.
|
42
|
+
#
|
43
|
+
# @return [String]
|
44
|
+
#
|
45
|
+
|
26
46
|
def html
|
27
47
|
assert_exists
|
28
|
-
|
29
|
-
# this will actually give us the innerHTML instead of the outerHTML of the <frame>,
|
30
|
-
# but given the choice this seems more useful
|
31
|
-
element_call { execute_atom(:getOuterHtml, @element.find_element(tag_name: "html")).strip }
|
48
|
+
wd.page_source
|
32
49
|
end
|
33
50
|
|
34
51
|
def execute_script(*args)
|
@@ -55,18 +72,16 @@ module Watir
|
|
55
72
|
element_indexes.map { |idx| element_class.new(@parent, tag_name: @selector[:tag_name], index: idx) }
|
56
73
|
end
|
57
74
|
|
58
|
-
def element_class
|
59
|
-
IFrame
|
60
|
-
end
|
61
|
-
|
62
75
|
private
|
63
76
|
|
64
77
|
def all_elements
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
)
|
78
|
+
selector = { tag_name: @selector[:tag_name] }
|
79
|
+
|
80
|
+
element_validator = element_validator_class.new
|
81
|
+
selector_builder = selector_builder_class.new(@parent, selector, element_class.attribute_list)
|
82
|
+
locator = locator_class.new(@parent, selector, selector_builder, element_validator)
|
83
|
+
|
84
|
+
locator.locate_all
|
70
85
|
end
|
71
86
|
|
72
87
|
end # IFrameCollection
|
@@ -84,11 +99,6 @@ module Watir
|
|
84
99
|
|
85
100
|
|
86
101
|
class FrameCollection < IFrameCollection
|
87
|
-
|
88
|
-
def element_class
|
89
|
-
Frame
|
90
|
-
end
|
91
|
-
|
92
102
|
end # FrameCollection
|
93
103
|
|
94
104
|
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Watir
|
2
|
+
|
3
|
+
#
|
4
|
+
# Custom class representing table row (tr).
|
5
|
+
#
|
6
|
+
|
7
|
+
class Row < TableRow
|
8
|
+
end # Row
|
9
|
+
|
10
|
+
class RowCollection < TableRowCollection
|
11
|
+
def elements
|
12
|
+
# we do this craziness since the xpath used will find direct child rows
|
13
|
+
# before any rows inside thead/tbody/tfoot...
|
14
|
+
super.sort_by { |e| e.attribute(:rowIndex).to_i }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end # Watir
|
@@ -8,18 +8,12 @@ module Watir
|
|
8
8
|
attribute(Fixnum, :tab_index, :tabIndex)
|
9
9
|
end
|
10
10
|
class SVGElementCollection < ElementCollection
|
11
|
-
def element_class
|
12
|
-
SVGElement
|
13
|
-
end
|
14
11
|
end
|
15
12
|
|
16
13
|
class MPath < SVGElement
|
17
14
|
attribute(String, :href, :href)
|
18
15
|
end
|
19
16
|
class MPathCollection < ElementCollection
|
20
|
-
def element_class
|
21
|
-
MPath
|
22
|
-
end
|
23
17
|
end
|
24
18
|
|
25
19
|
class Animation < SVGElement
|
@@ -32,41 +26,26 @@ module Watir
|
|
32
26
|
attribute(String, :system_language, :systemLanguage)
|
33
27
|
end
|
34
28
|
class AnimationCollection < ElementCollection
|
35
|
-
def element_class
|
36
|
-
Animation
|
37
|
-
end
|
38
29
|
end
|
39
30
|
|
40
31
|
class AnimateTransform < Animation
|
41
32
|
end
|
42
33
|
class AnimateTransformCollection < ElementCollection
|
43
|
-
def element_class
|
44
|
-
AnimateTransform
|
45
|
-
end
|
46
34
|
end
|
47
35
|
|
48
36
|
class AnimateMotion < Animation
|
49
37
|
end
|
50
38
|
class AnimateMotionCollection < ElementCollection
|
51
|
-
def element_class
|
52
|
-
AnimateMotion
|
53
|
-
end
|
54
39
|
end
|
55
40
|
|
56
41
|
class Set < Animation
|
57
42
|
end
|
58
43
|
class SetCollection < ElementCollection
|
59
|
-
def element_class
|
60
|
-
Set
|
61
|
-
end
|
62
44
|
end
|
63
45
|
|
64
46
|
class Animate < Animation
|
65
47
|
end
|
66
48
|
class AnimateCollection < ElementCollection
|
67
|
-
def element_class
|
68
|
-
Animate
|
69
|
-
end
|
70
49
|
end
|
71
50
|
|
72
51
|
class View < SVGElement
|
@@ -76,9 +55,6 @@ module Watir
|
|
76
55
|
attribute(Fixnum, :zoom_and_pan, :zoomAndPan)
|
77
56
|
end
|
78
57
|
class ViewCollection < ElementCollection
|
79
|
-
def element_class
|
80
|
-
View
|
81
|
-
end
|
82
58
|
end
|
83
59
|
|
84
60
|
class Cursor < SVGElement
|
@@ -87,9 +63,6 @@ module Watir
|
|
87
63
|
attribute(String, :href, :href)
|
88
64
|
end
|
89
65
|
class CursorCollection < ElementCollection
|
90
|
-
def element_class
|
91
|
-
Cursor
|
92
|
-
end
|
93
66
|
end
|
94
67
|
|
95
68
|
class Pattern < SVGElement
|
@@ -105,34 +78,22 @@ module Watir
|
|
105
78
|
attribute(String, :href, :href)
|
106
79
|
end
|
107
80
|
class PatternCollection < ElementCollection
|
108
|
-
def element_class
|
109
|
-
Pattern
|
110
|
-
end
|
111
81
|
end
|
112
82
|
|
113
83
|
class Stop < SVGElement
|
114
84
|
attribute(String, :offset, :offset)
|
115
85
|
end
|
116
86
|
class StopCollection < ElementCollection
|
117
|
-
def element_class
|
118
|
-
Stop
|
119
|
-
end
|
120
87
|
end
|
121
88
|
|
122
89
|
class MeshPatch < SVGElement
|
123
90
|
end
|
124
91
|
class MeshPatchCollection < ElementCollection
|
125
|
-
def element_class
|
126
|
-
MeshPatch
|
127
|
-
end
|
128
92
|
end
|
129
93
|
|
130
94
|
class MeshRow < SVGElement
|
131
95
|
end
|
132
96
|
class MeshRowCollection < ElementCollection
|
133
|
-
def element_class
|
134
|
-
MeshRow
|
135
|
-
end
|
136
97
|
end
|
137
98
|
|
138
99
|
class Gradient < SVGElement
|
@@ -142,9 +103,6 @@ module Watir
|
|
142
103
|
attribute(String, :href, :href)
|
143
104
|
end
|
144
105
|
class GradientCollection < ElementCollection
|
145
|
-
def element_class
|
146
|
-
Gradient
|
147
|
-
end
|
148
106
|
end
|
149
107
|
|
150
108
|
class MeshGradient < Gradient
|
@@ -152,9 +110,6 @@ module Watir
|
|
152
110
|
attribute(Fixnum, :y, :y)
|
153
111
|
end
|
154
112
|
class MeshGradientCollection < ElementCollection
|
155
|
-
def element_class
|
156
|
-
MeshGradient
|
157
|
-
end
|
158
113
|
end
|
159
114
|
|
160
115
|
class RadialGradient < Gradient
|
@@ -166,9 +121,6 @@ module Watir
|
|
166
121
|
attribute(Fixnum, :fr, :fr)
|
167
122
|
end
|
168
123
|
class RadialGradientCollection < ElementCollection
|
169
|
-
def element_class
|
170
|
-
RadialGradient
|
171
|
-
end
|
172
124
|
end
|
173
125
|
|
174
126
|
class LinearGradient < Gradient
|
@@ -178,9 +130,6 @@ module Watir
|
|
178
130
|
attribute(Fixnum, :y2, :y2)
|
179
131
|
end
|
180
132
|
class LinearGradientCollection < ElementCollection
|
181
|
-
def element_class
|
182
|
-
LinearGradient
|
183
|
-
end
|
184
133
|
end
|
185
134
|
|
186
135
|
class Marker < SVGElement
|
@@ -196,9 +145,6 @@ module Watir
|
|
196
145
|
attribute(String, :preserve_aspect_ratio, :preserveAspectRatio)
|
197
146
|
end
|
198
147
|
class MarkerCollection < ElementCollection
|
199
|
-
def element_class
|
200
|
-
Marker
|
201
|
-
end
|
202
148
|
end
|
203
149
|
|
204
150
|
class Symbol < SVGElement
|
@@ -206,25 +152,16 @@ module Watir
|
|
206
152
|
attribute(String, :preserve_aspect_ratio, :preserveAspectRatio)
|
207
153
|
end
|
208
154
|
class SymbolCollection < ElementCollection
|
209
|
-
def element_class
|
210
|
-
Symbol
|
211
|
-
end
|
212
155
|
end
|
213
156
|
|
214
157
|
class Metadata < SVGElement
|
215
158
|
end
|
216
159
|
class MetadataCollection < ElementCollection
|
217
|
-
def element_class
|
218
|
-
Metadata
|
219
|
-
end
|
220
160
|
end
|
221
161
|
|
222
162
|
class Desc < SVGElement
|
223
163
|
end
|
224
164
|
class DescCollection < ElementCollection
|
225
|
-
def element_class
|
226
|
-
Desc
|
227
|
-
end
|
228
165
|
end
|
229
166
|
|
230
167
|
class Graphics < SVGElement
|
@@ -234,9 +171,6 @@ module Watir
|
|
234
171
|
attribute(String, :system_language, :systemLanguage)
|
235
172
|
end
|
236
173
|
class GraphicsCollection < ElementCollection
|
237
|
-
def element_class
|
238
|
-
Graphics
|
239
|
-
end
|
240
174
|
end
|
241
175
|
|
242
176
|
class ForeignObject < Graphics
|
@@ -246,9 +180,6 @@ module Watir
|
|
246
180
|
attribute(Fixnum, :height, :height)
|
247
181
|
end
|
248
182
|
class ForeignObjectCollection < ElementCollection
|
249
|
-
def element_class
|
250
|
-
ForeignObject
|
251
|
-
end
|
252
183
|
end
|
253
184
|
|
254
185
|
class TextContent < Graphics
|
@@ -256,9 +187,6 @@ module Watir
|
|
256
187
|
attribute(String, :length_adjust, :lengthAdjust)
|
257
188
|
end
|
258
189
|
class TextContentCollection < ElementCollection
|
259
|
-
def element_class
|
260
|
-
TextContent
|
261
|
-
end
|
262
190
|
end
|
263
191
|
|
264
192
|
class TextPath < TextContent
|
@@ -270,9 +198,6 @@ module Watir
|
|
270
198
|
attribute(String, :animated_path_seg_list, :animatedPathSegList)
|
271
199
|
end
|
272
200
|
class TextPathCollection < ElementCollection
|
273
|
-
def element_class
|
274
|
-
TextPath
|
275
|
-
end
|
276
201
|
end
|
277
202
|
|
278
203
|
class TextPositioning < TextContent
|
@@ -283,25 +208,16 @@ module Watir
|
|
283
208
|
attribute(String, :rotate, :rotate)
|
284
209
|
end
|
285
210
|
class TextPositioningCollection < ElementCollection
|
286
|
-
def element_class
|
287
|
-
TextPositioning
|
288
|
-
end
|
289
211
|
end
|
290
212
|
|
291
213
|
class TSpan < TextPositioning
|
292
214
|
end
|
293
215
|
class TSpanCollection < ElementCollection
|
294
|
-
def element_class
|
295
|
-
TSpan
|
296
|
-
end
|
297
216
|
end
|
298
217
|
|
299
218
|
class Switch < Graphics
|
300
219
|
end
|
301
220
|
class SwitchCollection < ElementCollection
|
302
|
-
def element_class
|
303
|
-
Switch
|
304
|
-
end
|
305
221
|
end
|
306
222
|
|
307
223
|
class Use < Graphics
|
@@ -312,25 +228,16 @@ module Watir
|
|
312
228
|
attribute(String, :href, :href)
|
313
229
|
end
|
314
230
|
class UseCollection < ElementCollection
|
315
|
-
def element_class
|
316
|
-
Use
|
317
|
-
end
|
318
231
|
end
|
319
232
|
|
320
233
|
class Defs < Graphics
|
321
234
|
end
|
322
235
|
class DefsCollection < ElementCollection
|
323
|
-
def element_class
|
324
|
-
Defs
|
325
|
-
end
|
326
236
|
end
|
327
237
|
|
328
238
|
class G < Graphics
|
329
239
|
end
|
330
240
|
class GCollection < ElementCollection
|
331
|
-
def element_class
|
332
|
-
G
|
333
|
-
end
|
334
241
|
end
|
335
242
|
|
336
243
|
class SVG < Graphics
|
@@ -348,17 +255,11 @@ module Watir
|
|
348
255
|
attribute(Fixnum, :zoom_and_pan, :zoomAndPan)
|
349
256
|
end
|
350
257
|
class SVGCollection < ElementCollection
|
351
|
-
def element_class
|
352
|
-
SVG
|
353
|
-
end
|
354
258
|
end
|
355
259
|
|
356
260
|
class Geometry < Graphics
|
357
261
|
end
|
358
262
|
class GeometryCollection < ElementCollection
|
359
|
-
def element_class
|
360
|
-
Geometry
|
361
|
-
end
|
362
263
|
end
|
363
264
|
|
364
265
|
class Polygon < Geometry
|
@@ -366,9 +267,6 @@ module Watir
|
|
366
267
|
attribute(String, :animated_points, :animatedPoints)
|
367
268
|
end
|
368
269
|
class PolygonCollection < ElementCollection
|
369
|
-
def element_class
|
370
|
-
Polygon
|
371
|
-
end
|
372
270
|
end
|
373
271
|
|
374
272
|
class Polyline < Geometry
|
@@ -376,9 +274,6 @@ module Watir
|
|
376
274
|
attribute(String, :animated_points, :animatedPoints)
|
377
275
|
end
|
378
276
|
class PolylineCollection < ElementCollection
|
379
|
-
def element_class
|
380
|
-
Polyline
|
381
|
-
end
|
382
277
|
end
|
383
278
|
|
384
279
|
class Line < Geometry
|
@@ -388,9 +283,6 @@ module Watir
|
|
388
283
|
attribute(Fixnum, :y2, :y2)
|
389
284
|
end
|
390
285
|
class LineCollection < ElementCollection
|
391
|
-
def element_class
|
392
|
-
Line
|
393
|
-
end
|
394
286
|
end
|
395
287
|
|
396
288
|
class Ellipse < Geometry
|
@@ -400,9 +292,6 @@ module Watir
|
|
400
292
|
attribute(Fixnum, :ry, :ry)
|
401
293
|
end
|
402
294
|
class EllipseCollection < ElementCollection
|
403
|
-
def element_class
|
404
|
-
Ellipse
|
405
|
-
end
|
406
295
|
end
|
407
296
|
|
408
297
|
class Circle < Geometry
|
@@ -411,9 +300,6 @@ module Watir
|
|
411
300
|
attribute(Fixnum, :r, :r)
|
412
301
|
end
|
413
302
|
class CircleCollection < ElementCollection
|
414
|
-
def element_class
|
415
|
-
Circle
|
416
|
-
end
|
417
303
|
end
|
418
304
|
|
419
305
|
class Rect < Geometry
|
@@ -425,9 +311,6 @@ module Watir
|
|
425
311
|
attribute(Fixnum, :ry, :ry)
|
426
312
|
end
|
427
313
|
class RectCollection < ElementCollection
|
428
|
-
def element_class
|
429
|
-
Rect
|
430
|
-
end
|
431
314
|
end
|
432
315
|
|
433
316
|
class Path < Geometry
|
@@ -436,9 +319,6 @@ module Watir
|
|
436
319
|
attribute(String, :animated_path_seg_list, :animatedPathSegList)
|
437
320
|
end
|
438
321
|
class PathCollection < ElementCollection
|
439
|
-
def element_class
|
440
|
-
Path
|
441
|
-
end
|
442
322
|
end
|
443
323
|
|
444
324
|
|