selenium-webdriver 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +18 -2
- data/lib/selenium/webdriver/chrome/bridge.rb +0 -16
- data/lib/selenium/webdriver/chrome/extension.zip +0 -0
- data/lib/selenium/webdriver/chrome/launcher.rb +2 -1
- data/lib/selenium/webdriver/common.rb +2 -1
- data/lib/selenium/webdriver/common/action_builder.rb +97 -0
- data/lib/selenium/webdriver/common/driver.rb +23 -4
- data/lib/selenium/webdriver/common/driver_extensions/has_input_devices.rb +12 -0
- data/lib/selenium/webdriver/common/element.rb +3 -11
- data/lib/selenium/webdriver/common/error.rb +36 -28
- data/lib/selenium/webdriver/common/keyboard.rb +2 -0
- data/lib/selenium/webdriver/common/mouse.rb +2 -0
- data/lib/selenium/webdriver/common/options.rb +0 -8
- data/lib/selenium/webdriver/common/{find.rb → search_context.rb} +3 -3
- data/lib/selenium/webdriver/common/zipper.rb +6 -2
- data/lib/selenium/webdriver/firefox/binary.rb +9 -2
- data/lib/selenium/webdriver/firefox/extension/webdriver.xpi +0 -0
- data/lib/selenium/webdriver/firefox/profile.rb +7 -2
- data/lib/selenium/webdriver/firefox/socket_lock.rb +0 -2
- data/lib/selenium/webdriver/ie/native/win32/IEDriver.dll +0 -0
- data/lib/selenium/webdriver/ie/native/x64/IEDriver.dll +0 -0
- data/lib/selenium/webdriver/remote/bridge.rb +13 -16
- data/lib/selenium/webdriver/remote/commands.rb +1 -3
- data/lib/selenium/webdriver/remote/response.rb +7 -1
- metadata +169 -168
data/CHANGES
CHANGED
@@ -1,5 +1,21 @@
|
|
1
|
+
0.1.4 (2011-03-21)
|
2
|
+
===========
|
3
|
+
|
4
|
+
* Support for Firefox 4.
|
5
|
+
* Search PATH for Firefox / Chrome on OS X as well.
|
6
|
+
* Bump dependencies for ffi and childprocess (#1356).
|
7
|
+
* Find module renamed to SearchContext
|
8
|
+
* Deprecated methods Driver#hover and Options#{speed,speed=} removed.
|
9
|
+
* Improve IE driver stability, IE9 support
|
10
|
+
* Added basic ActionBuilder and HasInputDevices#action. Not applicable for all browsers.
|
11
|
+
* Added Driver#execute_async_script
|
12
|
+
* Some WebDriver exception classes have been renamed to match its Java equivalents:
|
13
|
+
ElementNotEnabledError -> InvalidElementStateError
|
14
|
+
UnknownScriptResultError -> XpathLookupError
|
15
|
+
* Fix bug where Element#disabled? would alternate between true/false (r11438)
|
16
|
+
|
1
17
|
0.1.3 (2011-02-14)
|
2
|
-
|
18
|
+
==================
|
3
19
|
|
4
20
|
* Several crashing bugs fixed in the IE driver.
|
5
21
|
* Alert API available through the remote driver.
|
@@ -18,7 +34,7 @@
|
|
18
34
|
|
19
35
|
|
20
36
|
0.1.2 (2010-12-22)
|
21
|
-
|
37
|
+
==================
|
22
38
|
|
23
39
|
* Changed frame switching behaviour (http://groups.google.com/group/selenium-developers/browse_thread/thread/8dc7938c35bb3968)
|
24
40
|
* IE driver rewrite landed.
|
@@ -37,22 +37,6 @@ module Selenium
|
|
37
37
|
@launcher.quit
|
38
38
|
end
|
39
39
|
|
40
|
-
def setSpeed(value)
|
41
|
-
@speed = value
|
42
|
-
end
|
43
|
-
|
44
|
-
def getSpeed
|
45
|
-
@speed
|
46
|
-
end
|
47
|
-
|
48
|
-
def findElementByCssSelector(parent, selector)
|
49
|
-
find_element_by 'css', selector, parent
|
50
|
-
end
|
51
|
-
|
52
|
-
def findElementsByCssSelector(parent, selector)
|
53
|
-
find_elements_by 'css', selector, parent
|
54
|
-
end
|
55
|
-
|
56
40
|
def getAllCookies
|
57
41
|
execute :getCookies
|
58
42
|
end
|
Binary file
|
@@ -135,7 +135,8 @@ module Selenium
|
|
135
135
|
def macosx_paths
|
136
136
|
[
|
137
137
|
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
|
138
|
-
"#{Platform.home}/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
|
138
|
+
"#{Platform.home}/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
|
139
|
+
Platform.find_binary("Google Chrome")
|
139
140
|
]
|
140
141
|
end
|
141
142
|
|
@@ -14,7 +14,8 @@ require "selenium/webdriver/common/target_locator"
|
|
14
14
|
require "selenium/webdriver/common/navigation"
|
15
15
|
require "selenium/webdriver/common/timeouts"
|
16
16
|
require "selenium/webdriver/common/options"
|
17
|
-
require "selenium/webdriver/common/
|
17
|
+
require "selenium/webdriver/common/search_context"
|
18
|
+
require "selenium/webdriver/common/action_builder"
|
18
19
|
require "selenium/webdriver/common/driver_extensions/takes_screenshot"
|
19
20
|
require "selenium/webdriver/common/driver_extensions/rotatable"
|
20
21
|
require "selenium/webdriver/common/driver_extensions/has_input_devices"
|
@@ -0,0 +1,97 @@
|
|
1
|
+
module Selenium
|
2
|
+
module WebDriver
|
3
|
+
class ActionBuilder
|
4
|
+
|
5
|
+
def initialize(mouse, keyboard)
|
6
|
+
@devices = {
|
7
|
+
:mouse => mouse,
|
8
|
+
:keyboard => keyboard
|
9
|
+
}
|
10
|
+
|
11
|
+
@actions = []
|
12
|
+
end
|
13
|
+
|
14
|
+
def key_down(*args)
|
15
|
+
if args.first.kind_of? Element
|
16
|
+
@actions << [:mouse, :click, args.shift]
|
17
|
+
end
|
18
|
+
|
19
|
+
@actions << [:keyboard, :press, args]
|
20
|
+
self
|
21
|
+
end
|
22
|
+
|
23
|
+
def key_up(*args)
|
24
|
+
if args.first.kind_of? Element
|
25
|
+
@actions << [:mouse, :click, args.shift]
|
26
|
+
end
|
27
|
+
|
28
|
+
@actions << [:keyboard, :release, args]
|
29
|
+
self
|
30
|
+
end
|
31
|
+
|
32
|
+
def send_keys(*args)
|
33
|
+
if args.first.kind_of? Element
|
34
|
+
@actions << [:mouse, :click, args.shift]
|
35
|
+
end
|
36
|
+
|
37
|
+
@actions << [:keyboard, :send_keys, args]
|
38
|
+
self
|
39
|
+
end
|
40
|
+
|
41
|
+
def click_and_hold(element)
|
42
|
+
@actions << [:mouse, :down, element]
|
43
|
+
self
|
44
|
+
end
|
45
|
+
|
46
|
+
def release(element = nil)
|
47
|
+
@actions << [:mouse, :up, element]
|
48
|
+
self
|
49
|
+
end
|
50
|
+
|
51
|
+
def click(element = nil)
|
52
|
+
@actions << [:mouse, :click, element]
|
53
|
+
self
|
54
|
+
end
|
55
|
+
|
56
|
+
def double_click(element = nil)
|
57
|
+
@actions << [:mouse, :double_click, element]
|
58
|
+
self
|
59
|
+
end
|
60
|
+
|
61
|
+
def move_to(element, down_by = nil, right_by = nil)
|
62
|
+
if down_by && right_by
|
63
|
+
@actions << [:mouse, :move_to, element, down_by, right_by]
|
64
|
+
else
|
65
|
+
@actions << [:mouse, :move_to, element]
|
66
|
+
end
|
67
|
+
|
68
|
+
self
|
69
|
+
end
|
70
|
+
|
71
|
+
def move_by(down_by, right_by)
|
72
|
+
@actions << [:mouse, :move_by, down_by, right_by]
|
73
|
+
self
|
74
|
+
end
|
75
|
+
|
76
|
+
def context_click(element = nil)
|
77
|
+
@actions << [:mouse, :context_click, element]
|
78
|
+
self
|
79
|
+
end
|
80
|
+
|
81
|
+
def drag_and_drop(source, target)
|
82
|
+
click_and_hold source
|
83
|
+
move_to target
|
84
|
+
release target
|
85
|
+
|
86
|
+
self
|
87
|
+
end
|
88
|
+
|
89
|
+
def perform
|
90
|
+
@actions.each { |receiver, method, args|
|
91
|
+
@devices.fetch(receiver).__send__(method, *args)
|
92
|
+
}
|
93
|
+
end
|
94
|
+
|
95
|
+
end # ActionBuilder
|
96
|
+
end # WebDriver
|
97
|
+
end # Selenium
|
@@ -4,14 +4,14 @@ module Selenium
|
|
4
4
|
#
|
5
5
|
# The main class through which you control the browser.
|
6
6
|
#
|
7
|
-
# @see
|
7
|
+
# @see SearchContext
|
8
8
|
# @see Navigation
|
9
9
|
# @see TargetLocator
|
10
10
|
# @see Options
|
11
11
|
#
|
12
12
|
|
13
13
|
class Driver
|
14
|
-
include
|
14
|
+
include SearchContext
|
15
15
|
|
16
16
|
class << self
|
17
17
|
|
@@ -201,6 +201,26 @@ module Selenium
|
|
201
201
|
bridge.executeScript(script, *args)
|
202
202
|
end
|
203
203
|
|
204
|
+
# Execute an asynchronous piece of JavaScript in the context of the
|
205
|
+
# currently selected frame or window. Unlike executing
|
206
|
+
# execute_script (synchronous JavaScript), scripts
|
207
|
+
# executed with this method must explicitly signal they are finished by
|
208
|
+
# invoking the provided callback. This callback is always injected into the
|
209
|
+
# executed function as the last argument.
|
210
|
+
#
|
211
|
+
# @param [String] script
|
212
|
+
# JavaSCript source to execute
|
213
|
+
# @param [WebDriver::Element,Integer, Float, Boolean, NilClass, String, Array] *args
|
214
|
+
# Arguments to the script. May be empty.
|
215
|
+
#
|
216
|
+
# @return [WebDriver::Element,Integer,Float,Boolean,NilClass,String,Array]
|
217
|
+
#
|
218
|
+
|
219
|
+
def execute_async_script(script, *args)
|
220
|
+
bridge.executeAsyncScript(script, *args)
|
221
|
+
end
|
222
|
+
|
223
|
+
|
204
224
|
#-------------------------------- sugar --------------------------------
|
205
225
|
|
206
226
|
#
|
@@ -242,10 +262,9 @@ module Selenium
|
|
242
262
|
end
|
243
263
|
|
244
264
|
|
245
|
-
#
|
246
|
-
# for Find
|
247
265
|
#
|
248
266
|
# @api private
|
267
|
+
# @see SearchContext
|
249
268
|
#
|
250
269
|
|
251
270
|
def ref
|
@@ -8,10 +8,22 @@ module Selenium
|
|
8
8
|
module DriverExtensions
|
9
9
|
module HasInputDevices
|
10
10
|
|
11
|
+
def action
|
12
|
+
ActionBuilder.new mouse, keyboard
|
13
|
+
end
|
14
|
+
|
15
|
+
#
|
16
|
+
# @api private
|
17
|
+
#
|
18
|
+
|
11
19
|
def mouse
|
12
20
|
Mouse.new @bridge
|
13
21
|
end
|
14
22
|
|
23
|
+
#
|
24
|
+
# @api private
|
25
|
+
#
|
26
|
+
|
15
27
|
def keyboard
|
16
28
|
Keyboard.new @bridge
|
17
29
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Selenium
|
2
2
|
module WebDriver
|
3
3
|
class Element
|
4
|
-
include
|
4
|
+
include SearchContext
|
5
5
|
|
6
6
|
attr_reader :bridge
|
7
7
|
|
@@ -25,7 +25,7 @@ module Selenium
|
|
25
25
|
alias_method :eql?, :==
|
26
26
|
|
27
27
|
def hash
|
28
|
-
|
28
|
+
@id.hash ^ @bridge.hash
|
29
29
|
end
|
30
30
|
|
31
31
|
#
|
@@ -195,14 +195,6 @@ module Selenium
|
|
195
195
|
bridge.getElementValueOfCssProperty @id, prop
|
196
196
|
end
|
197
197
|
|
198
|
-
#
|
199
|
-
# Hover over this element. Not applicable to all browsers.
|
200
|
-
#
|
201
|
-
|
202
|
-
def hover
|
203
|
-
bridge.hoverOverElement @id
|
204
|
-
end
|
205
|
-
|
206
198
|
#
|
207
199
|
# Get the location of this element.
|
208
200
|
#
|
@@ -282,7 +274,7 @@ module Selenium
|
|
282
274
|
alias_method :[], :attribute
|
283
275
|
|
284
276
|
#
|
285
|
-
# for
|
277
|
+
# for SearchContext and execute_script
|
286
278
|
#
|
287
279
|
# @api private
|
288
280
|
#
|
@@ -3,31 +3,35 @@ module Selenium
|
|
3
3
|
module Error
|
4
4
|
|
5
5
|
class WebDriverError < StandardError; end
|
6
|
-
class IndexOutOfBoundsError < WebDriverError; end
|
7
|
-
class NoCollectionError < WebDriverError; end
|
8
|
-
class NoStringError < WebDriverError; end
|
9
|
-
class NoStringLengthError < WebDriverError; end
|
10
|
-
class NoStringWrapperError < WebDriverError; end
|
11
|
-
class NoSuchDriverError < WebDriverError; end
|
12
|
-
class NoSuchElementError < WebDriverError; end
|
13
|
-
class NoSuchFrameError < WebDriverError; end
|
14
|
-
class UnknownCommandError < WebDriverError; end
|
15
|
-
class ObsoleteElementError < WebDriverError; end
|
16
|
-
class ElementNotDisplayedError < WebDriverError; end
|
17
|
-
class
|
18
|
-
class UnhandledError < WebDriverError; end
|
19
|
-
class ExpectedError < WebDriverError; end
|
20
|
-
class ElementNotSelectableError < WebDriverError; end
|
21
|
-
class NoSuchDocumentError < WebDriverError; end
|
22
|
-
class UnexpectedJavascriptError < WebDriverError; end
|
23
|
-
class NoScriptResultError < WebDriverError; end
|
24
|
-
class
|
25
|
-
class NoSuchCollectionError < WebDriverError; end
|
26
|
-
class TimeOutError < WebDriverError; end
|
27
|
-
class NullPointerError < WebDriverError; end
|
28
|
-
class NoSuchWindowError < WebDriverError; end
|
29
|
-
class InvalidCookieDomainError < WebDriverError; end
|
30
|
-
class UnableToSetCookieError < WebDriverError; end
|
6
|
+
class IndexOutOfBoundsError < WebDriverError; end # 1
|
7
|
+
class NoCollectionError < WebDriverError; end # 2
|
8
|
+
class NoStringError < WebDriverError; end # 3
|
9
|
+
class NoStringLengthError < WebDriverError; end # 4
|
10
|
+
class NoStringWrapperError < WebDriverError; end # 5
|
11
|
+
class NoSuchDriverError < WebDriverError; end # 6
|
12
|
+
class NoSuchElementError < WebDriverError; end # 7
|
13
|
+
class NoSuchFrameError < WebDriverError; end # 8
|
14
|
+
class UnknownCommandError < WebDriverError; end # 9
|
15
|
+
class ObsoleteElementError < WebDriverError; end # 10
|
16
|
+
class ElementNotDisplayedError < WebDriverError; end # 11
|
17
|
+
class InvalidElementStateError < WebDriverError; end # 12
|
18
|
+
class UnhandledError < WebDriverError; end # 13
|
19
|
+
class ExpectedError < WebDriverError; end # 14
|
20
|
+
class ElementNotSelectableError < WebDriverError; end # 15
|
21
|
+
class NoSuchDocumentError < WebDriverError; end # 16
|
22
|
+
class UnexpectedJavascriptError < WebDriverError; end # 17
|
23
|
+
class NoScriptResultError < WebDriverError; end # 18
|
24
|
+
class XPathLookupError < WebDriverError; end # 19
|
25
|
+
class NoSuchCollectionError < WebDriverError; end # 20
|
26
|
+
class TimeOutError < WebDriverError; end # 21
|
27
|
+
class NullPointerError < WebDriverError; end # 22
|
28
|
+
class NoSuchWindowError < WebDriverError; end # 23
|
29
|
+
class InvalidCookieDomainError < WebDriverError; end # 24
|
30
|
+
class UnableToSetCookieError < WebDriverError; end # 25
|
31
|
+
# 26
|
32
|
+
# 27
|
33
|
+
# TimeOutError # 28
|
34
|
+
class InvalidElementCoordinatesError < WebDriverError; end # 29
|
31
35
|
class UnsupportedOperationError < WebDriverError; end
|
32
36
|
|
33
37
|
Errors = [
|
@@ -42,20 +46,24 @@ module Selenium
|
|
42
46
|
UnknownCommandError,
|
43
47
|
ObsoleteElementError,
|
44
48
|
ElementNotDisplayedError,
|
45
|
-
|
49
|
+
InvalidElementStateError,
|
46
50
|
UnhandledError,
|
47
51
|
ExpectedError,
|
48
52
|
ElementNotSelectableError,
|
49
53
|
NoSuchDocumentError,
|
50
54
|
UnexpectedJavascriptError,
|
51
55
|
NoScriptResultError,
|
52
|
-
|
56
|
+
XPathLookupError,
|
53
57
|
NoSuchCollectionError,
|
54
58
|
TimeOutError,
|
55
59
|
NullPointerError,
|
56
60
|
NoSuchWindowError,
|
57
61
|
InvalidCookieDomainError,
|
58
|
-
UnableToSetCookieError
|
62
|
+
UnableToSetCookieError,
|
63
|
+
nil, # not used
|
64
|
+
nil, # not used
|
65
|
+
TimeOutError, # repeated.
|
66
|
+
InvalidElementCoordinatesError
|
59
67
|
]
|
60
68
|
|
61
69
|
class << self
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Selenium
|
2
2
|
module WebDriver
|
3
|
-
module
|
3
|
+
module SearchContext
|
4
4
|
|
5
5
|
FINDERS = {
|
6
6
|
:class => 'ClassName',
|
@@ -47,7 +47,7 @@ module Selenium
|
|
47
47
|
#
|
48
48
|
# Find all elements matching the given arguments
|
49
49
|
#
|
50
|
-
# @see
|
50
|
+
# @see SearchContext#find_element
|
51
51
|
#
|
52
52
|
# @param [:class, :class_name, :id, :link_text, :link, :partial_link_text, :name, :tag_name, :xpath] how
|
53
53
|
# @param [String] what
|
@@ -90,6 +90,6 @@ module Selenium
|
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
93
|
-
end #
|
93
|
+
end # SearchContext
|
94
94
|
end # WebDriver
|
95
95
|
end # Selenium
|
@@ -27,7 +27,9 @@ module Selenium
|
|
27
27
|
|
28
28
|
def self.zip(path)
|
29
29
|
# can't use Tempfile here since it doesn't support File::BINARY mode on 1.8
|
30
|
-
Dir.mktmpdir
|
30
|
+
# can't use Dir.mktmpdir(&blk) because of http://jira.codehaus.org/browse/JRUBY-4082
|
31
|
+
tmp_dir = Dir.mktmpdir
|
32
|
+
begin
|
31
33
|
zip_path = File.join(tmp_dir, "webdriver-zip")
|
32
34
|
|
33
35
|
Zip::ZipFile.open(zip_path, Zip::ZipFile::CREATE) { |zip|
|
@@ -40,7 +42,9 @@ module Selenium
|
|
40
42
|
}
|
41
43
|
|
42
44
|
File.open(zip_path, "rb") { |io| Base64.encode64 io.read }
|
43
|
-
|
45
|
+
ensure
|
46
|
+
FileUtils.rm_rf tmp_dir
|
47
|
+
end
|
44
48
|
end
|
45
49
|
|
46
50
|
end # Zipper
|
@@ -45,7 +45,7 @@ module Selenium
|
|
45
45
|
private
|
46
46
|
|
47
47
|
def execute(*extra_args)
|
48
|
-
args = [self.class.path, "-no-remote"
|
48
|
+
args = [self.class.path, "-no-remote"] + extra_args
|
49
49
|
@process = ChildProcess.build(*args)
|
50
50
|
@process.io.inherit! if $DEBUG
|
51
51
|
@process.start
|
@@ -100,7 +100,7 @@ module Selenium
|
|
100
100
|
def path
|
101
101
|
@path ||= case Platform.os
|
102
102
|
when :macosx
|
103
|
-
|
103
|
+
macosx_path
|
104
104
|
when :windows
|
105
105
|
windows_path
|
106
106
|
when :linux, :unix
|
@@ -124,6 +124,13 @@ module Selenium
|
|
124
124
|
windows_registry_path || likely_windows_path || Platform.find_binary("firefox")
|
125
125
|
end
|
126
126
|
|
127
|
+
def macosx_path
|
128
|
+
path = "/Applications/Firefox.app/Contents/MacOS/firefox-bin"
|
129
|
+
path = Platform.find_binary("firefox-bin") unless File.exist?(path)
|
130
|
+
|
131
|
+
path
|
132
|
+
end
|
133
|
+
|
127
134
|
def windows_registry_path
|
128
135
|
require "win32/registry"
|
129
136
|
|
Binary file
|
@@ -88,12 +88,16 @@ module Selenium
|
|
88
88
|
data = JSON.parse(json).fetch('zip')
|
89
89
|
|
90
90
|
# can't use Tempfile here since it doesn't support File::BINARY mode on 1.8
|
91
|
-
Dir.mktmpdir
|
91
|
+
# can't use Dir.mktmpdir(&blk) because of http://jira.codehaus.org/browse/JRUBY-4082
|
92
|
+
tmp_dir = Dir.mktmpdir
|
93
|
+
begin
|
92
94
|
zip_path = File.join(tmp_dir, "webdriver-profile-duplicate-#{json.hash}")
|
93
95
|
File.open(zip_path, "wb") { |zip_file| zip_file << Base64.decode64(data) }
|
94
96
|
|
95
97
|
new Zipper.unzip(zip_path)
|
96
|
-
|
98
|
+
ensure
|
99
|
+
FileUtils.rm_rf tmp_dir
|
100
|
+
end
|
97
101
|
end
|
98
102
|
|
99
103
|
#
|
@@ -319,6 +323,7 @@ module Selenium
|
|
319
323
|
"extensions.update.notifyUser" => 'false',
|
320
324
|
"network.manage-offline-status" => 'false',
|
321
325
|
"network.http.max-connections-per-server" => '10',
|
326
|
+
"prompts.tab_modal.enabled" => "false",
|
322
327
|
"security.warn_entering_secure" => 'false',
|
323
328
|
"security.warn_submit_insecure" => 'false',
|
324
329
|
"security.warn_entering_secure.show_once" => 'false',
|
Binary file
|
Binary file
|
@@ -11,7 +11,6 @@ module Selenium
|
|
11
11
|
#
|
12
12
|
|
13
13
|
class Bridge
|
14
|
-
include Find
|
15
14
|
include BridgeHelper
|
16
15
|
|
17
16
|
#
|
@@ -195,27 +194,24 @@ module Selenium
|
|
195
194
|
execute :getCurrentWindowHandle
|
196
195
|
end
|
197
196
|
|
198
|
-
def setSpeed(value)
|
199
|
-
execute :setSpeed, {}, :speed => value
|
200
|
-
end
|
201
|
-
|
202
|
-
def getSpeed
|
203
|
-
execute :getSpeed
|
204
|
-
end
|
205
|
-
|
206
197
|
def getScreenshot
|
207
198
|
execute :screenshot
|
208
199
|
end
|
209
200
|
|
210
201
|
def executeScript(script, *args)
|
211
|
-
|
212
|
-
raise Error::UnsupportedOperationError, "underlying webdriver instance does not support javascript"
|
213
|
-
end
|
202
|
+
assert_javascript_enabled
|
214
203
|
|
215
204
|
result = execute :executeScript, {}, :script => script, :args => args
|
216
205
|
unwrap_script_result result
|
217
206
|
end
|
218
207
|
|
208
|
+
def executeAsyncScript(script, *args)
|
209
|
+
assert_javascript_enabled
|
210
|
+
|
211
|
+
result = execute :executeAsyncScript, {}, :script => script, :args => args
|
212
|
+
unwrap_script_result result
|
213
|
+
end
|
214
|
+
|
219
215
|
def addCookie(cookie)
|
220
216
|
execute :addCookie, {}, :cookie => cookie
|
221
217
|
end
|
@@ -411,10 +407,6 @@ module Selenium
|
|
411
407
|
end
|
412
408
|
alias_method :switchToActiveElement, :getActiveElement
|
413
409
|
|
414
|
-
def hoverOverElement(element)
|
415
|
-
execute :hoverOverElement, :id => element
|
416
|
-
end
|
417
|
-
|
418
410
|
def dragElement(element, rigth_by, down_by)
|
419
411
|
execute :dragElement, {:id => element}, :x => rigth_by, :y => down_by
|
420
412
|
end
|
@@ -445,6 +437,11 @@ module Selenium
|
|
445
437
|
ids.map { |id| Element.new self, element_id_from(id) }
|
446
438
|
end
|
447
439
|
|
440
|
+
def assert_javascript_enabled
|
441
|
+
unless capabilities.javascript_enabled?
|
442
|
+
raise Error::UnsupportedOperationError, "underlying webdriver instance does not support javascript"
|
443
|
+
end
|
444
|
+
end
|
448
445
|
|
449
446
|
#
|
450
447
|
# executes a command on the remote server via the REST / JSON API.
|
@@ -22,11 +22,10 @@ class Selenium::WebDriver::Remote::Bridge
|
|
22
22
|
command :goBack, :post, "session/:session_id/back"
|
23
23
|
command :refresh, :post, "session/:session_id/refresh"
|
24
24
|
command :executeScript, :post, "session/:session_id/execute"
|
25
|
+
command :executeAsyncScript, :post, "session/:session_id/execute_async"
|
25
26
|
command :screenshot, :get, "session/:session_id/screenshot"
|
26
27
|
command :switchToFrame, :post, "session/:session_id/frame"
|
27
28
|
command :switchToWindow, :post, "session/:session_id/window"
|
28
|
-
command :getSpeed, :get, "session/:session_id/speed"
|
29
|
-
command :setSpeed, :post, "session/:session_id/speed"
|
30
29
|
command :getAllCookies, :get, "session/:session_id/cookie"
|
31
30
|
command :addCookie, :post, "session/:session_id/cookie"
|
32
31
|
command :deleteAllCookies, :delete, "session/:session_id/cookie"
|
@@ -55,7 +54,6 @@ class Selenium::WebDriver::Remote::Bridge
|
|
55
54
|
command :getElementLocation, :get, "session/:session_id/element/:id/location"
|
56
55
|
command :getElementLocationOnceScrolledIntoView, :get, "session/:session_id/element/:id/location_in_view"
|
57
56
|
command :getElementSize, :get, "session/:session_id/element/:id/size"
|
58
|
-
command :hoverOverElement, :post, "session/:session_id/element/:id/hover"
|
59
57
|
command :dragElement, :post, "session/:session_id/element/:id/drag"
|
60
58
|
command :getElementValueOfCssProperty, :get, "session/:session_id/element/:id/css/:property_name"
|
61
59
|
command :close, :delete, "session/:session_id/window"
|
@@ -54,6 +54,8 @@ module Selenium
|
|
54
54
|
return unless server_trace = @payload['value']['stackTrace']
|
55
55
|
|
56
56
|
backtrace = server_trace.map do |frame|
|
57
|
+
next unless frame.kind_of?(Hash)
|
58
|
+
|
57
59
|
file = frame['fileName']
|
58
60
|
line = frame['lineNumber']
|
59
61
|
meth = frame['methodName']
|
@@ -62,8 +64,12 @@ module Selenium
|
|
62
64
|
file = "#{class_name}(#{file})"
|
63
65
|
end
|
64
66
|
|
67
|
+
if meth.nil? || meth.empty?
|
68
|
+
meth = 'unknown'
|
69
|
+
end
|
70
|
+
|
65
71
|
"[remote server] #{file}:#{line}:in `#{meth}'"
|
66
|
-
end
|
72
|
+
end.compact
|
67
73
|
|
68
74
|
ex.set_backtrace(backtrace + ex.backtrace)
|
69
75
|
end
|
metadata
CHANGED
@@ -2,94 +2,94 @@
|
|
2
2
|
name: selenium-webdriver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.4
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
|
-
|
8
|
+
- Jari Bakken
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-03-21 00:00:00 +01:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: json_pure
|
18
|
+
prerelease: false
|
19
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ">="
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: "0"
|
25
|
+
type: :runtime
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rubyzip
|
29
|
+
prerelease: false
|
30
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
31
|
+
none: false
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: "0"
|
36
|
+
type: :runtime
|
37
|
+
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: childprocess
|
40
|
+
prerelease: false
|
41
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 0.1.7
|
47
|
+
type: :runtime
|
48
|
+
version_requirements: *id003
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: ffi
|
51
|
+
prerelease: false
|
52
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: 1.0.7
|
58
|
+
type: :runtime
|
59
|
+
version_requirements: *id004
|
60
|
+
- !ruby/object:Gem::Dependency
|
61
|
+
name: rspec
|
62
|
+
prerelease: false
|
63
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
64
|
+
none: false
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: "2.0"
|
69
|
+
type: :development
|
70
|
+
version_requirements: *id005
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: rack
|
73
|
+
prerelease: false
|
74
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - ~>
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: "1.0"
|
80
|
+
type: :development
|
81
|
+
version_requirements: *id006
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
name: ci_reporter
|
84
|
+
prerelease: false
|
85
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
87
|
+
requirements:
|
88
|
+
- - ~>
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: 1.6.2
|
91
|
+
type: :development
|
92
|
+
version_requirements: *id007
|
93
93
|
description: WebDriver is a tool for writing automated tests of websites. It aims to mimic the behaviour of a real user, and as such interacts with the HTML of the application.
|
94
94
|
email: jari.bakken@gmail.com
|
95
95
|
executables: []
|
@@ -99,86 +99,87 @@ extensions: []
|
|
99
99
|
extra_rdoc_files: []
|
100
100
|
|
101
101
|
files:
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
102
|
+
- lib/selenium/client/base.rb
|
103
|
+
- lib/selenium/client/driver.rb
|
104
|
+
- lib/selenium/client/errors.rb
|
105
|
+
- lib/selenium/client/extensions.rb
|
106
|
+
- lib/selenium/client/idiomatic.rb
|
107
|
+
- lib/selenium/client/javascript_expression_builder.rb
|
108
|
+
- lib/selenium/client/javascript_frameworks/jquery.rb
|
109
|
+
- lib/selenium/client/javascript_frameworks/prototype.rb
|
110
|
+
- lib/selenium/client/legacy_driver.rb
|
111
|
+
- lib/selenium/client/protocol.rb
|
112
|
+
- lib/selenium/client/selenium_helper.rb
|
113
|
+
- lib/selenium/client.rb
|
114
|
+
- lib/selenium/rake/server_task.rb
|
115
|
+
- lib/selenium/server.rb
|
116
|
+
- lib/selenium/webdriver/android/bridge.rb
|
117
|
+
- lib/selenium/webdriver/android.rb
|
118
|
+
- lib/selenium/webdriver/chrome/bridge.rb
|
119
|
+
- lib/selenium/webdriver/chrome/command_executor.rb
|
120
|
+
- lib/selenium/webdriver/chrome/extension.zip
|
121
|
+
- lib/selenium/webdriver/chrome/launcher.rb
|
122
|
+
- lib/selenium/webdriver/chrome.rb
|
123
|
+
- lib/selenium/webdriver/common/action_builder.rb
|
124
|
+
- lib/selenium/webdriver/common/alert.rb
|
125
|
+
- lib/selenium/webdriver/common/bridge_helper.rb
|
126
|
+
- lib/selenium/webdriver/common/core_ext/dir.rb
|
127
|
+
- lib/selenium/webdriver/common/core_ext/string.rb
|
128
|
+
- lib/selenium/webdriver/common/driver.rb
|
129
|
+
- lib/selenium/webdriver/common/driver_extensions/has_input_devices.rb
|
130
|
+
- lib/selenium/webdriver/common/driver_extensions/rotatable.rb
|
131
|
+
- lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb
|
132
|
+
- lib/selenium/webdriver/common/element.rb
|
133
|
+
- lib/selenium/webdriver/common/error.rb
|
134
|
+
- lib/selenium/webdriver/common/file_reaper.rb
|
135
|
+
- lib/selenium/webdriver/common/keyboard.rb
|
136
|
+
- lib/selenium/webdriver/common/keys.rb
|
137
|
+
- lib/selenium/webdriver/common/mouse.rb
|
138
|
+
- lib/selenium/webdriver/common/navigation.rb
|
139
|
+
- lib/selenium/webdriver/common/options.rb
|
140
|
+
- lib/selenium/webdriver/common/platform.rb
|
141
|
+
- lib/selenium/webdriver/common/proxy.rb
|
142
|
+
- lib/selenium/webdriver/common/search_context.rb
|
143
|
+
- lib/selenium/webdriver/common/socket_poller.rb
|
144
|
+
- lib/selenium/webdriver/common/target_locator.rb
|
145
|
+
- lib/selenium/webdriver/common/timeouts.rb
|
146
|
+
- lib/selenium/webdriver/common/wait.rb
|
147
|
+
- lib/selenium/webdriver/common/zipper.rb
|
148
|
+
- lib/selenium/webdriver/common.rb
|
149
|
+
- lib/selenium/webdriver/firefox/binary.rb
|
150
|
+
- lib/selenium/webdriver/firefox/bridge.rb
|
151
|
+
- lib/selenium/webdriver/firefox/extension/webdriver.xpi
|
152
|
+
- lib/selenium/webdriver/firefox/extension.rb
|
153
|
+
- lib/selenium/webdriver/firefox/launcher.rb
|
154
|
+
- lib/selenium/webdriver/firefox/native/linux/amd64/x_ignore_nofocus.so
|
155
|
+
- lib/selenium/webdriver/firefox/native/linux/x86/x_ignore_nofocus.so
|
156
|
+
- lib/selenium/webdriver/firefox/profile.rb
|
157
|
+
- lib/selenium/webdriver/firefox/profiles_ini.rb
|
158
|
+
- lib/selenium/webdriver/firefox/socket_lock.rb
|
159
|
+
- lib/selenium/webdriver/firefox/util.rb
|
160
|
+
- lib/selenium/webdriver/firefox.rb
|
161
|
+
- lib/selenium/webdriver/ie/bridge.rb
|
162
|
+
- lib/selenium/webdriver/ie/native/win32/IEDriver.dll
|
163
|
+
- lib/selenium/webdriver/ie/native/x64/IEDriver.dll
|
164
|
+
- lib/selenium/webdriver/ie/server.rb
|
165
|
+
- lib/selenium/webdriver/ie.rb
|
166
|
+
- lib/selenium/webdriver/iphone/bridge.rb
|
167
|
+
- lib/selenium/webdriver/iphone.rb
|
168
|
+
- lib/selenium/webdriver/remote/bridge.rb
|
169
|
+
- lib/selenium/webdriver/remote/capabilities.rb
|
170
|
+
- lib/selenium/webdriver/remote/commands.rb
|
171
|
+
- lib/selenium/webdriver/remote/http/common.rb
|
172
|
+
- lib/selenium/webdriver/remote/http/curb.rb
|
173
|
+
- lib/selenium/webdriver/remote/http/default.rb
|
174
|
+
- lib/selenium/webdriver/remote/http/persistent.rb
|
175
|
+
- lib/selenium/webdriver/remote/response.rb
|
176
|
+
- lib/selenium/webdriver/remote/server_error.rb
|
177
|
+
- lib/selenium/webdriver/remote.rb
|
178
|
+
- lib/selenium/webdriver.rb
|
179
|
+
- lib/selenium-client.rb
|
180
|
+
- lib/selenium-webdriver.rb
|
181
|
+
- CHANGES
|
182
|
+
- README
|
182
183
|
has_rdoc: true
|
183
184
|
homepage: http://selenium.googlecode.com
|
184
185
|
licenses: []
|
@@ -187,23 +188,23 @@ post_install_message:
|
|
187
188
|
rdoc_options: []
|
188
189
|
|
189
190
|
require_paths:
|
190
|
-
|
191
|
+
- lib
|
191
192
|
required_ruby_version: !ruby/object:Gem::Requirement
|
192
193
|
none: false
|
193
194
|
requirements:
|
194
|
-
|
195
|
-
|
196
|
-
|
195
|
+
- - ">="
|
196
|
+
- !ruby/object:Gem::Version
|
197
|
+
version: "0"
|
197
198
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
198
199
|
none: false
|
199
200
|
requirements:
|
200
|
-
|
201
|
-
|
202
|
-
|
201
|
+
- - ">="
|
202
|
+
- !ruby/object:Gem::Version
|
203
|
+
version: "0"
|
203
204
|
requirements: []
|
204
205
|
|
205
206
|
rubyforge_project:
|
206
|
-
rubygems_version: 1.
|
207
|
+
rubygems_version: 1.5.2
|
207
208
|
signing_key:
|
208
209
|
specification_version: 3
|
209
210
|
summary: The next generation developer focused tool for automated testing of webapps
|