safariwatir 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/safariwatir/core_ext.rb +13 -1
- data/safariwatir/scripter.rb +14 -15
- metadata +3 -3
data/safariwatir/core_ext.rb
CHANGED
data/safariwatir/scripter.rb
CHANGED
@@ -13,13 +13,11 @@ function dispatchOnChange(element) {
|
|
13
13
|
var event = document.createEvent('HTMLEvents');
|
14
14
|
event.initEvent('change', true, true);
|
15
15
|
element.dispatchEvent(event);
|
16
|
-
}
|
17
|
-
|
|
16
|
+
}|
|
18
17
|
|
19
18
|
class JavaScripter
|
20
19
|
def operate(locator, operation)
|
21
|
-
%|#{
|
22
|
-
#{locator}
|
20
|
+
%|#{locator}
|
23
21
|
if (element) {
|
24
22
|
#{operation}
|
25
23
|
} else {
|
@@ -31,7 +29,13 @@ if (element) {
|
|
31
29
|
# Needed because createEvent must be called on a document, and the JavaScripter sub-classes
|
32
30
|
# do some transformations to lower-case "document" before we get here at runtime.
|
33
31
|
script.gsub! "DOCUMENT", "document"
|
34
|
-
|
32
|
+
|
33
|
+
# Needed because I would like to blindly use return statements, but Safari 3 enforces
|
34
|
+
# the ECMAScript standard that return statements are only valid within functions.
|
35
|
+
%|#{JS_LIBRARY}
|
36
|
+
(function() {
|
37
|
+
#{script}
|
38
|
+
})()|
|
35
39
|
end
|
36
40
|
|
37
41
|
def find_cell(cell)
|
@@ -112,10 +116,6 @@ if (element) {
|
|
112
116
|
end
|
113
117
|
end
|
114
118
|
|
115
|
-
def current_location
|
116
|
-
eval_js("window.location.href")
|
117
|
-
end
|
118
|
-
|
119
119
|
def get_text_for(element = @element)
|
120
120
|
execute(element.operate { %|return element.innerText| }, element)
|
121
121
|
end
|
@@ -133,11 +133,11 @@ if (element == undefined) {
|
|
133
133
|
end
|
134
134
|
|
135
135
|
def document_text
|
136
|
-
execute(%|document.getElementsByTagName('BODY').item(0).innerText;|)
|
136
|
+
execute(%|return document.getElementsByTagName('BODY').item(0).innerText;|)
|
137
137
|
end
|
138
138
|
|
139
139
|
def document_html
|
140
|
-
execute(%|document.getElementsByTagName('BODY').item(0).outerHTML;|)
|
140
|
+
execute(%|return document.getElementsByTagName('BODY').item(0).outerHTML;|)
|
141
141
|
end
|
142
142
|
|
143
143
|
def focus(element)
|
@@ -165,7 +165,7 @@ element.style.backgroundColor = 'yellow';|
|
|
165
165
|
block ||= Proc.new {}
|
166
166
|
execute(element.operate(&block), element)
|
167
167
|
return true
|
168
|
-
|
168
|
+
rescue UnknownObjectException
|
169
169
|
return false
|
170
170
|
end
|
171
171
|
|
@@ -459,13 +459,12 @@ SCRIPT`
|
|
459
459
|
end
|
460
460
|
|
461
461
|
def page_load
|
462
|
-
last_location = current_location
|
463
462
|
yield
|
464
463
|
sleep 1
|
465
464
|
|
466
465
|
tries = 0
|
467
|
-
TIMEOUT.times do |tries|
|
468
|
-
if "complete" == eval_js("DOCUMENT.readyState")
|
466
|
+
TIMEOUT.times do |tries|
|
467
|
+
if "complete" == eval_js("return DOCUMENT.readyState") && !@document.URL.get.blank?
|
469
468
|
sleep 0.4
|
470
469
|
handle_client_redirect
|
471
470
|
break
|
metadata
CHANGED
@@ -3,12 +3,12 @@ rubygems_version: 0.9.2
|
|
3
3
|
specification_version: 1
|
4
4
|
name: safariwatir
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.2.
|
7
|
-
date: 2007-
|
6
|
+
version: 0.2.4
|
7
|
+
date: 2007-06-21 00:00:00 -05:00
|
8
8
|
summary: Automated testing tool for web applications.
|
9
9
|
require_paths:
|
10
10
|
- .
|
11
|
-
email: dave
|
11
|
+
email: dave@obtiva.com
|
12
12
|
homepage: http://safariwatir.rubyforge.org/
|
13
13
|
rubyforge_project: safariwatir
|
14
14
|
description: 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.
|