selenium-webdriver 2.53.4 → 3.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGES +363 -10
- data/LICENSE +1 -1
- data/README.md +2 -3
- data/lib/selenium-webdriver.rb +0 -2
- data/lib/selenium/server.rb +69 -70
- data/lib/selenium/webdriver.rb +32 -23
- data/lib/selenium/webdriver/atoms.rb +18 -0
- data/lib/selenium/webdriver/atoms/getAttribute.js +8 -0
- data/lib/selenium/webdriver/chrome.rb +8 -6
- data/lib/selenium/webdriver/chrome/driver.rb +112 -0
- data/lib/selenium/webdriver/chrome/options.rb +168 -0
- data/lib/selenium/webdriver/chrome/profile.rb +17 -17
- data/lib/selenium/webdriver/chrome/service.rb +22 -89
- data/lib/selenium/webdriver/common.rb +13 -6
- data/lib/selenium/webdriver/common/action_builder.rb +49 -57
- data/lib/selenium/webdriver/common/alert.rb +5 -15
- data/lib/selenium/webdriver/common/bridge_helper.rb +10 -17
- data/lib/selenium/webdriver/common/driver.rb +53 -68
- data/lib/selenium/webdriver/common/driver_extensions/{has_input_devices.rb → has_addons.rb} +13 -23
- data/lib/selenium/webdriver/common/driver_extensions/has_location.rb +4 -8
- data/lib/selenium/webdriver/common/driver_extensions/has_network_connection.rb +4 -7
- data/lib/selenium/webdriver/common/driver_extensions/has_remote_status.rb +0 -4
- data/lib/selenium/webdriver/common/driver_extensions/has_session_id.rb +0 -4
- data/lib/selenium/webdriver/common/driver_extensions/has_touch_screen.rb +1 -5
- data/lib/selenium/webdriver/common/driver_extensions/has_web_storage.rb +0 -5
- data/lib/selenium/webdriver/common/driver_extensions/rotatable.rb +4 -9
- data/lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb +7 -7
- data/lib/selenium/webdriver/common/driver_extensions/uploads_files.rb +2 -7
- data/lib/selenium/webdriver/common/element.rb +57 -39
- data/lib/selenium/webdriver/common/error.rb +204 -106
- data/lib/selenium/webdriver/common/file_reaper.rb +3 -11
- data/lib/selenium/webdriver/common/html5/local_storage.rb +6 -10
- data/lib/selenium/webdriver/common/html5/session_storage.rb +6 -10
- data/lib/selenium/webdriver/common/html5/shared_web_storage.rb +7 -18
- data/lib/selenium/webdriver/{safari/options.rb → common/interactions/input_device.rb} +20 -31
- data/lib/selenium/webdriver/common/interactions/interaction.rb +50 -0
- data/lib/selenium/webdriver/{safari/browser.rb → common/interactions/interactions.rb} +16 -15
- data/lib/selenium/webdriver/common/interactions/key_actions.rb +143 -0
- data/lib/selenium/webdriver/common/interactions/key_input.rb +62 -0
- data/lib/selenium/webdriver/{android.rb → common/interactions/none_input.rb} +11 -6
- data/lib/selenium/webdriver/common/interactions/pointer_actions.rb +353 -0
- data/lib/selenium/webdriver/common/interactions/pointer_input.rb +132 -0
- data/lib/selenium/webdriver/common/keyboard.rb +7 -14
- data/lib/selenium/webdriver/common/keys.rb +99 -82
- data/lib/selenium/webdriver/common/log_entry.rb +3 -6
- data/lib/selenium/webdriver/common/logger.rb +140 -0
- data/lib/selenium/webdriver/common/logs.rb +2 -6
- data/lib/selenium/webdriver/common/mouse.rb +9 -14
- data/lib/selenium/webdriver/common/navigation.rb +2 -6
- data/lib/selenium/webdriver/common/options.rb +20 -23
- data/lib/selenium/webdriver/common/platform.rb +70 -97
- data/lib/selenium/webdriver/common/port_prober.rb +3 -4
- data/lib/selenium/webdriver/common/profile_helper.rb +6 -11
- data/lib/selenium/webdriver/common/proxy.rb +58 -72
- data/lib/selenium/webdriver/common/search_context.rb +22 -29
- data/lib/selenium/webdriver/common/service.rb +161 -0
- data/lib/selenium/webdriver/common/socket_lock.rb +6 -14
- data/lib/selenium/webdriver/common/socket_poller.rb +5 -12
- data/lib/selenium/webdriver/common/target_locator.rb +11 -15
- data/lib/selenium/webdriver/common/timeouts.rb +4 -8
- data/lib/selenium/webdriver/common/touch_action_builder.rb +2 -6
- data/lib/selenium/webdriver/common/touch_screen.rb +19 -23
- data/lib/selenium/webdriver/common/w3c_action_builder.rb +209 -0
- data/lib/selenium/webdriver/{phantomjs.rb → common/w3c_options.rb} +16 -14
- data/lib/selenium/webdriver/common/wait.rb +6 -13
- data/lib/selenium/webdriver/common/window.rb +48 -17
- data/lib/selenium/webdriver/common/zipper.rb +6 -10
- data/lib/selenium/webdriver/edge.rb +5 -12
- data/lib/selenium/webdriver/edge/bridge.rb +32 -63
- data/lib/selenium/webdriver/edge/driver.rb +73 -0
- data/lib/selenium/webdriver/edge/service.rb +18 -87
- data/lib/selenium/webdriver/firefox.rb +20 -11
- data/lib/selenium/webdriver/firefox/binary.rb +40 -56
- data/lib/selenium/webdriver/firefox/driver.rb +48 -0
- data/lib/selenium/webdriver/firefox/extension.rb +18 -8
- data/lib/selenium/webdriver/firefox/extension/prefs.json +3 -11
- data/lib/selenium/webdriver/firefox/extension/webdriver.xpi +0 -0
- data/lib/selenium/webdriver/firefox/launcher.rb +13 -22
- data/lib/selenium/webdriver/firefox/legacy/driver.rb +79 -0
- data/lib/selenium/webdriver/{iphone.rb → firefox/marionette/bridge.rb} +25 -6
- data/lib/selenium/webdriver/firefox/marionette/driver.rb +96 -0
- data/lib/selenium/webdriver/firefox/options.rb +149 -0
- data/lib/selenium/webdriver/firefox/profile.rb +46 -46
- data/lib/selenium/webdriver/firefox/profiles_ini.rb +8 -18
- data/lib/selenium/webdriver/firefox/service.rb +23 -83
- data/lib/selenium/webdriver/firefox/util.rb +0 -4
- data/lib/selenium/webdriver/ie.rb +4 -8
- data/lib/selenium/webdriver/ie/driver.rb +90 -0
- data/lib/selenium/webdriver/ie/options.rb +136 -0
- data/lib/selenium/webdriver/ie/service.rb +58 -0
- data/lib/selenium/webdriver/remote.rb +8 -16
- data/lib/selenium/webdriver/remote/bridge.rb +96 -565
- data/lib/selenium/webdriver/remote/capabilities.rb +76 -94
- data/lib/selenium/webdriver/remote/driver.rb +49 -0
- data/lib/selenium/webdriver/remote/http/common.rb +22 -20
- data/lib/selenium/webdriver/remote/http/curb.rb +9 -12
- data/lib/selenium/webdriver/remote/http/default.rb +54 -41
- data/lib/selenium/webdriver/remote/http/persistent.rb +9 -8
- data/lib/selenium/webdriver/remote/oss/bridge.rb +586 -0
- data/lib/selenium/webdriver/remote/oss/commands.rb +221 -0
- data/lib/selenium/webdriver/remote/response.rb +39 -27
- data/lib/selenium/webdriver/remote/server_error.rb +1 -5
- data/lib/selenium/webdriver/remote/w3c/bridge.rb +573 -0
- data/lib/selenium/webdriver/remote/w3c/capabilities.rb +290 -0
- data/lib/selenium/webdriver/remote/w3c/commands.rb +148 -0
- data/lib/selenium/webdriver/safari.rb +20 -29
- data/lib/selenium/webdriver/{firefox/w3c_bridge.rb → safari/driver.rb} +21 -30
- data/lib/selenium/webdriver/safari/service.rb +57 -0
- data/lib/selenium/webdriver/support.rb +1 -2
- data/lib/selenium/webdriver/support/abstract_event_listener.rb +17 -4
- data/lib/selenium/webdriver/support/block_event_listener.rb +1 -5
- data/lib/selenium/webdriver/support/color.rb +57 -42
- data/lib/selenium/webdriver/support/escaper.rb +41 -0
- data/lib/selenium/webdriver/support/event_firing_bridge.rb +36 -40
- data/lib/selenium/webdriver/support/select.rb +33 -86
- data/selenium-webdriver.gemspec +22 -25
- metadata +254 -261
- data/lib/selenium-client.rb +0 -21
- data/lib/selenium/client.rb +0 -57
- data/lib/selenium/client/base.rb +0 -151
- data/lib/selenium/client/driver.rb +0 -29
- data/lib/selenium/client/errors.rb +0 -28
- data/lib/selenium/client/extensions.rb +0 -132
- data/lib/selenium/client/idiomatic.rb +0 -507
- data/lib/selenium/client/javascript_expression_builder.rb +0 -135
- data/lib/selenium/client/javascript_frameworks/jquery.rb +0 -32
- data/lib/selenium/client/javascript_frameworks/prototype.rb +0 -32
- data/lib/selenium/client/legacy_driver.rb +0 -1722
- data/lib/selenium/client/protocol.rb +0 -123
- data/lib/selenium/client/selenium_helper.rb +0 -49
- data/lib/selenium/rake/server_task.rb +0 -176
- data/lib/selenium/webdriver/android/bridge.rb +0 -68
- data/lib/selenium/webdriver/chrome/bridge.rb +0 -139
- data/lib/selenium/webdriver/common/core_ext/base64.rb +0 -28
- data/lib/selenium/webdriver/common/core_ext/dir.rb +0 -61
- data/lib/selenium/webdriver/common/html5/location.rb +0 -19
- data/lib/selenium/webdriver/common/w3c_error.rb +0 -194
- data/lib/selenium/webdriver/edge/legacy_support.rb +0 -117
- data/lib/selenium/webdriver/firefox/bridge.rb +0 -89
- data/lib/selenium/webdriver/ie/bridge.rb +0 -88
- data/lib/selenium/webdriver/ie/server.rb +0 -133
- data/lib/selenium/webdriver/iphone/bridge.rb +0 -64
- data/lib/selenium/webdriver/phantomjs/bridge.rb +0 -78
- data/lib/selenium/webdriver/phantomjs/service.rb +0 -130
- data/lib/selenium/webdriver/remote/commands.rb +0 -211
- data/lib/selenium/webdriver/remote/w3c_bridge.rb +0 -668
- data/lib/selenium/webdriver/remote/w3c_capabilities.rb +0 -236
- data/lib/selenium/webdriver/remote/w3c_commands.rb +0 -132
- data/lib/selenium/webdriver/safari/bridge.rb +0 -135
- data/lib/selenium/webdriver/safari/resources/client.js +0 -7255
- data/lib/selenium/webdriver/safari/server.rb +0 -187
@@ -1,28 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
#
|
3
|
-
# Licensed to the Software Freedom Conservancy (SFC) under one
|
4
|
-
# or more contributor license agreements. See the NOTICE file
|
5
|
-
# distributed with this work for additional information
|
6
|
-
# regarding copyright ownership. The SFC licenses this file
|
7
|
-
# to you under the Apache License, Version 2.0 (the
|
8
|
-
# "License"); you may not use this file except in compliance
|
9
|
-
# with the License. You may obtain a copy of the License at
|
10
|
-
#
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
13
|
-
# Unless required by applicable law or agreed to in writing,
|
14
|
-
# software distributed under the License is distributed on an
|
15
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
16
|
-
# KIND, either express or implied. See the License for the
|
17
|
-
# specific language governing permissions and limitations
|
18
|
-
# under the License.
|
19
|
-
|
20
|
-
require 'base64'
|
21
|
-
|
22
|
-
module Base64
|
23
|
-
|
24
|
-
def self.strict_encode64(str)
|
25
|
-
encode64(str).gsub(/\n/, '')
|
26
|
-
end unless respond_to?(:strict_encode64) # added in 1.9
|
27
|
-
|
28
|
-
end
|
@@ -1,61 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
#
|
3
|
-
# Licensed to the Software Freedom Conservancy (SFC) under one
|
4
|
-
# or more contributor license agreements. See the NOTICE file
|
5
|
-
# distributed with this work for additional information
|
6
|
-
# regarding copyright ownership. The SFC licenses this file
|
7
|
-
# to you under the Apache License, Version 2.0 (the
|
8
|
-
# "License"); you may not use this file except in compliance
|
9
|
-
# with the License. You may obtain a copy of the License at
|
10
|
-
#
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
13
|
-
# Unless required by applicable law or agreed to in writing,
|
14
|
-
# software distributed under the License is distributed on an
|
15
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
16
|
-
# KIND, either express or implied. See the License for the
|
17
|
-
# specific language governing permissions and limitations
|
18
|
-
# under the License.
|
19
|
-
|
20
|
-
class Dir
|
21
|
-
# @api private
|
22
|
-
def self.mktmpdir(prefix_suffix=nil, tmpdir=nil)
|
23
|
-
case prefix_suffix
|
24
|
-
when nil
|
25
|
-
prefix = "d"
|
26
|
-
suffix = ""
|
27
|
-
when String
|
28
|
-
prefix = prefix_suffix
|
29
|
-
suffix = ""
|
30
|
-
when Array
|
31
|
-
prefix = prefix_suffix[0]
|
32
|
-
suffix = prefix_suffix[1]
|
33
|
-
else
|
34
|
-
raise ArgumentError, "unexpected prefix_suffix: #{prefix_suffix.inspect}"
|
35
|
-
end
|
36
|
-
tmpdir ||= Dir.tmpdir
|
37
|
-
t = Time.now.strftime("%Y%m%d")
|
38
|
-
n = nil
|
39
|
-
begin
|
40
|
-
path = "#{tmpdir}/#{prefix}#{t}-#{$$}-#{rand(0x100000000).to_s(36)}"
|
41
|
-
path << "-#{n}" if n
|
42
|
-
path << suffix
|
43
|
-
Dir.mkdir(path, 0700)
|
44
|
-
rescue Errno::EEXIST
|
45
|
-
n ||= 0
|
46
|
-
n += 1
|
47
|
-
retry
|
48
|
-
end
|
49
|
-
|
50
|
-
if block_given?
|
51
|
-
begin
|
52
|
-
yield path
|
53
|
-
ensure
|
54
|
-
FileUtils.remove_entry_secure path
|
55
|
-
end
|
56
|
-
else
|
57
|
-
path
|
58
|
-
end
|
59
|
-
end unless respond_to? :mktmpdir # > 1.8.7
|
60
|
-
end
|
61
|
-
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
#
|
3
|
-
# Licensed to the Software Freedom Conservancy (SFC) under one
|
4
|
-
# or more contributor license agreements. See the NOTICE file
|
5
|
-
# distributed with this work for additional information
|
6
|
-
# regarding copyright ownership. The SFC licenses this file
|
7
|
-
# to you under the Apache License, Version 2.0 (the
|
8
|
-
# "License"); you may not use this file except in compliance
|
9
|
-
# with the License. You may obtain a copy of the License at
|
10
|
-
#
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
13
|
-
# Unless required by applicable law or agreed to in writing,
|
14
|
-
# software distributed under the License is distributed on an
|
15
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
16
|
-
# KIND, either express or implied. See the License for the
|
17
|
-
# specific language governing permissions and limitations
|
18
|
-
# under the License.
|
19
|
-
|
@@ -1,194 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
#
|
3
|
-
# Licensed to the Software Freedom Conservancy (SFC) under one
|
4
|
-
# or more contributor license agreements. See the NOTICE file
|
5
|
-
# distributed with this work for additional information
|
6
|
-
# regarding copyright ownership. The SFC licenses this file
|
7
|
-
# to you under the Apache License, Version 2.0 (the
|
8
|
-
# "License"); you may not use this file except in compliance
|
9
|
-
# with the License. You may obtain a copy of the License at
|
10
|
-
#
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
13
|
-
# Unless required by applicable law or agreed to in writing,
|
14
|
-
# software distributed under the License is distributed on an
|
15
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
16
|
-
# KIND, either express or implied. See the License for the
|
17
|
-
# specific language governing permissions and limitations
|
18
|
-
# under the License.
|
19
|
-
|
20
|
-
module Selenium
|
21
|
-
module WebDriver
|
22
|
-
module Error
|
23
|
-
|
24
|
-
class WebDriverError < StandardError; end
|
25
|
-
|
26
|
-
#
|
27
|
-
# An attempt was made to select an element that cannot be selected.
|
28
|
-
#
|
29
|
-
|
30
|
-
class ElementNotSelectableError < WebDriverError; end
|
31
|
-
|
32
|
-
#
|
33
|
-
# An element command could not be completed because the element is
|
34
|
-
# not visible on the page.
|
35
|
-
#
|
36
|
-
|
37
|
-
class ElementNotVisibleError < WebDriverError; end
|
38
|
-
|
39
|
-
#
|
40
|
-
# The arguments passed to a command are either invalid or malformed.
|
41
|
-
#
|
42
|
-
|
43
|
-
class InvalidArgumentError < WebDriverError; end
|
44
|
-
|
45
|
-
#
|
46
|
-
# An illegal attempt was made to set a cookie under a different
|
47
|
-
# domain than the current page.
|
48
|
-
#
|
49
|
-
|
50
|
-
class InvalidCookieDomainError < WebDriverError; end
|
51
|
-
|
52
|
-
#
|
53
|
-
# The coordinates provided to an interactions operation are invalid.
|
54
|
-
#
|
55
|
-
|
56
|
-
class InvalidElementCoordinatesError < WebDriverError; end
|
57
|
-
|
58
|
-
#
|
59
|
-
# An element command could not be completed because the element is
|
60
|
-
# in an invalid state, e.g. attempting to click an element that is no
|
61
|
-
# longer attached to the document.
|
62
|
-
#
|
63
|
-
|
64
|
-
class InvalidElementStateError < WebDriverError; end
|
65
|
-
|
66
|
-
#
|
67
|
-
# Argument was an invalid selector.
|
68
|
-
#
|
69
|
-
|
70
|
-
class InvalidSelectorError < WebDriverError; end
|
71
|
-
|
72
|
-
#
|
73
|
-
# Occurs if the given session id is not in the list of active sessions,
|
74
|
-
# meaning the session either does not exist or that it’s not active.
|
75
|
-
#
|
76
|
-
|
77
|
-
class InvalidSessionIdError < WebDriverError; end
|
78
|
-
|
79
|
-
#
|
80
|
-
# An error occurred while executing JavaScript supplied by the user.
|
81
|
-
#
|
82
|
-
|
83
|
-
class JavascriptError < WebDriverError; end
|
84
|
-
|
85
|
-
#
|
86
|
-
# The target for mouse interaction is not in the browser’s viewport and
|
87
|
-
# cannot be brought into that viewport.
|
88
|
-
#
|
89
|
-
|
90
|
-
class MoveTargetOutOfBoundsError < WebDriverError; end
|
91
|
-
|
92
|
-
#
|
93
|
-
# An attempt was made to operate on a modal dialog when one was not open.
|
94
|
-
#
|
95
|
-
|
96
|
-
class NoSuchAlertError < WebDriverError; end
|
97
|
-
|
98
|
-
#
|
99
|
-
# An element could not be located on the page using the given
|
100
|
-
# search parameters.
|
101
|
-
#
|
102
|
-
|
103
|
-
class NoSuchElementError < WebDriverError; end
|
104
|
-
|
105
|
-
#
|
106
|
-
# A request to switch to a frame could not be satisfied because the
|
107
|
-
# frame could not be found.
|
108
|
-
#
|
109
|
-
|
110
|
-
class NoSuchFrameError < WebDriverError; end
|
111
|
-
|
112
|
-
#
|
113
|
-
# A request to switch to a window could not be satisfied because the
|
114
|
-
# window could not be found.
|
115
|
-
#
|
116
|
-
|
117
|
-
class NoSuchWindowError < WebDriverError; end
|
118
|
-
|
119
|
-
#
|
120
|
-
# A script did not complete before its timeout expired.
|
121
|
-
#
|
122
|
-
|
123
|
-
class ScriptTimeoutError < WebDriverError; end
|
124
|
-
|
125
|
-
#
|
126
|
-
# A new session could not be created.
|
127
|
-
#
|
128
|
-
|
129
|
-
class SessionNotCreatedError < WebDriverError; end
|
130
|
-
|
131
|
-
#
|
132
|
-
# An element command failed because the referenced element is no longer
|
133
|
-
# attached to the DOM.
|
134
|
-
#
|
135
|
-
|
136
|
-
class StaleElementReferenceError < WebDriverError; end
|
137
|
-
|
138
|
-
#
|
139
|
-
# An operation did not complete before its timeout expired.
|
140
|
-
#
|
141
|
-
|
142
|
-
class TimeoutError < WebDriverError; end
|
143
|
-
|
144
|
-
#
|
145
|
-
# A request to set a cookie’s value could not be satisfied.
|
146
|
-
#
|
147
|
-
|
148
|
-
class UnableToSetCookieError < WebDriverError; end
|
149
|
-
|
150
|
-
#
|
151
|
-
# A screen capture was made impossible.
|
152
|
-
#
|
153
|
-
|
154
|
-
class UnableToCaptureScreenError < WebDriverError; end
|
155
|
-
|
156
|
-
#
|
157
|
-
# A modal dialog was open, blocking this operation.
|
158
|
-
#
|
159
|
-
|
160
|
-
class UnexpectedAlertOpenError < WebDriverError; end
|
161
|
-
|
162
|
-
#
|
163
|
-
# An unknown error occurred in the remote end while processing
|
164
|
-
# the command.
|
165
|
-
#
|
166
|
-
|
167
|
-
class UnknownError < WebDriverError; end
|
168
|
-
|
169
|
-
#
|
170
|
-
# The requested command matched a known URL but did not match a
|
171
|
-
# method for that URL.
|
172
|
-
#
|
173
|
-
|
174
|
-
class UnknownMethodError < WebDriverError; end
|
175
|
-
|
176
|
-
#
|
177
|
-
# Indicates that a command that should have executed properly cannot be supported for some reason.
|
178
|
-
#
|
179
|
-
|
180
|
-
class UnsupportedOperationError < WebDriverError; end
|
181
|
-
|
182
|
-
# aliased for backwards compatibility
|
183
|
-
NoAlertPresentError = NoSuchAlertError
|
184
|
-
ScriptTimeOutError = ScriptTimeoutError
|
185
|
-
ObsoleteElementError = StaleElementReferenceError
|
186
|
-
UnhandledError = UnknownError
|
187
|
-
UnexpectedJavascriptError = JavascriptError
|
188
|
-
NoAlertOpenError = NoAlertPresentError
|
189
|
-
ElementNotDisplayedError = ElementNotVisibleError
|
190
|
-
|
191
|
-
|
192
|
-
end # Error
|
193
|
-
end # WebDriver
|
194
|
-
end # Selenium
|
@@ -1,117 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
#
|
3
|
-
# Licensed to the Software Freedom Conservancy (SFC) under one
|
4
|
-
# or more contributor license agreements. See the NOTICE file
|
5
|
-
# distributed with this work for additional information
|
6
|
-
# regarding copyright ownership. The SFC licenses this file
|
7
|
-
# to you under the Apache License, Version 2.0 (the
|
8
|
-
# "License"); you may not use this file except in compliance
|
9
|
-
# with the License. You may obtain a copy of the License at
|
10
|
-
#
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
13
|
-
# Unless required by applicable law or agreed to in writing,
|
14
|
-
# software distributed under the License is distributed on an
|
15
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
16
|
-
# KIND, either express or implied. See the License for the
|
17
|
-
# specific language governing permissions and limitations
|
18
|
-
# under the License.
|
19
|
-
|
20
|
-
module Selenium
|
21
|
-
module WebDriver
|
22
|
-
module Edge
|
23
|
-
|
24
|
-
module LegacySupport
|
25
|
-
|
26
|
-
# These are commands Edge is still using from JSON Wire Protocol
|
27
|
-
[:executeScript, :executeAsyncScript, :submitElement, :doubleClick, :mouseDown, :mouseUp, :mouseMoveTo, :click,
|
28
|
-
:sendKeysToActiveElement, :getWindowHandles, :getCurrentWindowHandle, :getWindowSize, :setWindowSize, :getWindowPosition,
|
29
|
-
:setWindowPosition, :maximizeWindow, :getAlertText, :acceptAlert, :dismissAlert].each do |cmd|
|
30
|
-
jwp = Remote::Bridge::COMMANDS[cmd]
|
31
|
-
Remote::W3CBridge.command(cmd, jwp.first, jwp.last)
|
32
|
-
end
|
33
|
-
|
34
|
-
def executeScript(script, *args)
|
35
|
-
result = execute :executeScript, {}, :script => script, :args => args
|
36
|
-
unwrap_script_result result
|
37
|
-
end
|
38
|
-
|
39
|
-
def executeAsyncScript(script, *args)
|
40
|
-
result = execute :executeAsyncScript, {}, :script => script, :args => args
|
41
|
-
unwrap_script_result result
|
42
|
-
end
|
43
|
-
|
44
|
-
def submitElement(element)
|
45
|
-
execute :submitElement, :id => element
|
46
|
-
end
|
47
|
-
|
48
|
-
def doubleClick
|
49
|
-
execute :doubleClick
|
50
|
-
end
|
51
|
-
|
52
|
-
def click
|
53
|
-
execute :click, {}, :button => 0
|
54
|
-
end
|
55
|
-
|
56
|
-
def contextClick
|
57
|
-
execute :click, {}, :button => 2
|
58
|
-
end
|
59
|
-
|
60
|
-
def mouseDown
|
61
|
-
execute :mouseDown
|
62
|
-
end
|
63
|
-
|
64
|
-
def mouseUp
|
65
|
-
execute :mouseUp
|
66
|
-
end
|
67
|
-
|
68
|
-
def mouseMoveTo(element, x = nil, y = nil)
|
69
|
-
params = { :element => element }
|
70
|
-
|
71
|
-
if x && y
|
72
|
-
params.merge! :xoffset => x, :yoffset => y
|
73
|
-
end
|
74
|
-
|
75
|
-
execute :mouseMoveTo, {}, params
|
76
|
-
end
|
77
|
-
|
78
|
-
def sendKeysToActiveElement(key)
|
79
|
-
execute :sendKeysToActiveElement, {}, :value => key
|
80
|
-
end
|
81
|
-
|
82
|
-
def getCurrentWindowHandle
|
83
|
-
execute :getCurrentWindowHandle
|
84
|
-
end
|
85
|
-
|
86
|
-
def getWindowSize(handle = :current)
|
87
|
-
data = execute :getWindowSize, :window_handle => handle
|
88
|
-
|
89
|
-
Dimension.new data['width'], data['height']
|
90
|
-
end
|
91
|
-
|
92
|
-
def setWindowSize(width, height, handle = :current)
|
93
|
-
execute :setWindowSize, {:window_handle => handle},
|
94
|
-
:width => width,
|
95
|
-
:height => height
|
96
|
-
end
|
97
|
-
|
98
|
-
def getWindowPosition(handle = :current)
|
99
|
-
data = execute :getWindowPosition, :window_handle => handle
|
100
|
-
|
101
|
-
Point.new data['x'], data['y']
|
102
|
-
end
|
103
|
-
|
104
|
-
def setWindowPosition(x, y, handle = :current)
|
105
|
-
execute :setWindowPosition, {:window_handle => handle},
|
106
|
-
:x => x, :y => y
|
107
|
-
end
|
108
|
-
|
109
|
-
def maximizeWindow(handle = :current)
|
110
|
-
execute :maximizeWindow, :window_handle => handle
|
111
|
-
end
|
112
|
-
|
113
|
-
|
114
|
-
end # LegacySupport
|
115
|
-
end # Edge
|
116
|
-
end # WebDriver
|
117
|
-
end # Selenium
|
@@ -1,89 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
#
|
3
|
-
# Licensed to the Software Freedom Conservancy (SFC) under one
|
4
|
-
# or more contributor license agreements. See the NOTICE file
|
5
|
-
# distributed with this work for additional information
|
6
|
-
# regarding copyright ownership. The SFC licenses this file
|
7
|
-
# to you under the Apache License, Version 2.0 (the
|
8
|
-
# "License"); you may not use this file except in compliance
|
9
|
-
# with the License. You may obtain a copy of the License at
|
10
|
-
#
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
13
|
-
# Unless required by applicable law or agreed to in writing,
|
14
|
-
# software distributed under the License is distributed on an
|
15
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
16
|
-
# KIND, either express or implied. See the License for the
|
17
|
-
# specific language governing permissions and limitations
|
18
|
-
# under the License.
|
19
|
-
|
20
|
-
module Selenium
|
21
|
-
module WebDriver
|
22
|
-
module Firefox
|
23
|
-
|
24
|
-
# @api private
|
25
|
-
class Bridge < Remote::Bridge
|
26
|
-
|
27
|
-
def initialize(opts = {})
|
28
|
-
port = opts.delete(:port) || DEFAULT_PORT
|
29
|
-
profile = opts.delete(:profile)
|
30
|
-
http_client = opts.delete(:http_client)
|
31
|
-
proxy = opts.delete(:proxy)
|
32
|
-
|
33
|
-
caps = opts.delete(:desired_capabilities) { Remote::Capabilities.firefox }
|
34
|
-
|
35
|
-
Binary.path = caps[:firefox_binary] if caps[:firefox_binary]
|
36
|
-
|
37
|
-
@launcher = create_launcher(port, profile)
|
38
|
-
|
39
|
-
unless opts.empty?
|
40
|
-
raise ArgumentError, "unknown option#{'s' if opts.size != 1}: #{opts.inspect}"
|
41
|
-
end
|
42
|
-
|
43
|
-
@launcher.launch
|
44
|
-
|
45
|
-
caps.proxy = proxy if proxy
|
46
|
-
|
47
|
-
remote_opts = {
|
48
|
-
:url => @launcher.url,
|
49
|
-
:desired_capabilities => caps
|
50
|
-
}
|
51
|
-
|
52
|
-
remote_opts.merge!(:http_client => http_client) if http_client
|
53
|
-
|
54
|
-
begin
|
55
|
-
super(remote_opts)
|
56
|
-
rescue
|
57
|
-
@launcher.quit
|
58
|
-
raise
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
def browser
|
63
|
-
:firefox
|
64
|
-
end
|
65
|
-
|
66
|
-
def driver_extensions
|
67
|
-
[
|
68
|
-
DriverExtensions::TakesScreenshot,
|
69
|
-
DriverExtensions::HasInputDevices
|
70
|
-
]
|
71
|
-
end
|
72
|
-
|
73
|
-
def quit
|
74
|
-
super
|
75
|
-
nil
|
76
|
-
ensure
|
77
|
-
@launcher.quit
|
78
|
-
end
|
79
|
-
|
80
|
-
private
|
81
|
-
|
82
|
-
def create_launcher(port, profile)
|
83
|
-
Launcher.new Binary.new, port, profile
|
84
|
-
end
|
85
|
-
|
86
|
-
end # Bridge
|
87
|
-
end # Firefox
|
88
|
-
end # WebDriver
|
89
|
-
end # Selenium
|