safariwatir 0.3.8 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +21 -0
- data/Manifest +12 -0
- data/Rakefile +3 -2
- data/lib/safariwatir.rb +406 -69
- data/lib/safariwatir/element_attributes.rb +15 -0
- data/lib/safariwatir/locators.rb +127 -0
- data/lib/safariwatir/scripter.rb +205 -93
- data/safariwatir.gemspec +16 -15
- metadata +40 -14
data/History.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
=== 0.3.9 / ?????
|
2
|
+
|
3
|
+
* Added support for H tags of various sizes (Trey Evans)
|
4
|
+
* Better Watirpec compliance for buttons and labels (Trey Evans)
|
5
|
+
* Make rb-appscript a runtime dependency (Ben Lavender)
|
6
|
+
|
7
|
+
=== 0.3.8 / 2010-08-02
|
8
|
+
|
9
|
+
* Added support for textareas (Tom Copeland)
|
10
|
+
* Prevent things like 'element.parentNode' being replaced wrongly (Luke Hudson)
|
11
|
+
|
12
|
+
=== 0.3.7 / 2009-10-21
|
13
|
+
|
14
|
+
* Added support for selecting HtmlElements by the action attribute (Jacob Harris)
|
15
|
+
* Added support for selecting image elements via the alt attribute (Tom Copeland)
|
16
|
+
* Added support for selecting UL/LI elements (Frédéric de Villamil)
|
17
|
+
|
18
|
+
=== 0.3.6 / 2009-08-17
|
19
|
+
|
20
|
+
* Ruby 1.9 compatibility fixes
|
21
|
+
|
data/Manifest
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
History.txt
|
2
|
+
README.rdoc
|
3
|
+
Rakefile
|
4
|
+
lib/safariwatir.rb
|
5
|
+
lib/safariwatir/core_ext.rb
|
6
|
+
lib/safariwatir/element_attributes.rb
|
7
|
+
lib/safariwatir/locators.rb
|
8
|
+
lib/safariwatir/scripter.rb
|
9
|
+
lib/watir/exceptions.rb
|
10
|
+
safariwatir.gemspec
|
11
|
+
safariwatir_example.rb
|
12
|
+
Manifest
|
data/Rakefile
CHANGED
@@ -2,12 +2,13 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
require 'echoe'
|
4
4
|
|
5
|
-
Echoe.new('safariwatir', '0.
|
5
|
+
Echoe.new('safariwatir', '0.4.0') do | config |
|
6
6
|
config.summary = %q{Automated testing tool for web applications.}
|
7
7
|
config.description = %q{WATIR stands for "Web Application Testing in Ruby". See WATIR project for more information. This is a Safari-version of the original IE-only WATIR.}
|
8
8
|
config.url = 'http://wiki.openqa.org/display/WTR/SafariWatir'
|
9
9
|
config.author = 'Dave Hoover'
|
10
10
|
config.email = 'dave@obtiva.com'
|
11
|
-
config.ignore_pattern = ['tmp/*', 'script/*']
|
11
|
+
config.ignore_pattern = ['tmp/*', 'script/*', 'spec/**/**', '*.html']
|
12
12
|
config.development_dependencies = ["rb-appscript"]
|
13
|
+
config.runtime_dependencies = ["rb-appscript"]
|
13
14
|
end
|
data/lib/safariwatir.rb
CHANGED
@@ -1,17 +1,28 @@
|
|
1
1
|
require 'watir/exceptions'
|
2
2
|
require 'safariwatir/scripter'
|
3
3
|
require 'safariwatir/core_ext'
|
4
|
+
require 'safariwatir/element_attributes'
|
5
|
+
require 'safariwatir/locators'
|
6
|
+
require 'forwardable'
|
4
7
|
|
5
8
|
module Watir
|
6
9
|
include Watir::Exception
|
7
10
|
|
11
|
+
class ElementCollection < Array
|
12
|
+
|
13
|
+
def [](idx)
|
14
|
+
super(idx - 1)
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
8
19
|
module PageContainer
|
9
20
|
def html
|
10
21
|
@scripter.document_html
|
11
22
|
end
|
12
23
|
|
13
24
|
def text
|
14
|
-
@scripter.document_text
|
25
|
+
@scripter.document_text(self)
|
15
26
|
end
|
16
27
|
|
17
28
|
def title
|
@@ -84,21 +95,25 @@ module Watir
|
|
84
95
|
end
|
85
96
|
end
|
86
97
|
|
87
|
-
class Frame
|
88
|
-
include Container
|
89
|
-
include PageContainer
|
90
|
-
|
91
|
-
attr_reader :name
|
92
|
-
|
93
|
-
def initialize(scripter, name)
|
94
|
-
@name = name
|
95
|
-
@scripter = scripter.for_frame(self)
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
98
|
class HtmlElement
|
100
|
-
def_init :scripter, :how, :what
|
101
|
-
attr_reader :how, :what
|
99
|
+
def_init :parent, :scripter, :how, :what
|
100
|
+
attr_reader :how, :what, :parent
|
101
|
+
|
102
|
+
include Locators
|
103
|
+
|
104
|
+
# required by watir specs
|
105
|
+
extend ElementAttributes
|
106
|
+
html_attr_reader :class_name, "class"
|
107
|
+
html_attr_reader :id
|
108
|
+
html_attr_reader :name
|
109
|
+
html_attr_reader :title
|
110
|
+
html_attr_reader :src
|
111
|
+
html_attr_reader :alt
|
112
|
+
html_method_reader :value
|
113
|
+
|
114
|
+
def type; nil; end
|
115
|
+
|
116
|
+
def is_frame?; false; end
|
102
117
|
|
103
118
|
# overridden in derivitives
|
104
119
|
def tag
|
@@ -111,6 +126,9 @@ module Watir
|
|
111
126
|
end
|
112
127
|
|
113
128
|
def exists?
|
129
|
+
unless [Fixnum, String, Regexp].any? { |allowed_class| what.kind_of?(allowed_class) }
|
130
|
+
raise TypeError.new("May not search using a 'what' value of class #{what.class.name}")
|
131
|
+
end
|
114
132
|
@scripter.element_exists?(self)
|
115
133
|
end
|
116
134
|
alias :exist? :exists?
|
@@ -119,19 +137,16 @@ module Watir
|
|
119
137
|
self.class.name.split("::").last
|
120
138
|
end
|
121
139
|
|
140
|
+
def html_method name
|
141
|
+
@scripter.get_method_value(name, self)
|
142
|
+
end
|
143
|
+
|
122
144
|
def attr name
|
123
145
|
@scripter.get_attribute(name, self)
|
124
146
|
end
|
125
147
|
|
126
148
|
def operate(&block)
|
127
|
-
|
128
|
-
if scripter_suffix.kind_of? Hash
|
129
|
-
scripter_suffix = scripter_suffix[element_name]
|
130
|
-
end
|
131
|
-
if scripter_suffix.nil?
|
132
|
-
raise Watir::Exception::MissingWayOfFindingObjectException, "SafariWatir does not currently support finding by #{how}"
|
133
|
-
end
|
134
|
-
@scripter.send("operate_#{scripter_suffix}", self, &block)
|
149
|
+
@scripter.operate_by_locator(self, &block)
|
135
150
|
end
|
136
151
|
|
137
152
|
OPERATIONS = {
|
@@ -151,10 +166,44 @@ module Watir
|
|
151
166
|
:title => "by_title",
|
152
167
|
:xpath => "by_xpath",
|
153
168
|
}
|
169
|
+
|
170
|
+
end
|
171
|
+
|
172
|
+
|
173
|
+
class FrameElement < HtmlElement
|
174
|
+
def is_frame?; true; end
|
175
|
+
def tag; ["frame", "iframe"]; end
|
176
|
+
end
|
177
|
+
|
178
|
+
class Frame
|
179
|
+
include Container
|
180
|
+
include PageContainer
|
181
|
+
include Locators
|
182
|
+
extend Forwardable
|
183
|
+
|
184
|
+
def initialize(parent_tag, scripter_obj, find_how, find_what)
|
185
|
+
@parent = parent_tag
|
186
|
+
@scripter = scripter_obj
|
187
|
+
@how = find_how
|
188
|
+
@what = find_what
|
189
|
+
@frame_element = FrameElement.new(parent_tag, scripter_obj, find_how, find_what)
|
190
|
+
end
|
191
|
+
|
192
|
+
def tag; ["frame", "iframe"]; end
|
193
|
+
|
194
|
+
def document_locator; locator; end
|
195
|
+
|
196
|
+
def locator
|
197
|
+
self.send("locator_by_#{how}".to_sym).to_s + ".contentDocument"
|
198
|
+
end
|
199
|
+
|
200
|
+
attr_reader :parent, :how, :what, :scripter, :frame_element
|
201
|
+
|
202
|
+
def_delegators :frame_element, :class_name, :id, :name, :title, :src, :alt, :exist?, :exists?
|
154
203
|
end
|
155
204
|
|
156
205
|
class Form < HtmlElement
|
157
|
-
def_init :scripter, :how, :what
|
206
|
+
def_init :parent, :scripter, :how, :what
|
158
207
|
|
159
208
|
def submit
|
160
209
|
@scripter.submit_form(self)
|
@@ -166,6 +215,8 @@ module Watir
|
|
166
215
|
class InputElement < HtmlElement
|
167
216
|
include Clickable
|
168
217
|
|
218
|
+
html_attr_reader :type
|
219
|
+
|
169
220
|
def speak
|
170
221
|
@scripter.speak_value_of(self)
|
171
222
|
end
|
@@ -200,7 +251,23 @@ module Watir
|
|
200
251
|
@scripter.speak_text_of(self)
|
201
252
|
end
|
202
253
|
end
|
254
|
+
|
255
|
+
class Dd < ContentElement
|
256
|
+
def tag; "DD"; end
|
257
|
+
end
|
258
|
+
|
259
|
+
class Dl < ContentElement
|
260
|
+
def tag; "DL"; end
|
261
|
+
end
|
262
|
+
|
263
|
+
class Dt < ContentElement
|
264
|
+
def tag; "DT"; end
|
265
|
+
end
|
203
266
|
|
267
|
+
class Em < ContentElement
|
268
|
+
def tag; "EM"; end
|
269
|
+
end
|
270
|
+
|
204
271
|
class Image < HtmlElement
|
205
272
|
include Clickable
|
206
273
|
|
@@ -208,11 +275,17 @@ module Watir
|
|
208
275
|
end
|
209
276
|
|
210
277
|
class Button < InputElement
|
278
|
+
def tag; ["INPUT", "BUTTON"]; end
|
279
|
+
include ButtonLocators
|
211
280
|
end
|
212
281
|
|
213
282
|
class Checkbox < InputElement
|
214
|
-
def_init :scripter, :how, :what, :value
|
283
|
+
def_init :parent, :scripter, :how, :what, :value
|
215
284
|
|
285
|
+
include InputLocators
|
286
|
+
|
287
|
+
def input_type; "checkbox"; end
|
288
|
+
|
216
289
|
def by_value
|
217
290
|
@value
|
218
291
|
end
|
@@ -229,6 +302,16 @@ module Watir
|
|
229
302
|
end
|
230
303
|
end
|
231
304
|
|
305
|
+
class Header < ContentElement
|
306
|
+
|
307
|
+
def initialize(parent, scripter, how, what, h_size = 1)
|
308
|
+
super(parent, scripter, how, what)
|
309
|
+
@size = 1
|
310
|
+
end
|
311
|
+
|
312
|
+
def tag; "H#{@size}"; end
|
313
|
+
end
|
314
|
+
|
232
315
|
class Div < ContentElement
|
233
316
|
def tag; "DIV"; end
|
234
317
|
end
|
@@ -237,7 +320,13 @@ module Watir
|
|
237
320
|
def tag; "P"; end
|
238
321
|
end
|
239
322
|
|
323
|
+
class Pre < ContentElement
|
324
|
+
def tag; "PRE"; end
|
325
|
+
end
|
326
|
+
|
240
327
|
class Label < ContentElement
|
328
|
+
|
329
|
+
html_attr_reader :for
|
241
330
|
def tag; "LABEL"; end
|
242
331
|
end
|
243
332
|
|
@@ -259,7 +348,7 @@ module Watir
|
|
259
348
|
end
|
260
349
|
alias :url :href
|
261
350
|
|
262
|
-
def
|
351
|
+
def iotuibd
|
263
352
|
attr('id') || ''
|
264
353
|
end
|
265
354
|
|
@@ -283,6 +372,7 @@ module Watir
|
|
283
372
|
end
|
284
373
|
|
285
374
|
class Radio < Checkbox
|
375
|
+
def input_type; "radio"; end
|
286
376
|
end
|
287
377
|
|
288
378
|
class SelectList < InputElement
|
@@ -297,7 +387,7 @@ module Watir
|
|
297
387
|
def option(how, what)
|
298
388
|
Option.new(@scripter, self, how, what)
|
299
389
|
end
|
300
|
-
|
390
|
+
|
301
391
|
def selected_values
|
302
392
|
values = []
|
303
393
|
index = 1
|
@@ -310,6 +400,8 @@ module Watir
|
|
310
400
|
values.map {|o| o.text } #TODO?
|
311
401
|
end
|
312
402
|
|
403
|
+
alias :selected_options :selected_values
|
404
|
+
|
313
405
|
def selected_value
|
314
406
|
selected_values.first
|
315
407
|
end
|
@@ -323,26 +415,19 @@ module Watir
|
|
323
415
|
|
324
416
|
class Option < InputElement
|
325
417
|
def_init :scripter, :select_list, :how, :what
|
326
|
-
|
418
|
+
def parent; @select_list; end
|
419
|
+
|
420
|
+
def selected?
|
421
|
+
selected_value = html_method(:selected) ? html_method(:selected) : ""
|
422
|
+
selected_value != ""
|
423
|
+
end
|
424
|
+
|
327
425
|
def select
|
328
426
|
@scripter.highlight(self) do
|
329
427
|
select_option
|
330
428
|
end
|
331
429
|
end
|
332
430
|
|
333
|
-
def operate(&block)
|
334
|
-
@select_list.operate(&block)
|
335
|
-
end
|
336
|
-
|
337
|
-
def exists?
|
338
|
-
@scripter.option_exists?(self)
|
339
|
-
end
|
340
|
-
alias :exist? :exists?
|
341
|
-
|
342
|
-
def selected?
|
343
|
-
@scripter.option_selected?(self)
|
344
|
-
end
|
345
|
-
|
346
431
|
def text
|
347
432
|
@scripter.get_text_for(self)
|
348
433
|
end
|
@@ -354,13 +439,17 @@ module Watir
|
|
354
439
|
def tag; "SPAN"; end
|
355
440
|
end
|
356
441
|
|
442
|
+
class Strong < ContentElement
|
443
|
+
def tag; "STRONG"; end
|
444
|
+
end
|
445
|
+
|
357
446
|
class Map < InputElement
|
358
447
|
def tag; "MAP"; end
|
359
448
|
end
|
360
449
|
|
361
|
-
class Table
|
362
|
-
def_init :scripter, :how, :what
|
363
|
-
attr_reader :how, :what
|
450
|
+
class Table < ContentElement
|
451
|
+
def_init :parent, :scripter, :how, :what
|
452
|
+
attr_reader :parent, :how, :what
|
364
453
|
|
365
454
|
def each
|
366
455
|
# TODO
|
@@ -381,7 +470,7 @@ module Watir
|
|
381
470
|
def tag; "TABLE"; end
|
382
471
|
end
|
383
472
|
|
384
|
-
class TableRow
|
473
|
+
class TableRow < ContentElement
|
385
474
|
def initialize(scripter, how, what, table = nil)
|
386
475
|
@scripter = scripter
|
387
476
|
@how = how
|
@@ -390,6 +479,8 @@ module Watir
|
|
390
479
|
end
|
391
480
|
|
392
481
|
attr_reader :table, :how, :what
|
482
|
+
|
483
|
+
alias :parent :table
|
393
484
|
|
394
485
|
def each
|
395
486
|
# TODO
|
@@ -426,6 +517,9 @@ module Watir
|
|
426
517
|
end
|
427
518
|
|
428
519
|
class TextField < InputElement
|
520
|
+
include InputLocators
|
521
|
+
def input_type; "text"; end
|
522
|
+
|
429
523
|
def set(value)
|
430
524
|
value = value.to_s
|
431
525
|
@scripter.focus(self)
|
@@ -441,6 +535,8 @@ module Watir
|
|
441
535
|
def getContents
|
442
536
|
@scripter.get_value_for(self)
|
443
537
|
end
|
538
|
+
|
539
|
+
alias :value :getContents
|
444
540
|
|
445
541
|
def verify_contains(expected)
|
446
542
|
actual = getContents
|
@@ -454,9 +550,23 @@ module Watir
|
|
454
550
|
end
|
455
551
|
|
456
552
|
class TextArea < TextField
|
553
|
+
def tag; ["input", "textarea"]; end
|
554
|
+
end
|
555
|
+
|
556
|
+
class FileField < TextField
|
557
|
+
def input_type; "file"; end
|
558
|
+
|
559
|
+
def set(value)
|
560
|
+
@scripter.set_file_field(self, value.to_s)
|
561
|
+
end
|
457
562
|
end
|
458
563
|
|
459
564
|
class Password < TextField
|
565
|
+
def input_type; "password"; end
|
566
|
+
end
|
567
|
+
|
568
|
+
class Ol < ContentElement
|
569
|
+
def tag; "OL"; end
|
460
570
|
end
|
461
571
|
|
462
572
|
class Ul < ContentElement
|
@@ -474,91 +584,315 @@ module Watir
|
|
474
584
|
# Elements
|
475
585
|
|
476
586
|
def area(how, what)
|
477
|
-
Area.new(scripter, how, what)
|
587
|
+
Area.new(self, scripter, how, what)
|
478
588
|
end
|
479
589
|
|
590
|
+
def areas
|
591
|
+
child_tag_list do |idx|
|
592
|
+
Area.new(self, scripter, :index, idx)
|
593
|
+
end
|
594
|
+
end
|
595
|
+
|
480
596
|
def button(how, what)
|
481
|
-
Button.new(scripter, how, what)
|
597
|
+
Button.new(self, scripter, how, what)
|
598
|
+
end
|
599
|
+
|
600
|
+
def buttons
|
601
|
+
child_tag_list do |idx|
|
602
|
+
Button.new(self, scripter, :index, idx)
|
603
|
+
end
|
482
604
|
end
|
483
605
|
|
484
606
|
def cell(how, what)
|
485
|
-
TableCell.new(scripter, how, what)
|
607
|
+
TableCell.new(self, scripter, how, what)
|
486
608
|
end
|
487
609
|
|
488
610
|
def checkbox(how, what, value = nil)
|
489
|
-
Checkbox.new(scripter, how, what, value)
|
611
|
+
Checkbox.new(self, scripter, how, what, value)
|
612
|
+
end
|
613
|
+
|
614
|
+
def checkboxes
|
615
|
+
child_tag_list do |idx|
|
616
|
+
Checkbox.new(self, scripter, :index, idx, nil)
|
617
|
+
end
|
618
|
+
end
|
619
|
+
|
620
|
+
def dd(how, what)
|
621
|
+
Dd.new(self, scripter, how, what)
|
622
|
+
end
|
623
|
+
|
624
|
+
def dds
|
625
|
+
child_tag_list do |idx|
|
626
|
+
Dd.new(self, scripter, :index, idx)
|
627
|
+
end
|
490
628
|
end
|
491
629
|
|
492
630
|
def div(how, what)
|
493
|
-
Div.new(scripter, how, what)
|
631
|
+
Div.new(self, scripter, how, what)
|
494
632
|
end
|
495
633
|
|
634
|
+
def divs
|
635
|
+
child_tag_list do |idx|
|
636
|
+
Div.new(self, scripter, :index, idx)
|
637
|
+
end
|
638
|
+
end
|
639
|
+
|
640
|
+
def dl(how, what)
|
641
|
+
Dl.new(self, scripter, how, what)
|
642
|
+
end
|
643
|
+
|
644
|
+
def dls
|
645
|
+
child_tag_list do |idx|
|
646
|
+
Dl.new(self, scripter, :index, idx)
|
647
|
+
end
|
648
|
+
end
|
649
|
+
|
650
|
+
def dt(how, what)
|
651
|
+
Dt.new(self, scripter, how, what)
|
652
|
+
end
|
653
|
+
|
654
|
+
def dts
|
655
|
+
child_tag_list do |idx|
|
656
|
+
Dt.new(self, scripter, :index, idx)
|
657
|
+
end
|
658
|
+
end
|
659
|
+
|
660
|
+
def em(how, what)
|
661
|
+
Em.new(self, scripter, how, what)
|
662
|
+
end
|
663
|
+
|
664
|
+
def ems
|
665
|
+
child_tag_list do |idx|
|
666
|
+
Em.new(self, scripter, :index, idx)
|
667
|
+
end
|
668
|
+
end
|
669
|
+
|
496
670
|
def p(how, what)
|
497
|
-
P.new(scripter, how, what)
|
671
|
+
P.new(self, scripter, how, what)
|
672
|
+
end
|
673
|
+
|
674
|
+
def ps
|
675
|
+
child_tag_list do |idx|
|
676
|
+
P.new(self, scripter, :index, idx)
|
677
|
+
end
|
678
|
+
end
|
679
|
+
|
680
|
+
def pre(how, what)
|
681
|
+
Pre.new(self, scripter, how, what)
|
682
|
+
end
|
683
|
+
|
684
|
+
def pres
|
685
|
+
child_tag_list do |idx|
|
686
|
+
Pre.new(self, scripter, :index, idx)
|
687
|
+
end
|
498
688
|
end
|
499
689
|
|
500
690
|
def form(how, what)
|
501
|
-
Form.new(scripter, how, what)
|
691
|
+
Form.new(self, scripter, how, what)
|
502
692
|
end
|
503
693
|
|
504
|
-
def
|
505
|
-
|
694
|
+
def forms
|
695
|
+
child_tag_list do |idx|
|
696
|
+
Form.new(self, scripter, :index, idx)
|
697
|
+
end
|
698
|
+
end
|
699
|
+
|
700
|
+
def frame(how, what)
|
701
|
+
Frame.new(self, scripter, how, what)
|
506
702
|
end
|
507
703
|
|
704
|
+
def h1(how, what)
|
705
|
+
Header.new(self, scripter, how, what, 1)
|
706
|
+
end
|
707
|
+
|
708
|
+
def h2(how, what)
|
709
|
+
Header.new(self, scripter, how, what, 2)
|
710
|
+
end
|
711
|
+
|
712
|
+
def h3(how, what)
|
713
|
+
Header.new(self, scripter, how, what, 3)
|
714
|
+
end
|
715
|
+
|
716
|
+
def h4(how, what)
|
717
|
+
Header.new(self, scripter, how, what, 4)
|
718
|
+
end
|
719
|
+
|
720
|
+
def h5(how, what)
|
721
|
+
Header.new(self, scripter, how, what, 5)
|
722
|
+
end
|
723
|
+
|
724
|
+
def h6(how, what)
|
725
|
+
Header.new(self, scripter, how, what, 6)
|
726
|
+
end
|
727
|
+
|
508
728
|
def image(how, what)
|
509
|
-
Image.new(scripter, how, what)
|
729
|
+
Image.new(self, scripter, how, what)
|
730
|
+
end
|
731
|
+
|
732
|
+
def images
|
733
|
+
child_tag_list do |idx|
|
734
|
+
Image.new(self, scripter, :index, idx)
|
735
|
+
end
|
510
736
|
end
|
511
737
|
|
512
738
|
def label(how, what)
|
513
|
-
Label.new(scripter, how, what)
|
739
|
+
Label.new(self, scripter, how, what)
|
740
|
+
end
|
741
|
+
|
742
|
+
def labels
|
743
|
+
child_tag_list do |idx|
|
744
|
+
Label.new(self, scripter, :index, idx)
|
745
|
+
end
|
514
746
|
end
|
515
747
|
|
516
748
|
def li(how, what)
|
517
|
-
Li.new(scripter, how, what)
|
749
|
+
Li.new(self, scripter, how, what)
|
518
750
|
end
|
519
751
|
|
752
|
+
def lis
|
753
|
+
child_tag_list do |idx|
|
754
|
+
Li.new(self, scripter, :index, idx)
|
755
|
+
end
|
756
|
+
end
|
757
|
+
|
520
758
|
def link(how, what)
|
521
|
-
Link.new(scripter, how, what)
|
759
|
+
Link.new(self, scripter, how, what)
|
760
|
+
end
|
761
|
+
|
762
|
+
def links
|
763
|
+
child_tag_list do |idx|
|
764
|
+
Link.new(self, scripter, :index, idx)
|
765
|
+
end
|
522
766
|
end
|
523
767
|
|
524
768
|
def map(how, what)
|
525
|
-
Map.new(scripter, how, what)
|
769
|
+
Map.new(self, scripter, how, what)
|
770
|
+
end
|
771
|
+
|
772
|
+
def maps
|
773
|
+
child_tag_list do |idx|
|
774
|
+
Map.new(self, scripter, :index, idx)
|
775
|
+
end
|
526
776
|
end
|
527
777
|
|
528
778
|
def password(how, what)
|
529
|
-
Password.new(scripter, how, what)
|
779
|
+
Password.new(self, scripter, how, what)
|
780
|
+
end
|
781
|
+
|
782
|
+
def passwords
|
783
|
+
child_tag_list do |idx|
|
784
|
+
Password.new(self, scripter, :index, idx)
|
785
|
+
end
|
530
786
|
end
|
531
787
|
|
532
788
|
def radio(how, what, value = nil)
|
533
|
-
Radio.new(scripter, how, what, value)
|
789
|
+
Radio.new(self, scripter, how, what, value)
|
534
790
|
end
|
535
791
|
|
536
792
|
def row(how, what)
|
537
|
-
TableRow.new(scripter, how, what)
|
793
|
+
TableRow.new(self, scripter, how, what)
|
794
|
+
end
|
795
|
+
|
796
|
+
def rows
|
797
|
+
child_tag_list do |idx|
|
798
|
+
TableRow.new(self, scripter, :index, idx)
|
799
|
+
end
|
538
800
|
end
|
539
801
|
|
540
802
|
def select_list(how, what)
|
541
|
-
SelectList.new(scripter, how, what)
|
803
|
+
SelectList.new(self, scripter, how, what)
|
804
|
+
end
|
805
|
+
|
806
|
+
def select_lists
|
807
|
+
child_tag_list do |idx|
|
808
|
+
SelectList.new(self, scripter, :index, idx)
|
809
|
+
end
|
542
810
|
end
|
543
811
|
|
544
812
|
def span(how, what)
|
545
|
-
Span.new(scripter, how, what)
|
813
|
+
Span.new(self, scripter, how, what)
|
814
|
+
end
|
815
|
+
|
816
|
+
def spans
|
817
|
+
child_tag_list do |idx|
|
818
|
+
Span.new(self, scripter, :index, idx)
|
819
|
+
end
|
820
|
+
end
|
821
|
+
|
822
|
+
def strong(how, what)
|
823
|
+
Strong.new(self, scripter, how, what)
|
824
|
+
end
|
825
|
+
|
826
|
+
def strongs
|
827
|
+
child_tag_list do |idx|
|
828
|
+
Strong.new(self, scripter, :index, idx)
|
829
|
+
end
|
546
830
|
end
|
547
831
|
|
548
832
|
def table(how, what)
|
549
|
-
Table.new(scripter, how, what)
|
833
|
+
Table.new(self, scripter, how, what)
|
550
834
|
end
|
551
835
|
|
836
|
+
def tables
|
837
|
+
child_tag_list do |idx|
|
838
|
+
Table.new(self, scripter, :index, idx)
|
839
|
+
end
|
840
|
+
end
|
841
|
+
|
552
842
|
def text_field(how, what)
|
553
|
-
TextField.new(scripter, how, what)
|
843
|
+
TextField.new(self, scripter, how, what)
|
554
844
|
end
|
555
845
|
|
846
|
+
def text_fields
|
847
|
+
child_tag_list do |idx|
|
848
|
+
TextField.new(self, scripter, :index, idx)
|
849
|
+
end
|
850
|
+
end
|
851
|
+
|
556
852
|
def text_area(how, what)
|
557
|
-
TextArea.new(scripter, how, what)
|
853
|
+
TextArea.new(self, scripter, how, what)
|
854
|
+
end
|
855
|
+
|
856
|
+
def file_field(how, what)
|
857
|
+
FileField.new(self, scripter, how, what)
|
858
|
+
end
|
859
|
+
|
860
|
+
def file_fields
|
861
|
+
child_tag_list do |idx|
|
862
|
+
FileField.new(self, scripter, :index, idx)
|
863
|
+
end
|
864
|
+
end
|
865
|
+
|
866
|
+
def ol(how, what)
|
867
|
+
Ol.new(self, scripter, how, what)
|
868
|
+
end
|
869
|
+
|
870
|
+
def ols
|
871
|
+
child_tag_list do |idx|
|
872
|
+
Ol.new(self, scripter, :index, idx)
|
873
|
+
end
|
558
874
|
end
|
559
875
|
|
560
876
|
def ul(how, what)
|
561
|
-
Ul.new(scripter, how, what)
|
877
|
+
Ul.new(self, scripter, how, what)
|
878
|
+
end
|
879
|
+
|
880
|
+
def uls
|
881
|
+
child_tag_list do |idx|
|
882
|
+
Ul.new(self, scripter, :index, idx)
|
883
|
+
end
|
884
|
+
end
|
885
|
+
|
886
|
+
def child_tag_list(&child_tag_blk)
|
887
|
+
values = ElementCollection.new
|
888
|
+
index = 1
|
889
|
+
loop do
|
890
|
+
child_tag = child_tag_blk.call(index)
|
891
|
+
break unless child_tag.exists?
|
892
|
+
values << child_tag
|
893
|
+
index += 1
|
894
|
+
end
|
895
|
+
values
|
562
896
|
end
|
563
897
|
|
564
898
|
def contains_text(what)
|
@@ -568,7 +902,7 @@ module Watir
|
|
568
902
|
when String
|
569
903
|
text.index(what)
|
570
904
|
else
|
571
|
-
raise
|
905
|
+
raise TypeError
|
572
906
|
end
|
573
907
|
end
|
574
908
|
end
|
@@ -593,6 +927,9 @@ module Watir
|
|
593
927
|
def url
|
594
928
|
scripter.url
|
595
929
|
end
|
930
|
+
|
931
|
+
def locator; "document"; end
|
932
|
+
def document_locator; "document"; end
|
596
933
|
|
597
934
|
# Hide's Safari
|
598
935
|
def hide
|