selenium-webdriver 2.15.0 → 2.16.0
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 +23 -0
- data/README +1 -1
- data/lib/selenium/client/legacy_driver.rb +1 -1
- data/lib/selenium/server.rb +24 -7
- data/lib/selenium/webdriver/chrome/bridge.rb +21 -12
- data/lib/selenium/webdriver/common/action_builder.rb +226 -2
- data/lib/selenium/webdriver/common/element.rb +7 -0
- data/lib/selenium/webdriver/common/keyboard.rb +2 -2
- data/lib/selenium/webdriver/common/window.rb +43 -6
- data/lib/selenium/webdriver/firefox/extension/webdriver.xpi +0 -0
- data/lib/selenium/webdriver/firefox/profile.rb +1 -0
- 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 +5 -1
- data/lib/selenium/webdriver/remote/http/common.rb +1 -0
- data/lib/selenium/webdriver/remote/response.rb +17 -3
- metadata +55 -55
data/CHANGES
CHANGED
@@ -1,3 +1,26 @@
|
|
1
|
+
2.16.0 (2012-01-04)
|
2
|
+
===================
|
3
|
+
|
4
|
+
* Firefox:
|
5
|
+
* Native events support for Firefox 9
|
6
|
+
* Allow apps to use offline storage by default
|
7
|
+
* Fix excessive unwrapping when executing mouseMove
|
8
|
+
* Click in the middle, rather than the top-left of elements (#3034, #2700)
|
9
|
+
* IE:
|
10
|
+
* Raise StaleElementReferenceError when interacting with elements outside the currently focused frame
|
11
|
+
* Handle frames and iframes in showModalDialog windows
|
12
|
+
* Chrome:
|
13
|
+
* Improve client handling of invalid error responses
|
14
|
+
* iPhone:
|
15
|
+
* Updated to latest CocoaHTTPServer
|
16
|
+
* Remote:
|
17
|
+
* Improve performance of Element#== by only making an RPC when necessary.
|
18
|
+
* Disallow caching of GET requests
|
19
|
+
* Various:
|
20
|
+
* Raise ArgumentError instead of UnsupportedOperationError on invalid modifier key
|
21
|
+
* Improve docs for Server, ActionBuilder and Window
|
22
|
+
* Update to latest Sizzle (used for :css selectors in older browsers)
|
23
|
+
|
1
24
|
2.15.0 (2011-12-08)
|
2
25
|
===================
|
3
26
|
|
data/README
CHANGED
@@ -15,7 +15,7 @@ gem install selenium-webdriver
|
|
15
15
|
|
16
16
|
= LICENSE
|
17
17
|
|
18
|
-
Copyright 2009-
|
18
|
+
Copyright 2009-2012 Software Freedom Conservancy
|
19
19
|
|
20
20
|
Licensed under the Apache License, Version 2.0 (the "License");
|
21
21
|
you may not use this file except in compliance with the License.
|
data/lib/selenium/server.rb
CHANGED
@@ -22,6 +22,17 @@ module Selenium
|
|
22
22
|
# server = Selenium::Server.get :latest
|
23
23
|
# server.start
|
24
24
|
#
|
25
|
+
# Run the server in the background:
|
26
|
+
#
|
27
|
+
# server = Selenium::Server.new(jar, :background => true)
|
28
|
+
# server.start
|
29
|
+
#
|
30
|
+
# Add additional arguments:
|
31
|
+
#
|
32
|
+
# server = Selenium::Server.new(jar)
|
33
|
+
# server << ["--additional", "args"]
|
34
|
+
# server.start
|
35
|
+
#
|
25
36
|
|
26
37
|
class Server
|
27
38
|
class Error < StandardError; end
|
@@ -90,6 +101,18 @@ module Selenium
|
|
90
101
|
end
|
91
102
|
end
|
92
103
|
|
104
|
+
#
|
105
|
+
# @param [String] jar Path to the server jar.
|
106
|
+
# @param [Hash] opts the options to create the server process with
|
107
|
+
#
|
108
|
+
# @option opts [Integer] :port Port the server should listen on (default: 4444).
|
109
|
+
# @option opts [Integer] :timeout Seconds to wait for server launch/shutdown (default: 30)
|
110
|
+
# @option opts [true,false] :background Run the server in the background (default: false)
|
111
|
+
# @option opts [true,false,String] :log Either a path to a log file,
|
112
|
+
# or true to pass server log to stdout.
|
113
|
+
# @raise [Errno::ENOENT] if the jar file does not exist
|
114
|
+
#
|
115
|
+
|
93
116
|
def initialize(jar, opts = {})
|
94
117
|
raise Errno::ENOENT, jar unless File.exist?(jar)
|
95
118
|
|
@@ -107,13 +130,7 @@ module Selenium
|
|
107
130
|
process.start
|
108
131
|
poll_for_service
|
109
132
|
|
110
|
-
unless @background
|
111
|
-
begin
|
112
|
-
sleep 1 while process.alive?
|
113
|
-
rescue Errno::ECHILD
|
114
|
-
# no longer alive
|
115
|
-
end
|
116
|
-
end
|
133
|
+
process.wait unless @background
|
117
134
|
end
|
118
135
|
|
119
136
|
def stop
|
@@ -46,7 +46,7 @@ module Selenium
|
|
46
46
|
private
|
47
47
|
|
48
48
|
def create_capabilities(opts)
|
49
|
-
|
49
|
+
args = opts.delete(:args) || opts.delete(:switches)
|
50
50
|
native_events = opts.delete(:native_events)
|
51
51
|
verbose = opts.delete(:verbose)
|
52
52
|
profile = opts.delete(:profile)
|
@@ -56,28 +56,37 @@ module Selenium
|
|
56
56
|
raise ArgumentError, "unknown option#{'s' if opts.size != 1}: #{opts.inspect}"
|
57
57
|
end
|
58
58
|
|
59
|
-
|
59
|
+
chrome_options = {}
|
60
60
|
|
61
|
-
if
|
62
|
-
unless
|
63
|
-
raise ArgumentError, ":
|
61
|
+
if args
|
62
|
+
unless args.kind_of? Array
|
63
|
+
raise ArgumentError, ":args must be an Array of Strings"
|
64
64
|
end
|
65
65
|
|
66
|
-
|
66
|
+
chrome_options['args'] = args.map { |e| e.to_s }
|
67
67
|
end
|
68
68
|
|
69
69
|
if profile
|
70
70
|
data = profile.as_json
|
71
71
|
|
72
|
-
|
73
|
-
|
72
|
+
chrome_options.merge! 'profile' => data['zip'],
|
73
|
+
'extensions' => data['extensions']
|
74
74
|
end
|
75
75
|
|
76
76
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
77
|
+
chrome_options['binary'] = Chrome.path if Chrome.path
|
78
|
+
chrome_options['nativeEvents'] = true if native_events
|
79
|
+
chrome_options['verbose'] = true if verbose
|
80
|
+
chrome_options['detach'] = detach.nil? || !!detach
|
81
|
+
|
82
|
+
caps = Remote::Capabilities.chrome
|
83
|
+
caps['chromeOptions'] = chrome_options
|
84
|
+
|
85
|
+
# legacy options - for chromedriver < 17.0.963.0
|
86
|
+
caps["chrome.switches"] = chrome_options['args'] if chrome_options.member?('args')
|
87
|
+
%w[binary detach extensions nativeEvents profile verbose].each do |key|
|
88
|
+
caps["chrome.#{key}"] = chrome_options[key] if chrome_options.member?(key)
|
89
|
+
end
|
81
90
|
|
82
91
|
caps
|
83
92
|
end
|
@@ -9,7 +9,7 @@ module Selenium
|
|
9
9
|
# Selenium::WebDriver::DriverExtensions::HasInputDevices#action, which
|
10
10
|
# is available on Driver instances that support the user interaction API.
|
11
11
|
#
|
12
|
-
#
|
12
|
+
# @example
|
13
13
|
#
|
14
14
|
# driver.action.key_down(:shift).
|
15
15
|
# click(element).
|
@@ -34,6 +34,32 @@ module Selenium
|
|
34
34
|
@actions = []
|
35
35
|
end
|
36
36
|
|
37
|
+
#
|
38
|
+
# Performs a modifier key press. Does not release
|
39
|
+
# the modifier key - subsequent interactions may assume it's kept pressed.
|
40
|
+
# Note that the modifier key is never released implicitly - either
|
41
|
+
# #key_up(key) or #send_keys(:null) must be called to release the modifier.
|
42
|
+
#
|
43
|
+
# Equivalent to:
|
44
|
+
# driver.action.click(element).send_keys(key)
|
45
|
+
# # or
|
46
|
+
# driver.action.click.send_keys(key)
|
47
|
+
#
|
48
|
+
# @example Press a key
|
49
|
+
#
|
50
|
+
# driver.action.key_down(:control).perform
|
51
|
+
#
|
52
|
+
# @example Press a key on an element
|
53
|
+
#
|
54
|
+
# el = driver.find_element(:id, "some_id")
|
55
|
+
# driver.action.key_down(el, :shift).perform
|
56
|
+
#
|
57
|
+
# @param [:shift, :alt, :control, :command, :meta] The key to press.
|
58
|
+
# @param [Selenium::WebDriver::Element] element An optional element
|
59
|
+
# @raise [ArgumentError] if the given key is not a modifier
|
60
|
+
# @return [ActionBuilder] A self reference.
|
61
|
+
#
|
62
|
+
|
37
63
|
def key_down(*args)
|
38
64
|
if args.first.kind_of? Element
|
39
65
|
@actions << [:mouse, :click, [args.shift]]
|
@@ -43,6 +69,25 @@ module Selenium
|
|
43
69
|
self
|
44
70
|
end
|
45
71
|
|
72
|
+
#
|
73
|
+
# Performs a modifier key release.
|
74
|
+
# Releasing a non-depressed modifier key will yield undefined behaviour.
|
75
|
+
#
|
76
|
+
# @example Release a key
|
77
|
+
#
|
78
|
+
# driver.action.key_up(:shift).perform
|
79
|
+
#
|
80
|
+
# @example Release a key from an element
|
81
|
+
#
|
82
|
+
# el = driver.find_element(:id, "some_id")
|
83
|
+
# driver.action.key_up(el, :alt).perform
|
84
|
+
#
|
85
|
+
# @param [:shift, :alt, :control, :command, :meta] The modifier key to release.
|
86
|
+
# @param [Selenium::WebDriver::Element] element An optional element
|
87
|
+
# @raise [ArgumentError] if the given key is not a modifier key
|
88
|
+
# @return [ActionBuilder] A self reference.
|
89
|
+
#
|
90
|
+
|
46
91
|
def key_up(*args)
|
47
92
|
if args.first.kind_of? Element
|
48
93
|
@actions << [:mouse, :click, [args.shift]]
|
@@ -52,6 +97,27 @@ module Selenium
|
|
52
97
|
self
|
53
98
|
end
|
54
99
|
|
100
|
+
#
|
101
|
+
# Sends keys to the active element. This differs from calling
|
102
|
+
# Element#send_keys(keys) on the active element in two ways:
|
103
|
+
#
|
104
|
+
# * The modifier keys included in this call are not released.
|
105
|
+
# * There is no attempt to re-focus the element - so send_keys(:tab) for switching elements should work.
|
106
|
+
#
|
107
|
+
# @example Send the text "help" to an element
|
108
|
+
#
|
109
|
+
# el = driver.find_element(:id, "some_id")
|
110
|
+
# driver.action.send_keys(el, "help").perform
|
111
|
+
#
|
112
|
+
# @example Send the text "help" to the currently focused element
|
113
|
+
#
|
114
|
+
# driver.action.send_keys("help").perform
|
115
|
+
#
|
116
|
+
# @param [Selenium::WebDriver::Element] element An optional element
|
117
|
+
# @param [String] keys The keys to be sent.
|
118
|
+
# @return [ActionBuilder] A self reference.
|
119
|
+
#
|
120
|
+
|
55
121
|
def send_keys(*args)
|
56
122
|
if args.first.kind_of? Element
|
57
123
|
@actions << [:mouse, :click, [args.shift]]
|
@@ -61,26 +127,111 @@ module Selenium
|
|
61
127
|
self
|
62
128
|
end
|
63
129
|
|
130
|
+
#
|
131
|
+
# Clicks (without releasing) in the middle of the given element. This is
|
132
|
+
# equivalent to:
|
133
|
+
#
|
134
|
+
# driver.action.move_to(element).click_and_hold
|
135
|
+
#
|
136
|
+
# @example Clicking and holding on some element
|
137
|
+
#
|
138
|
+
# el = driver.find_element(:id, "some_id")
|
139
|
+
# driver.action.click_and_hold(el).perform
|
140
|
+
#
|
141
|
+
# @param [Selenium::WebDriver::Element] element the element to move to and click.
|
142
|
+
# @return [ActionBuilder] A self reference.
|
143
|
+
#
|
144
|
+
|
64
145
|
def click_and_hold(element)
|
65
146
|
@actions << [:mouse, :down, [element]]
|
66
147
|
self
|
67
148
|
end
|
68
149
|
|
150
|
+
#
|
151
|
+
# Releases the depressed left mouse button at the current mouse location.
|
152
|
+
#
|
153
|
+
# @example Releasing an element after clicking and holding it
|
154
|
+
#
|
155
|
+
# el = driver.find_element(:id, "some_id")
|
156
|
+
# driver.action.click_and_hold(el).release.perform
|
157
|
+
#
|
158
|
+
# @return [ActionBuilder] A self reference.
|
159
|
+
#
|
160
|
+
|
69
161
|
def release(element = nil)
|
70
162
|
@actions << [:mouse, :up, [element]]
|
71
163
|
self
|
72
164
|
end
|
73
165
|
|
166
|
+
#
|
167
|
+
# Clicks in the middle of the given element. Equivalent to:
|
168
|
+
#
|
169
|
+
# driver.action.move_to(element).click
|
170
|
+
#
|
171
|
+
# When no element is passed, the current mouse position will be clicked.
|
172
|
+
#
|
173
|
+
# @example Clicking on an element
|
174
|
+
#
|
175
|
+
# el = driver.find_element(:id, "some_id")
|
176
|
+
# driver.action.click(el).perform
|
177
|
+
#
|
178
|
+
# @example Clicking at the current mouse position
|
179
|
+
#
|
180
|
+
# driver.action.click.perform
|
181
|
+
#
|
182
|
+
# @param [Selenium::WebDriver::Element] element An optional element to click.
|
183
|
+
# @return [ActionBuilder] A self reference.
|
184
|
+
#
|
185
|
+
|
74
186
|
def click(element = nil)
|
75
187
|
@actions << [:mouse, :click, [element]]
|
76
188
|
self
|
77
189
|
end
|
78
190
|
|
191
|
+
#
|
192
|
+
# Performs a double-click at middle of the given element. Equivalent to:
|
193
|
+
#
|
194
|
+
# driver.action.move_to(element).double_click
|
195
|
+
#
|
196
|
+
# @example Double click an element
|
197
|
+
#
|
198
|
+
# el = driver.find_element(:id, "some_id")
|
199
|
+
# driver.action.double_click(el).perform
|
200
|
+
#
|
201
|
+
# @param [Selenium::WebDriver::Element] element An optional element to move to.
|
202
|
+
# @return [ActionBuilder] A self reference.
|
203
|
+
#
|
204
|
+
|
79
205
|
def double_click(element = nil)
|
80
206
|
@actions << [:mouse, :double_click, [element]]
|
81
207
|
self
|
82
208
|
end
|
83
209
|
|
210
|
+
#
|
211
|
+
# Moves the mouse to the middle of the given element. The element is scrolled into
|
212
|
+
# view and its location is calculated using getBoundingClientRect. Then the
|
213
|
+
# mouse is moved to optional offset coordinates from the element.
|
214
|
+
#
|
215
|
+
# Note that when using offsets, both coordinates need to be passed.
|
216
|
+
#
|
217
|
+
# @example Scroll element into view and move the mouse to it
|
218
|
+
#
|
219
|
+
# el = driver.find_element(:id, "some_id")
|
220
|
+
# driver.action.move_to(el).perform
|
221
|
+
#
|
222
|
+
# @example
|
223
|
+
#
|
224
|
+
# el = driver.find_element(:id, "some_id")
|
225
|
+
# driver.action.move_to(el, 100, 100).perform
|
226
|
+
#
|
227
|
+
# @param [Selenium::WebDriver::Element] element to move to.
|
228
|
+
# @param [Integer] right_by Optional offset from the top-left corner. A negative value means
|
229
|
+
# coordinates right from the element.
|
230
|
+
# @param [Integer] down_by Optional offset from the top-left corner. A negative value means
|
231
|
+
# coordinates above the element.
|
232
|
+
# @return [ActionBuilder] A self reference.
|
233
|
+
#
|
234
|
+
|
84
235
|
def move_to(element, right_by = nil, down_by = nil)
|
85
236
|
if right_by && down_by
|
86
237
|
@actions << [:mouse, :move_to, [element, right_by, down_by]]
|
@@ -91,16 +242,65 @@ module Selenium
|
|
91
242
|
self
|
92
243
|
end
|
93
244
|
|
245
|
+
#
|
246
|
+
# Moves the mouse from its current position (or 0,0) by the given offset.
|
247
|
+
# If the coordinates provided are outside the viewport (the mouse will
|
248
|
+
# end up outside the browser window) then the viewport is scrolled to
|
249
|
+
# match.
|
250
|
+
#
|
251
|
+
# @example Move the mouse to a certain offset from its current position
|
252
|
+
#
|
253
|
+
# driver.action.move_by(100, 100).perform
|
254
|
+
#
|
255
|
+
# @param [Integer] right_by horizontal offset. A negative value means moving the
|
256
|
+
# mouse left.
|
257
|
+
# @param [Integer] down_by vertical offset. A negative value means moving the mouse
|
258
|
+
# up.
|
259
|
+
# @return [ActionBuilder] A self reference.
|
260
|
+
# @raise [MoveTargetOutOfBoundsError] if the provided offset is outside
|
261
|
+
# the document's boundaries.
|
262
|
+
#
|
263
|
+
|
94
264
|
def move_by(right_by, down_by)
|
95
265
|
@actions << [:mouse, :move_by, [right_by, down_by]]
|
96
266
|
self
|
97
267
|
end
|
98
268
|
|
99
|
-
|
269
|
+
#
|
270
|
+
# Performs a context-click at middle of the given element. First performs
|
271
|
+
# a move_to to the location of the element.
|
272
|
+
#
|
273
|
+
# @example Context-click at middle of given element
|
274
|
+
#
|
275
|
+
# el = driver.find_element(:id, "some_id")
|
276
|
+
# driver.action.context_click(el).perform
|
277
|
+
#
|
278
|
+
# @param [Selenium::WebDriver::Element] element An element to context click.
|
279
|
+
# @return [ActionBuilder] A self reference.
|
280
|
+
#
|
281
|
+
|
282
|
+
def context_click(element)
|
100
283
|
@actions << [:mouse, :context_click, [element]]
|
101
284
|
self
|
102
285
|
end
|
103
286
|
|
287
|
+
#
|
288
|
+
# A convenience method that performs click-and-hold at the location of the
|
289
|
+
# source element, moves to the location of the target element, then
|
290
|
+
# releases the mouse.
|
291
|
+
#
|
292
|
+
# @example Drag and drop one element onto another
|
293
|
+
#
|
294
|
+
# el1 = driver.find_element(:id, "some_id1")
|
295
|
+
# el2 = driver.find_element(:id, "some_id2")
|
296
|
+
# driver.action.drag_and_drop(el1, el2).perform
|
297
|
+
#
|
298
|
+
# @param [Selenium::WebDriver::Element] source element to emulate button down at.
|
299
|
+
# @param [Selenium::WebDriver::Element] target element to move to and release the
|
300
|
+
# mouse at.
|
301
|
+
# @return [ActionBuilder] A self reference.
|
302
|
+
#
|
303
|
+
|
104
304
|
def drag_and_drop(source, target)
|
105
305
|
click_and_hold source
|
106
306
|
move_to target
|
@@ -109,6 +309,23 @@ module Selenium
|
|
109
309
|
self
|
110
310
|
end
|
111
311
|
|
312
|
+
#
|
313
|
+
# A convenience method that performs click-and-hold at the location of
|
314
|
+
# the source element, moves by a given offset, then releases the mouse.
|
315
|
+
#
|
316
|
+
# @example Drag and drop an element by offset
|
317
|
+
#
|
318
|
+
# el = driver.find_element(:id, "some_id1")
|
319
|
+
# driver.action.drag_and_drop_by(el, 100, 100).perform
|
320
|
+
#
|
321
|
+
# @param [Selenium::WebDriver::Element] source Element to emulate button down at.
|
322
|
+
# @param [Integer] right_by horizontal move offset.
|
323
|
+
# @param [Integer] down_by vertical move offset.
|
324
|
+
# @param [Selenium::WebDriver::Element] target Element to move to and release the
|
325
|
+
# mouse at.
|
326
|
+
# @return [ActionBuilder] A self reference.
|
327
|
+
#
|
328
|
+
|
112
329
|
def drag_and_drop_by(source, right_by, down_by)
|
113
330
|
click_and_hold source
|
114
331
|
move_by right_by, down_by
|
@@ -117,10 +334,17 @@ module Selenium
|
|
117
334
|
self
|
118
335
|
end
|
119
336
|
|
337
|
+
|
338
|
+
#
|
339
|
+
# Executes the actions added to the builder.
|
340
|
+
#
|
341
|
+
|
120
342
|
def perform
|
121
343
|
@actions.each { |receiver, method, args|
|
122
344
|
@devices.fetch(receiver).__send__(method, *args)
|
123
345
|
}
|
346
|
+
|
347
|
+
nil
|
124
348
|
end
|
125
349
|
|
126
350
|
end # ActionBuilder
|
@@ -152,6 +152,13 @@ module Selenium
|
|
152
152
|
#
|
153
153
|
# Get the value of the given CSS property
|
154
154
|
#
|
155
|
+
# Note that shorthand CSS properties (e.g. background, font, border, border-top, margin,
|
156
|
+
# margin-top, padding, padding-top, list-style, outline, pause, cue) are not returned,
|
157
|
+
# in accordance with the DOM CSS2 specification - you should directly access the longhand
|
158
|
+
# properties (e.g. background-color) to access the desired values.
|
159
|
+
#
|
160
|
+
# @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration
|
161
|
+
#
|
155
162
|
|
156
163
|
def style(prop)
|
157
164
|
bridge.getElementValueOfCssProperty @id, prop
|
@@ -13,7 +13,7 @@ module Selenium
|
|
13
13
|
end
|
14
14
|
|
15
15
|
#
|
16
|
-
#
|
16
|
+
# Press a modifier key
|
17
17
|
#
|
18
18
|
# @see Selenium::WebDriver::Keys
|
19
19
|
#
|
@@ -42,7 +42,7 @@ module Selenium
|
|
42
42
|
|
43
43
|
def assert_modifier(key)
|
44
44
|
unless MODIFIERS.include? key
|
45
|
-
raise
|
45
|
+
raise ArgumentError,
|
46
46
|
"#{key.inspect} is not a modifier key, expected one of #{MODIFIERS.inspect}"
|
47
47
|
end
|
48
48
|
end
|
@@ -1,16 +1,26 @@
|
|
1
1
|
module Selenium
|
2
2
|
module WebDriver
|
3
|
-
|
3
|
+
|
4
4
|
#
|
5
5
|
# @api beta This API may be changed or removed in a future release.
|
6
|
-
#
|
7
|
-
|
6
|
+
#
|
7
|
+
|
8
8
|
class Window
|
9
9
|
|
10
|
+
#
|
11
|
+
# @api private
|
12
|
+
#
|
13
|
+
|
10
14
|
def initialize(bridge)
|
11
15
|
@bridge = bridge
|
12
16
|
end
|
13
17
|
|
18
|
+
#
|
19
|
+
# Resize the current window to the given dimension.
|
20
|
+
#
|
21
|
+
# @param [Selenium::WebDriver::Dimension, #width and #height] dimension The new size.
|
22
|
+
#
|
23
|
+
|
14
24
|
def size=(dimension)
|
15
25
|
unless dimension.respond_to?(:width) && dimension.respond_to?(:height)
|
16
26
|
raise ArgumentError, "expected #{dimension.inspect}:#{dimension.class}" +
|
@@ -20,10 +30,22 @@ module Selenium
|
|
20
30
|
@bridge.setWindowSize dimension.width, dimension.height
|
21
31
|
end
|
22
32
|
|
33
|
+
#
|
34
|
+
# Get the size of the current window.
|
35
|
+
#
|
36
|
+
# @return [Selenium::WebDriver::Dimension] The size.
|
37
|
+
#
|
38
|
+
|
23
39
|
def size
|
24
40
|
@bridge.getWindowSize
|
25
41
|
end
|
26
42
|
|
43
|
+
#
|
44
|
+
# Move the current window to the given position.
|
45
|
+
#
|
46
|
+
# @param [Selenium::WebDriver::Point, #x and #y] point The new position.
|
47
|
+
#
|
48
|
+
|
27
49
|
def position=(point)
|
28
50
|
unless point.respond_to?(:x) && point.respond_to?(:y)
|
29
51
|
raise ArgumentError, "expected #{point.inspect}:#{point.class}" +
|
@@ -33,12 +55,23 @@ module Selenium
|
|
33
55
|
@bridge.setWindowPosition point.x, point.y
|
34
56
|
end
|
35
57
|
|
58
|
+
#
|
59
|
+
# Get the position of the current window.
|
60
|
+
#
|
61
|
+
# @return [Selenium::WebDriver::Point] The position.
|
62
|
+
#
|
63
|
+
|
36
64
|
def position
|
37
65
|
@bridge.getWindowPosition
|
38
66
|
end
|
39
67
|
|
40
68
|
#
|
41
|
-
#
|
69
|
+
# Equivalent to #size=, but accepts width and height arguments.
|
70
|
+
#
|
71
|
+
# @example Maximize the window.
|
72
|
+
#
|
73
|
+
# max_width, max_height = driver.execute_script("return [window.screen.availWidth, window.screen.availHeight];")
|
74
|
+
# driver.manage.window.resize_to(max_width, max_height)
|
42
75
|
#
|
43
76
|
|
44
77
|
def resize_to(width, height)
|
@@ -46,7 +79,11 @@ module Selenium
|
|
46
79
|
end
|
47
80
|
|
48
81
|
#
|
49
|
-
#
|
82
|
+
# Equivalent to #position=, but accepts x and y arguments.
|
83
|
+
#
|
84
|
+
# @example
|
85
|
+
#
|
86
|
+
# driver.manage.window.move_to(300, 400)
|
50
87
|
#
|
51
88
|
|
52
89
|
def move_to(x, y)
|
@@ -56,4 +93,4 @@ module Selenium
|
|
56
93
|
|
57
94
|
end
|
58
95
|
end
|
59
|
-
end
|
96
|
+
end
|
Binary file
|
@@ -287,6 +287,7 @@ module Selenium
|
|
287
287
|
"network.manage-offline-status" => 'false',
|
288
288
|
"network.http.phishy-userpass-length" => '255',
|
289
289
|
"network.http.max-connections-per-server" => '10',
|
290
|
+
"offline-apps.allow_by_default" => 'true',
|
290
291
|
"prompts.tab_modal.enabled" => "false",
|
291
292
|
"security.warn_entering_secure" => 'false',
|
292
293
|
"security.warn_submit_insecure" => 'false',
|
Binary file
|
Binary file
|
@@ -386,7 +386,11 @@ module Selenium
|
|
386
386
|
end
|
387
387
|
|
388
388
|
def elementEquals(element, other)
|
389
|
-
|
389
|
+
if element.ref == other.ref
|
390
|
+
true
|
391
|
+
else
|
392
|
+
execute :elementEquals, :id => element.ref, :other => other.ref
|
393
|
+
end
|
390
394
|
end
|
391
395
|
|
392
396
|
def find_element_by(how, what, parent = nil)
|
@@ -21,6 +21,7 @@ module Selenium
|
|
21
21
|
def call(verb, url, command_hash)
|
22
22
|
url = server_url.merge(url) unless url.kind_of?(URI)
|
23
23
|
headers = DEFAULT_HEADERS.dup
|
24
|
+
headers['Cache-Control'] = "no-cache" if verb == :get
|
24
25
|
|
25
26
|
if command_hash
|
26
27
|
payload = MultiJson.encode(command_hash)
|
@@ -16,7 +16,7 @@ module Selenium
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def error
|
19
|
-
klass = Error.for_code(
|
19
|
+
klass = Error.for_code(status) || return
|
20
20
|
|
21
21
|
ex = klass.new(error_message)
|
22
22
|
ex.set_backtrace(caller)
|
@@ -26,7 +26,7 @@ module Selenium
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def error_message
|
29
|
-
val =
|
29
|
+
val = value
|
30
30
|
|
31
31
|
case val
|
32
32
|
when Hash
|
@@ -34,6 +34,8 @@ module Selenium
|
|
34
34
|
msg << " (#{ val['class'] })" if val['class']
|
35
35
|
when String
|
36
36
|
msg = val
|
37
|
+
else
|
38
|
+
msg = "unknown error, status=#{status}: #{val.inspect}"
|
37
39
|
end
|
38
40
|
|
39
41
|
msg
|
@@ -56,7 +58,11 @@ module Selenium
|
|
56
58
|
end
|
57
59
|
|
58
60
|
def add_backtrace(ex)
|
59
|
-
|
61
|
+
unless value.kind_of?(Hash) && value['stackTrace']
|
62
|
+
return
|
63
|
+
end
|
64
|
+
|
65
|
+
server_trace = value['stackTrace']
|
60
66
|
|
61
67
|
backtrace = server_trace.map do |frame|
|
62
68
|
next unless frame.kind_of?(Hash)
|
@@ -79,6 +85,14 @@ module Selenium
|
|
79
85
|
ex.set_backtrace(backtrace + ex.backtrace)
|
80
86
|
end
|
81
87
|
|
88
|
+
def status
|
89
|
+
@payload['status']
|
90
|
+
end
|
91
|
+
|
92
|
+
def value
|
93
|
+
@payload['value']
|
94
|
+
end
|
95
|
+
|
82
96
|
end # Response
|
83
97
|
end # Remote
|
84
98
|
end # WebDriver
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: selenium-webdriver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 2.
|
5
|
+
version: 2.16.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Jari Bakken
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date:
|
13
|
+
date: 2012-01-05 00:00:00 +01:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
requirements:
|
44
44
|
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: 0.2.
|
46
|
+
version: 0.2.5
|
47
47
|
type: :runtime
|
48
48
|
version_requirements: *id003
|
49
49
|
- !ruby/object:Gem::Dependency
|
@@ -115,92 +115,92 @@ files:
|
|
115
115
|
- lib/selenium/client.rb
|
116
116
|
- lib/selenium/server.rb
|
117
117
|
- lib/selenium/webdriver.rb
|
118
|
-
- lib/selenium/client/base.rb
|
119
118
|
- lib/selenium/client/driver.rb
|
120
|
-
- lib/selenium/client/errors.rb
|
121
119
|
- lib/selenium/client/extensions.rb
|
122
|
-
- lib/selenium/client/idiomatic.rb
|
123
120
|
- lib/selenium/client/javascript_expression_builder.rb
|
121
|
+
- lib/selenium/client/base.rb
|
122
|
+
- lib/selenium/client/selenium_helper.rb
|
124
123
|
- lib/selenium/client/legacy_driver.rb
|
124
|
+
- lib/selenium/client/errors.rb
|
125
125
|
- lib/selenium/client/protocol.rb
|
126
|
-
- lib/selenium/client/
|
127
|
-
- lib/selenium/client/javascript_frameworks/jquery.rb
|
126
|
+
- lib/selenium/client/idiomatic.rb
|
128
127
|
- lib/selenium/client/javascript_frameworks/prototype.rb
|
128
|
+
- lib/selenium/client/javascript_frameworks/jquery.rb
|
129
129
|
- lib/selenium/rake/server_task.rb
|
130
|
-
- lib/selenium/webdriver/android.rb
|
131
130
|
- lib/selenium/webdriver/chrome.rb
|
132
|
-
- lib/selenium/webdriver/
|
131
|
+
- lib/selenium/webdriver/iphone.rb
|
132
|
+
- lib/selenium/webdriver/remote.rb
|
133
133
|
- lib/selenium/webdriver/firefox.rb
|
134
|
+
- lib/selenium/webdriver/common.rb
|
134
135
|
- lib/selenium/webdriver/ie.rb
|
135
|
-
- lib/selenium/webdriver/iphone.rb
|
136
136
|
- lib/selenium/webdriver/opera.rb
|
137
|
-
- lib/selenium/webdriver/remote.rb
|
138
137
|
- lib/selenium/webdriver/support.rb
|
138
|
+
- lib/selenium/webdriver/android.rb
|
139
139
|
- lib/selenium/webdriver/android/bridge.rb
|
140
|
+
- lib/selenium/webdriver/iphone/bridge.rb
|
141
|
+
- lib/selenium/webdriver/support/event_firing_bridge.rb
|
142
|
+
- lib/selenium/webdriver/support/abstract_event_listener.rb
|
143
|
+
- lib/selenium/webdriver/support/block_event_listener.rb
|
144
|
+
- lib/selenium/webdriver/support/select.rb
|
140
145
|
- lib/selenium/webdriver/chrome/bridge.rb
|
141
146
|
- lib/selenium/webdriver/chrome/profile.rb
|
142
147
|
- lib/selenium/webdriver/chrome/service.rb
|
143
|
-
- lib/selenium/webdriver/
|
148
|
+
- lib/selenium/webdriver/opera/bridge.rb
|
149
|
+
- lib/selenium/webdriver/opera/service.rb
|
150
|
+
- lib/selenium/webdriver/remote/bridge.rb
|
151
|
+
- lib/selenium/webdriver/remote/commands.rb
|
152
|
+
- lib/selenium/webdriver/remote/server_error.rb
|
153
|
+
- lib/selenium/webdriver/remote/capabilities.rb
|
154
|
+
- lib/selenium/webdriver/remote/response.rb
|
155
|
+
- lib/selenium/webdriver/remote/http/persistent.rb
|
156
|
+
- lib/selenium/webdriver/remote/http/curb.rb
|
157
|
+
- lib/selenium/webdriver/remote/http/default.rb
|
158
|
+
- lib/selenium/webdriver/remote/http/common.rb
|
159
|
+
- lib/selenium/webdriver/firefox/bridge.rb
|
160
|
+
- lib/selenium/webdriver/firefox/profile.rb
|
161
|
+
- lib/selenium/webdriver/firefox/socket_lock.rb
|
162
|
+
- lib/selenium/webdriver/firefox/util.rb
|
163
|
+
- lib/selenium/webdriver/firefox/binary.rb
|
164
|
+
- lib/selenium/webdriver/firefox/extension.rb
|
165
|
+
- lib/selenium/webdriver/firefox/profiles_ini.rb
|
166
|
+
- lib/selenium/webdriver/firefox/launcher.rb
|
167
|
+
- lib/selenium/webdriver/firefox/extension/webdriver.xpi
|
168
|
+
- lib/selenium/webdriver/firefox/native/linux/amd64/x_ignore_nofocus.so
|
169
|
+
- lib/selenium/webdriver/firefox/native/linux/x86/x_ignore_nofocus.so
|
170
|
+
- lib/selenium/webdriver/common/platform.rb
|
144
171
|
- lib/selenium/webdriver/common/alert.rb
|
145
|
-
- lib/selenium/webdriver/common/bridge_helper.rb
|
146
|
-
- lib/selenium/webdriver/common/driver.rb
|
147
|
-
- lib/selenium/webdriver/common/element.rb
|
148
|
-
- lib/selenium/webdriver/common/error.rb
|
149
|
-
- lib/selenium/webdriver/common/file_reaper.rb
|
150
|
-
- lib/selenium/webdriver/common/keyboard.rb
|
151
172
|
- lib/selenium/webdriver/common/keys.rb
|
173
|
+
- lib/selenium/webdriver/common/action_builder.rb
|
174
|
+
- lib/selenium/webdriver/common/driver.rb
|
152
175
|
- lib/selenium/webdriver/common/mouse.rb
|
176
|
+
- lib/selenium/webdriver/common/socket_poller.rb
|
177
|
+
- lib/selenium/webdriver/common/element.rb
|
178
|
+
- lib/selenium/webdriver/common/window.rb
|
179
|
+
- lib/selenium/webdriver/common/wait.rb
|
153
180
|
- lib/selenium/webdriver/common/navigation.rb
|
154
|
-
- lib/selenium/webdriver/common/
|
155
|
-
- lib/selenium/webdriver/common/
|
181
|
+
- lib/selenium/webdriver/common/file_reaper.rb
|
182
|
+
- lib/selenium/webdriver/common/bridge_helper.rb
|
156
183
|
- lib/selenium/webdriver/common/port_prober.rb
|
157
|
-
- lib/selenium/webdriver/common/profile_helper.rb
|
158
|
-
- lib/selenium/webdriver/common/proxy.rb
|
159
184
|
- lib/selenium/webdriver/common/search_context.rb
|
160
|
-
- lib/selenium/webdriver/common/socket_poller.rb
|
161
185
|
- lib/selenium/webdriver/common/target_locator.rb
|
186
|
+
- lib/selenium/webdriver/common/keyboard.rb
|
162
187
|
- lib/selenium/webdriver/common/timeouts.rb
|
163
|
-
- lib/selenium/webdriver/common/
|
164
|
-
- lib/selenium/webdriver/common/
|
188
|
+
- lib/selenium/webdriver/common/error.rb
|
189
|
+
- lib/selenium/webdriver/common/profile_helper.rb
|
190
|
+
- lib/selenium/webdriver/common/options.rb
|
165
191
|
- lib/selenium/webdriver/common/zipper.rb
|
192
|
+
- lib/selenium/webdriver/common/proxy.rb
|
166
193
|
- lib/selenium/webdriver/common/core_ext/base64.rb
|
167
194
|
- lib/selenium/webdriver/common/core_ext/dir.rb
|
168
195
|
- lib/selenium/webdriver/common/core_ext/string.rb
|
196
|
+
- lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb
|
169
197
|
- lib/selenium/webdriver/common/driver_extensions/has_input_devices.rb
|
170
198
|
- lib/selenium/webdriver/common/driver_extensions/rotatable.rb
|
171
|
-
- lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb
|
172
199
|
- lib/selenium/webdriver/common/driver_extensions/uploads_files.rb
|
173
|
-
- lib/selenium/webdriver/firefox/binary.rb
|
174
|
-
- lib/selenium/webdriver/firefox/bridge.rb
|
175
|
-
- lib/selenium/webdriver/firefox/extension.rb
|
176
|
-
- lib/selenium/webdriver/firefox/launcher.rb
|
177
|
-
- lib/selenium/webdriver/firefox/profile.rb
|
178
|
-
- lib/selenium/webdriver/firefox/profiles_ini.rb
|
179
|
-
- lib/selenium/webdriver/firefox/socket_lock.rb
|
180
|
-
- lib/selenium/webdriver/firefox/util.rb
|
181
|
-
- lib/selenium/webdriver/firefox/extension/webdriver.xpi
|
182
|
-
- lib/selenium/webdriver/firefox/native/linux/amd64/x_ignore_nofocus.so
|
183
|
-
- lib/selenium/webdriver/firefox/native/linux/x86/x_ignore_nofocus.so
|
184
200
|
- lib/selenium/webdriver/ie/bridge.rb
|
185
201
|
- lib/selenium/webdriver/ie/server.rb
|
186
|
-
- lib/selenium/webdriver/ie/native/win32/IEDriver.dll
|
187
202
|
- lib/selenium/webdriver/ie/native/x64/IEDriver.dll
|
188
|
-
- lib/selenium/webdriver/
|
189
|
-
- lib/selenium/webdriver/opera/bridge.rb
|
190
|
-
- lib/selenium/webdriver/opera/service.rb
|
191
|
-
- lib/selenium/webdriver/remote/bridge.rb
|
192
|
-
- lib/selenium/webdriver/remote/capabilities.rb
|
193
|
-
- lib/selenium/webdriver/remote/commands.rb
|
194
|
-
- lib/selenium/webdriver/remote/response.rb
|
195
|
-
- lib/selenium/webdriver/remote/server_error.rb
|
196
|
-
- lib/selenium/webdriver/remote/http/common.rb
|
197
|
-
- lib/selenium/webdriver/remote/http/curb.rb
|
198
|
-
- lib/selenium/webdriver/remote/http/default.rb
|
199
|
-
- lib/selenium/webdriver/remote/http/persistent.rb
|
200
|
-
- lib/selenium/webdriver/support/abstract_event_listener.rb
|
201
|
-
- lib/selenium/webdriver/support/block_event_listener.rb
|
202
|
-
- lib/selenium/webdriver/support/event_firing_bridge.rb
|
203
|
-
- lib/selenium/webdriver/support/select.rb
|
203
|
+
- lib/selenium/webdriver/ie/native/win32/IEDriver.dll
|
204
204
|
- CHANGES
|
205
205
|
- README
|
206
206
|
has_rdoc: true
|