watir 2.0.1 → 2.0.2.rc1
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.
- data/CHANGES +8 -0
- data/VERSION +1 -1
- data/lib/watir/collections.rb +10 -5
- data/lib/watir/container.rb +6 -10
- data/lib/watir/element.rb +3 -6
- data/lib/watir/form.rb +1 -2
- data/lib/watir/frame.rb +5 -2
- data/lib/watir/ie-class.rb +17 -2
- data/lib/watir/locator.rb +68 -61
- data/lib/watir/non_control_elements.rb +13 -2
- data/lib/watir/table.rb +17 -11
- data/unittests/document_standards.rb +67 -0
- data/unittests/element_collections_test.rb +9 -0
- data/unittests/frame_test.rb +2 -2
- data/unittests/html/ie7_document_standards.html +9 -0
- data/unittests/html/ie8_document_standards.html +9 -0
- data/unittests/html/ie9_document_standards.html +9 -0
- data/unittests/html/quirks_document_standards.html +8 -0
- data/unittests/js_events_test.rb +5 -0
- data/watir.gemspec +0 -1
- metadata +22 -11
data/CHANGES
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
== Version 2.x.x - 2011/xx/xx
|
2
|
+
|
3
|
+
* added support for del, ins, font, meta and ol tags
|
4
|
+
* added support for h1, h2, h3, h4, h5, h6 and ul collection methods
|
5
|
+
* Watir::IE#execute_script returns now the value of the JavaScript evaluation
|
6
|
+
* Watir::Table#rows method iterates correctly over rows
|
7
|
+
* speed up dealing with html elements in some situations
|
8
|
+
|
1
9
|
== Version 2.0.1 - 2011/08/10
|
2
10
|
|
3
11
|
* fixed Watir::IE#close for Ruby 1.9.2 - fixes http://jira.openqa.org/browse/WTR-481
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.
|
1
|
+
2.0.2.rc1
|
data/lib/watir/collections.rb
CHANGED
@@ -35,16 +35,21 @@ module Watir
|
|
35
35
|
def element_tag; 'SELECT'; end
|
36
36
|
end
|
37
37
|
|
38
|
-
%w[
|
38
|
+
%w[Button FileField Radio TextField Hidden].each do |element|
|
39
39
|
module_eval %Q{
|
40
|
-
class #{
|
40
|
+
class #{element}s < InputElementCollections; end
|
41
41
|
}
|
42
42
|
end
|
43
|
+
|
44
|
+
class Inses < ElementCollections
|
45
|
+
def element_class; Ins; end
|
46
|
+
end
|
43
47
|
|
44
|
-
%w[
|
45
|
-
|
48
|
+
%w[Link Li Map Area Image Table TableRow TableCell
|
49
|
+
Label Pre P Span Div Dl Dt Dd Strong Em Del
|
50
|
+
Font H1 H2 H3 H4 H5 H6 Meta Ol Ul].each do |element|
|
46
51
|
module_eval %Q{
|
47
|
-
class #{
|
52
|
+
class #{element}s < ElementCollections; end
|
48
53
|
}
|
49
54
|
end
|
50
55
|
|
data/lib/watir/container.rb
CHANGED
@@ -14,7 +14,7 @@ module Watir
|
|
14
14
|
#
|
15
15
|
# there are many methods available to the Button object
|
16
16
|
#--
|
17
|
-
# Is includable for classes that have @container, document and
|
17
|
+
# Is includable for classes that have @container, document and __ole_inner_elements
|
18
18
|
module Container
|
19
19
|
include Watir::Exception
|
20
20
|
|
@@ -61,10 +61,9 @@ module Watir
|
|
61
61
|
# Not for external consumption
|
62
62
|
#
|
63
63
|
#++
|
64
|
-
def
|
64
|
+
def __ole_inner_elements
|
65
65
|
return document.body.all
|
66
66
|
end
|
67
|
-
private :ole_inner_elements
|
68
67
|
|
69
68
|
# This method shows the available objects on the current page.
|
70
69
|
# This is usually only used for debugging or writing new test scripts.
|
@@ -102,21 +101,18 @@ module Watir
|
|
102
101
|
def input_element_locator(how, what, types, klass=nil)
|
103
102
|
locator = InputElementLocator.new self, types, klass
|
104
103
|
locator.set_specifier how, what
|
105
|
-
locator.document = document
|
106
|
-
return locator.element if locator.fast_locate
|
107
|
-
locator.elements = ole_inner_elements if locator.elements.nil?
|
108
104
|
locator
|
109
105
|
end
|
110
106
|
|
111
107
|
def tagged_element_locator(tag, how, what, klass=nil)
|
112
|
-
locator = TaggedElementLocator.new
|
113
|
-
locator.set_specifier
|
108
|
+
locator = TaggedElementLocator.new self, tag, klass
|
109
|
+
locator.set_specifier how, what
|
114
110
|
locator
|
115
111
|
end
|
116
112
|
|
117
113
|
def locator_for(locator_class, how, what)
|
118
|
-
locator = locator_class.new
|
119
|
-
locator.set_specifier
|
114
|
+
locator = locator_class.new self
|
115
|
+
locator.set_specifier how, what
|
120
116
|
locator
|
121
117
|
end
|
122
118
|
|
data/lib/watir/element.rb
CHANGED
@@ -152,13 +152,11 @@ module Watir
|
|
152
152
|
ole_object.getAttribute('name') || ''
|
153
153
|
end
|
154
154
|
|
155
|
-
def
|
155
|
+
def __ole_inner_elements
|
156
156
|
assert_exists
|
157
157
|
return ole_object.all
|
158
158
|
end
|
159
159
|
|
160
|
-
private :ole_inner_elements
|
161
|
-
|
162
160
|
def document
|
163
161
|
assert_exists
|
164
162
|
return ole_object
|
@@ -338,10 +336,9 @@ module Watir
|
|
338
336
|
|
339
337
|
def dispatch_event(event)
|
340
338
|
if IE.version_parts.first.to_i >= 9
|
341
|
-
|
342
|
-
# we're in IE9 document standards mode
|
339
|
+
if @container.page_container.document_mode.to_i >= 9
|
343
340
|
ole_object.dispatchEvent(create_event(event))
|
344
|
-
|
341
|
+
else
|
345
342
|
ole_object.fireEvent(event)
|
346
343
|
end
|
347
344
|
else
|
data/lib/watir/form.rb
CHANGED
@@ -43,11 +43,10 @@ module Watir
|
|
43
43
|
@container.wait
|
44
44
|
end
|
45
45
|
|
46
|
-
def
|
46
|
+
def __ole_inner_elements
|
47
47
|
assert_exists
|
48
48
|
@o.elements
|
49
49
|
end
|
50
|
-
private :ole_inner_elements
|
51
50
|
|
52
51
|
# This method is responsible for setting and clearing the colored highlighting on the specified form.
|
53
52
|
# use :set to set the highlight
|
data/lib/watir/frame.rb
CHANGED
@@ -20,10 +20,9 @@ module Watir
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
def
|
23
|
+
def __ole_inner_elements
|
24
24
|
document.body.all
|
25
25
|
end
|
26
|
-
private :ole_inner_elements
|
27
26
|
|
28
27
|
def initialize(container, how, what)
|
29
28
|
set_container container
|
@@ -41,6 +40,10 @@ module Watir
|
|
41
40
|
end
|
42
41
|
end
|
43
42
|
|
43
|
+
def document_mode
|
44
|
+
document.documentMode
|
45
|
+
end
|
46
|
+
|
44
47
|
def attach_command
|
45
48
|
@container.page_container.attach_command + ".frame(#{@how.inspect}, #{@what.inspect})".gsub('"','\'')
|
46
49
|
end
|
data/lib/watir/ie-class.rb
CHANGED
@@ -368,6 +368,13 @@ module Watir
|
|
368
368
|
@ie.document.title
|
369
369
|
end
|
370
370
|
|
371
|
+
# The document standards mode used by IE
|
372
|
+
# can be overridden in the html with: <meta http-equiv="x-ua-compatible" content="IE=8">
|
373
|
+
def document_mode
|
374
|
+
@ie.document.documentMode.to_i
|
375
|
+
end
|
376
|
+
|
377
|
+
|
371
378
|
# Return the status of the window, typically from the status bar at the bottom.
|
372
379
|
def status
|
373
380
|
return @ie.statusText
|
@@ -413,8 +420,16 @@ module Watir
|
|
413
420
|
# Execute the given JavaScript string
|
414
421
|
def execute_script(source)
|
415
422
|
document.parentWindow.eval(source.to_s)
|
416
|
-
rescue WIN32OLERuntimeError
|
417
|
-
|
423
|
+
rescue WIN32OLERuntimeError #if eval fails we need to use execScript(source.to_s) which does not return a value, hence the workaround
|
424
|
+
wrapper = "_watir_helper_div_#{rand(100000)}"
|
425
|
+
escaped_src = source.to_s
|
426
|
+
escaped_src = escaped_src.gsub("'", "\\\\'")
|
427
|
+
cmd = "var e= document.createElement('DIV'); e.id='#{wrapper}'; e.innerHTML= eval('#{escaped_src}');document.body.appendChild(e);"
|
428
|
+
document.parentWindow.execScript(cmd)
|
429
|
+
wrapper_obj = document.getElementById(wrapper)
|
430
|
+
result_value = wrapper_obj.innerHTML
|
431
|
+
wrapper_obj.style.display = 'none'
|
432
|
+
result_value
|
418
433
|
end
|
419
434
|
|
420
435
|
# clear the list of urls that we have visited
|
data/lib/watir/locator.rb
CHANGED
@@ -3,6 +3,10 @@ module Watir
|
|
3
3
|
include Watir
|
4
4
|
include Watir::Exception
|
5
5
|
|
6
|
+
def document
|
7
|
+
@document ||= @container.document
|
8
|
+
end
|
9
|
+
|
6
10
|
def normalize_specifiers!(specifiers)
|
7
11
|
specifiers.each do |how, what|
|
8
12
|
case how
|
@@ -28,11 +32,35 @@ module Watir
|
|
28
32
|
@specifiers.all? {|how, what| how == :index || match?(element, how, what)}
|
29
33
|
end
|
30
34
|
|
35
|
+
def has_excluding_specifiers?
|
36
|
+
@specifiers.keys.any? {|specifier| [:css, :xpath, :ole_object].include? specifier}
|
37
|
+
end
|
38
|
+
|
31
39
|
def set_specifier(how, what=nil)
|
32
40
|
specifiers = what ? {how => what} : how
|
33
41
|
@specifiers = {:index => Watir::IE.base_index} # default if not specified
|
34
42
|
normalize_specifiers! specifiers
|
35
43
|
end
|
44
|
+
|
45
|
+
def locate_by_id
|
46
|
+
# Searching through all elements returned by __ole_inner_elements
|
47
|
+
# is *significantly* slower than IE's getElementById() and
|
48
|
+
# getElementsByName() calls when how is :id. However
|
49
|
+
# IE doesn't match Regexps, so first we make sure what is a String.
|
50
|
+
# In addition, IE's getElementById() will also return an element
|
51
|
+
# where the :name matches, so we will only return the results of
|
52
|
+
# getElementById() if the matching element actually HAS a matching
|
53
|
+
# :id.
|
54
|
+
|
55
|
+
the_id = @specifiers[:id]
|
56
|
+
if the_id && the_id.class == String
|
57
|
+
element = document.getElementById(the_id) rescue nil
|
58
|
+
# Return if our fast match really HAS a matching :id
|
59
|
+
return element if element && element.invoke('id') == the_id
|
60
|
+
end
|
61
|
+
|
62
|
+
nil
|
63
|
+
end
|
36
64
|
|
37
65
|
def locate_by_xpath_css_ole
|
38
66
|
if @specifiers[:xpath]
|
@@ -41,7 +69,18 @@ module Watir
|
|
41
69
|
return @container.element_by_css(@specifiers[:css])
|
42
70
|
elsif @specifiers[:ole_object]
|
43
71
|
return @specifiers[:ole_object]
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def create_element ole_object
|
76
|
+
if @klass == Element
|
77
|
+
element = Element.new(ole_object)
|
78
|
+
else
|
79
|
+
element = @klass.new(@container, @specifiers, nil)
|
80
|
+
element.ole_object = ole_object
|
81
|
+
def element.locate; @o; end
|
44
82
|
end
|
83
|
+
element
|
45
84
|
end
|
46
85
|
end
|
47
86
|
|
@@ -53,15 +92,8 @@ module Watir
|
|
53
92
|
end
|
54
93
|
|
55
94
|
def each_element tag
|
56
|
-
|
57
|
-
|
58
|
-
element = Element.new(ole_object)
|
59
|
-
else
|
60
|
-
element = @klass.new(@container, @specifiers, nil)
|
61
|
-
element.ole_object = ole_object
|
62
|
-
def element.locate; @o; end unless @klass == TableRow
|
63
|
-
end
|
64
|
-
yield element
|
95
|
+
document.getElementsByTagName(tag).each do |ole_object|
|
96
|
+
yield create_element ole_object
|
65
97
|
end
|
66
98
|
end
|
67
99
|
|
@@ -74,7 +106,9 @@ module Watir
|
|
74
106
|
end
|
75
107
|
|
76
108
|
def locate
|
77
|
-
|
109
|
+
el = locate_by_id
|
110
|
+
return el if el
|
111
|
+
return locate_by_xpath_css_ole if has_excluding_specifiers?
|
78
112
|
|
79
113
|
count = Watir::IE.base_index - 1
|
80
114
|
each do |element|
|
@@ -89,7 +123,7 @@ module Watir
|
|
89
123
|
method = element.method(how)
|
90
124
|
rescue NameError
|
91
125
|
raise MissingWayOfFindingObjectException,
|
92
|
-
"#{how} is an unknown way of finding a <#{@tag}> element (#{what})"
|
126
|
+
"#{how} is an unknown way of finding a <#{@tag || @tags.join(", ")}> element (#{what})"
|
93
127
|
end
|
94
128
|
case method.arity
|
95
129
|
when 0
|
@@ -98,7 +132,7 @@ module Watir
|
|
98
132
|
method.call(what)
|
99
133
|
else
|
100
134
|
raise MissingWayOfFindingObjectException,
|
101
|
-
"#{how} is an unknown way of finding a <#{@tag}> element (#{what})"
|
135
|
+
"#{how} is an unknown way of finding a <#{@tag || @tags.join(", ")}> element (#{what})"
|
102
136
|
end
|
103
137
|
end
|
104
138
|
|
@@ -106,26 +140,23 @@ module Watir
|
|
106
140
|
|
107
141
|
class FrameLocator < TaggedElementLocator
|
108
142
|
def initialize(container)
|
109
|
-
|
110
|
-
@tags = Frame::TAG
|
143
|
+
super(container, Frame::TAG, Frame)
|
111
144
|
end
|
112
145
|
|
113
146
|
def each_element tag
|
114
|
-
frames =
|
147
|
+
frames = document.frames
|
115
148
|
i = 0
|
116
|
-
|
117
|
-
frame =
|
118
|
-
frame.ole_object = ole_object
|
149
|
+
document.getElementsByTagName(tag).each do |ole_object|
|
150
|
+
frame = create_element ole_object
|
119
151
|
frame.document = frames.item(i)
|
120
|
-
def frame.locate; @o; end
|
121
152
|
yield frame
|
122
153
|
i += 1
|
123
154
|
end
|
124
155
|
end
|
125
156
|
|
126
157
|
def each
|
127
|
-
@
|
128
|
-
each_element(
|
158
|
+
@tag.each do |t|
|
159
|
+
each_element(t) do |element|
|
129
160
|
next unless match_with_specifiers?(element)
|
130
161
|
yield element
|
131
162
|
end
|
@@ -134,7 +165,9 @@ module Watir
|
|
134
165
|
end
|
135
166
|
|
136
167
|
def locate
|
137
|
-
|
168
|
+
# do not locate frames by getElementById since can't get the correct
|
169
|
+
# 'document' related with that ole_object like it's done in #each_element
|
170
|
+
return locate_by_xpath_css_ole if has_excluding_specifiers?
|
138
171
|
|
139
172
|
count = Watir::IE.base_index - 1
|
140
173
|
each do |frame|
|
@@ -150,42 +183,31 @@ module Watir
|
|
150
183
|
end
|
151
184
|
|
152
185
|
def each_element(tag)
|
153
|
-
|
154
|
-
|
155
|
-
form_element.ole_object = form
|
156
|
-
def form_element.locate; @o; end
|
157
|
-
yield form_element
|
186
|
+
document.forms.each do |form|
|
187
|
+
yield create_element form
|
158
188
|
end
|
159
189
|
end
|
160
190
|
end
|
161
191
|
|
162
192
|
class InputElementLocator < Locator
|
163
|
-
|
164
|
-
attr_accessor :document, :element, :elements, :klass
|
165
|
-
|
166
193
|
def initialize container, types, klass
|
167
194
|
@container = container
|
168
195
|
@types = types
|
169
|
-
@elements = nil
|
170
196
|
@klass = klass || Element
|
171
197
|
end
|
172
198
|
|
173
199
|
def each_element
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
else
|
178
|
-
element = @klass.new(@container, @specifiers, nil)
|
179
|
-
element.ole_object = object
|
180
|
-
def element.locate; @o; end
|
181
|
-
end
|
182
|
-
yield element
|
200
|
+
elements = locate_by_name || @container.__ole_inner_elements
|
201
|
+
elements.each do |object|
|
202
|
+
yield create_element object
|
183
203
|
end
|
184
204
|
nil
|
185
205
|
end
|
186
206
|
|
187
207
|
def locate
|
188
|
-
|
208
|
+
el = locate_by_id
|
209
|
+
return el if el
|
210
|
+
return locate_by_xpath_css_ole if has_excluding_specifiers?
|
189
211
|
|
190
212
|
count = Watir::IE.base_index - 1
|
191
213
|
each do |element|
|
@@ -214,29 +236,14 @@ module Watir
|
|
214
236
|
what.matches(attribute)
|
215
237
|
end
|
216
238
|
|
217
|
-
|
218
|
-
# Searching through all elements returned by ole_inner_elements
|
219
|
-
# is *significantly* slower than IE's getElementById() and
|
220
|
-
# getElementsByName() calls when how is :id or :name. However
|
221
|
-
# IE doesn't match Regexps, so first we make sure what is a String.
|
222
|
-
# In addition, IE's getElementById() will also return an element
|
223
|
-
# where the :name matches, so we will only return the results of
|
224
|
-
# getElementById() if the matching element actually HAS a matching
|
225
|
-
# :id.
|
226
|
-
|
227
|
-
the_id = @specifiers[:id]
|
228
|
-
if the_id && the_id.class == String &&
|
229
|
-
@specifiers[:index] == Watir::IE.base_index && @specifiers.length == 2
|
230
|
-
@element = @document.getElementById(the_id) rescue nil
|
231
|
-
# Return if our fast match really HAS a matching :id
|
232
|
-
return true if @element && @element.invoke('id') == the_id && @types.include?(@element.getAttribute('type'))
|
233
|
-
end
|
239
|
+
private
|
234
240
|
|
241
|
+
def locate_by_name
|
235
242
|
the_name = @specifiers[:name]
|
236
243
|
if the_name && the_name.class == String
|
237
|
-
|
238
|
-
end
|
239
|
-
|
244
|
+
return document.getElementsByName(the_name) rescue nil
|
245
|
+
end
|
246
|
+
nil
|
240
247
|
end
|
241
248
|
end
|
242
249
|
|
@@ -55,9 +55,20 @@ module Watir
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
-
|
58
|
+
class Ins < NonControlElement
|
59
|
+
Watir::Container.module_eval do
|
60
|
+
remove_method :inss
|
61
|
+
|
62
|
+
def inses(how={}, what=nil)
|
63
|
+
Inses.new(self, how, what)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
%w[Pre P Div Span Map Area Li Ul H1 H2 H3 H4 H5 H6
|
69
|
+
Dl Dt Dd Strong Em Del Font Meta Ol].each do |elem|
|
59
70
|
module_eval %Q{
|
60
|
-
class #{elem
|
71
|
+
class #{elem} < NonControlElement; end
|
61
72
|
}
|
62
73
|
end
|
63
74
|
|
data/lib/watir/table.rb
CHANGED
@@ -247,13 +247,20 @@ module Watir
|
|
247
247
|
|
248
248
|
def locate
|
249
249
|
super
|
250
|
-
if @o
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
250
|
+
cells if @o
|
251
|
+
end
|
252
|
+
|
253
|
+
def cells
|
254
|
+
return @cells if @cells
|
255
|
+
|
256
|
+
@cells = []
|
257
|
+
@o.cells.each do |c|
|
258
|
+
@cells << TableCell.new(@container, :ole_object, c)
|
255
259
|
end
|
260
|
+
@cells
|
256
261
|
end
|
262
|
+
|
263
|
+
private :cells
|
257
264
|
|
258
265
|
# Returns an initialized instance of a table row
|
259
266
|
# * o - the object contained in the row
|
@@ -270,16 +277,16 @@ module Watir
|
|
270
277
|
# this method iterates through each of the cells in the row. Yields a TableCell object
|
271
278
|
def each
|
272
279
|
locate
|
273
|
-
0.upto(
|
280
|
+
0.upto(cells.length - 1) { |i| yield cells[i] }
|
274
281
|
end
|
275
282
|
|
276
283
|
# Returns an element from the row as a TableCell object
|
277
284
|
def [](index)
|
278
285
|
assert_exists
|
279
|
-
if
|
286
|
+
if cells.length <= index
|
280
287
|
raise UnknownCellException, "Unable to locate a cell at index #{index}"
|
281
288
|
end
|
282
|
-
return
|
289
|
+
return cells[index]
|
283
290
|
end
|
284
291
|
|
285
292
|
# defaults all missing methods to the array of elements, to be able to
|
@@ -289,7 +296,7 @@ module Watir
|
|
289
296
|
# end
|
290
297
|
def column_count
|
291
298
|
locate
|
292
|
-
|
299
|
+
cells.length
|
293
300
|
end
|
294
301
|
|
295
302
|
# Returns (multi-dimensional) array of the cell texts in table's row.
|
@@ -363,11 +370,10 @@ module Watir
|
|
363
370
|
super nil
|
364
371
|
end
|
365
372
|
|
366
|
-
def
|
373
|
+
def __ole_inner_elements
|
367
374
|
locate
|
368
375
|
return @o.all
|
369
376
|
end
|
370
|
-
private :ole_inner_elements
|
371
377
|
|
372
378
|
def document
|
373
379
|
locate
|
@@ -0,0 +1,67 @@
|
|
1
|
+
|
2
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
|
3
|
+
require 'unittests/setup'
|
4
|
+
|
5
|
+
class TC_DocumentStandards_Quirks < Test::Unit::TestCase
|
6
|
+
include Watir::Exception
|
7
|
+
|
8
|
+
def setup
|
9
|
+
goto_page 'quirks_document_standards.html'
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_elements_exist_or_not
|
13
|
+
assert(browser.document_mode.to_i == 5)
|
14
|
+
assert(browser.text_field(:name,"quirks_text").exists?)
|
15
|
+
browser.text_field(:name,"quirks_text").set "test"
|
16
|
+
browser.text_field(:name,"quirks_text").fire_event "onClick"
|
17
|
+
assert(browser.text_field(:name,"quirks_text").value == 'test')
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
class TC_DocumentStandards_IE7 < Test::Unit::TestCase
|
22
|
+
include Watir::Exception
|
23
|
+
|
24
|
+
def setup
|
25
|
+
goto_page 'ie7_document_standards.html'
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_elements_exist_or_not
|
29
|
+
assert(browser.document_mode.to_i == 7)
|
30
|
+
assert(browser.text_field(:name,"ie7_text").exists?)
|
31
|
+
browser.text_field(:name,"ie7_text").set "test"
|
32
|
+
browser.text_field(:name,"ie7_text").fire_event "onClick"
|
33
|
+
assert(browser.text_field(:name,"ie7_text").value == 'test')
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
class TC_DocumentStandards_IE8 < Test::Unit::TestCase
|
38
|
+
include Watir::Exception
|
39
|
+
|
40
|
+
def setup
|
41
|
+
goto_page 'ie8_document_standards.html'
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_elements_exist_or_not
|
45
|
+
assert(browser.document_mode.to_i == 8)
|
46
|
+
assert(browser.text_field(:name,"ie8_text").exists?)
|
47
|
+
browser.text_field(:name,"ie8_text").set "test"
|
48
|
+
browser.text_field(:name,"ie8_text").fire_event "onClick"
|
49
|
+
assert(browser.text_field(:name,"ie8_text").value == 'test')
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
class TC_DocumentStandards_IE9 < Test::Unit::TestCase
|
54
|
+
include Watir::Exception
|
55
|
+
|
56
|
+
def setup
|
57
|
+
goto_page 'ie9_document_standards.html'
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_elements_exist_or_not
|
61
|
+
assert(browser.document_mode.to_i == 9)
|
62
|
+
assert(browser.text_field(:name,"ie9_text").exists?)
|
63
|
+
browser.text_field(:name,"ie9_text").set "test"
|
64
|
+
browser.text_field(:name,"ie9_text").fire_event "onClick"
|
65
|
+
assert(browser.text_field(:name,"ie9_text").value == 'test')
|
66
|
+
end
|
67
|
+
end
|
@@ -81,5 +81,14 @@ class TC_ElementCollections < Test::Unit::TestCase
|
|
81
81
|
assert_raises(Watir::Exception::MissingWayOfFindingObjectException) {browser.divs(:index, 1)}
|
82
82
|
end
|
83
83
|
|
84
|
+
def test_table_rows
|
85
|
+
rows = browser.table.rows
|
86
|
+
assert 2, rows.size
|
87
|
+
rows.each_with_index do |row, i|
|
88
|
+
assert Watir::TableRow, row.class
|
89
|
+
assert i == 0 ? "one" : "two", row.class_name
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
84
93
|
end
|
85
94
|
|
data/unittests/frame_test.rb
CHANGED
@@ -173,8 +173,8 @@ class TC_Frame_multiple_attributes < Test::Unit::TestCase
|
|
173
173
|
goto_page "frame_multi.html"
|
174
174
|
end
|
175
175
|
|
176
|
-
def
|
177
|
-
assert_equal('blankpage.html', browser.frame(:
|
176
|
+
def test_get_frame_by_name_and_src
|
177
|
+
assert_equal('blankpage.html', browser.frame(:src => 'blankpage.html', :name => 'buttonFrame2').src)
|
178
178
|
end
|
179
179
|
end
|
180
180
|
|
data/unittests/js_events_test.rb
CHANGED
data/watir.gemspec
CHANGED
@@ -41,7 +41,6 @@ spec = Gem::Specification.new do |s|
|
|
41
41
|
s.add_dependency 'ffi', '~>1.0'
|
42
42
|
s.add_dependency 'rautomation', '~>0.6.3'
|
43
43
|
|
44
|
-
s.has_rdoc = true
|
45
44
|
s.rdoc_options += $WATIR_RDOC_OPTIONS
|
46
45
|
s.extra_rdoc_files = $WATIR_EXTRA_RDOC_FILES
|
47
46
|
s.executables << 'watir-console'
|
metadata
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: watir
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 15424071
|
5
|
+
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 0
|
9
|
+
- 2
|
10
|
+
- rc
|
9
11
|
- 1
|
10
|
-
version: 2.0.
|
12
|
+
version: 2.0.2.rc1
|
11
13
|
platform: ruby
|
12
14
|
authors:
|
13
15
|
- Bret Pettichord
|
@@ -15,7 +17,7 @@ autorequire:
|
|
15
17
|
bindir: bin
|
16
18
|
cert_chain: []
|
17
19
|
|
18
|
-
date: 2011-08
|
20
|
+
date: 2011-09-08 00:00:00 Z
|
19
21
|
dependencies:
|
20
22
|
- !ruby/object:Gem::Dependency
|
21
23
|
name: win32-process
|
@@ -57,12 +59,14 @@ dependencies:
|
|
57
59
|
requirements:
|
58
60
|
- - "="
|
59
61
|
- !ruby/object:Gem::Version
|
60
|
-
hash:
|
62
|
+
hash: 15424071
|
61
63
|
segments:
|
62
64
|
- 2
|
63
65
|
- 0
|
66
|
+
- 2
|
67
|
+
- rc
|
64
68
|
- 1
|
65
|
-
version: 2.0.
|
69
|
+
version: 2.0.2.rc1
|
66
70
|
type: :runtime
|
67
71
|
version_requirements: *id003
|
68
72
|
- !ruby/object:Gem::Dependency
|
@@ -171,6 +175,7 @@ files:
|
|
171
175
|
- unittests/div2_xpath_test.rb
|
172
176
|
- unittests/div_test.rb
|
173
177
|
- unittests/div_xpath_test.rb
|
178
|
+
- unittests/document_standards.rb
|
174
179
|
- unittests/element_collections_test.rb
|
175
180
|
- unittests/element_test.rb
|
176
181
|
- unittests/errorchecker_test.rb
|
@@ -241,6 +246,9 @@ files:
|
|
241
246
|
- unittests/html/frame_links.html
|
242
247
|
- unittests/html/frame_multi.html
|
243
248
|
- unittests/html/google_india.html
|
249
|
+
- unittests/html/ie7_document_standards.html
|
250
|
+
- unittests/html/ie8_document_standards.html
|
251
|
+
- unittests/html/ie9_document_standards.html
|
244
252
|
- unittests/html/iframe.html
|
245
253
|
- unittests/html/iframeTest.html
|
246
254
|
- unittests/html/iframeTest1.html
|
@@ -263,6 +271,7 @@ files:
|
|
263
271
|
- unittests/html/pass.html
|
264
272
|
- unittests/html/popups1.html
|
265
273
|
- unittests/html/pre.html
|
274
|
+
- unittests/html/quirks_document_standards.html
|
266
275
|
- unittests/html/radioButtons1.html
|
267
276
|
- unittests/html/selectboxes1.html
|
268
277
|
- unittests/html/select_tealeaf.html
|
@@ -341,16 +350,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
341
350
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
342
351
|
none: false
|
343
352
|
requirements:
|
344
|
-
- - "
|
353
|
+
- - ">"
|
345
354
|
- !ruby/object:Gem::Version
|
346
|
-
hash:
|
355
|
+
hash: 25
|
347
356
|
segments:
|
348
|
-
-
|
349
|
-
|
357
|
+
- 1
|
358
|
+
- 3
|
359
|
+
- 1
|
360
|
+
version: 1.3.1
|
350
361
|
requirements:
|
351
362
|
- Microsoft Windows running Internet Explorer 5.5 or later.
|
352
363
|
rubyforge_project: Watir
|
353
|
-
rubygems_version: 1.8.
|
364
|
+
rubygems_version: 1.8.10
|
354
365
|
signing_key:
|
355
366
|
specification_version: 3
|
356
367
|
summary: Automated testing tool for web applications.
|