selenium-webdriver 4.0.0.alpha1 → 4.0.0.alpha6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGES +139 -1
- data/LICENSE +1 -1
- data/lib/selenium/server.rb +3 -3
- data/lib/selenium/webdriver.rb +11 -7
- data/lib/selenium/webdriver/atoms/findElements.js +122 -0
- data/lib/selenium/webdriver/atoms/getAttribute.js +84 -7
- data/lib/selenium/webdriver/atoms/isDisplayed.js +75 -77
- data/lib/selenium/webdriver/chrome.rb +10 -9
- data/lib/selenium/webdriver/chrome/bridge.rb +20 -4
- data/lib/selenium/webdriver/chrome/driver.rb +3 -52
- data/lib/selenium/webdriver/chrome/options.rb +97 -57
- data/lib/selenium/webdriver/chrome/profile.rb +2 -2
- data/lib/selenium/webdriver/chrome/service.rb +0 -4
- data/lib/selenium/webdriver/common.rb +3 -0
- data/lib/selenium/webdriver/common/driver.rb +76 -17
- data/lib/selenium/webdriver/common/driver_extensions/{has_touch_screen.rb → has_devtools.rb} +10 -8
- data/lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb +2 -1
- data/lib/selenium/webdriver/common/logger.rb +48 -16
- data/lib/selenium/webdriver/common/manager.rb +5 -0
- data/lib/selenium/webdriver/common/options.rb +60 -121
- data/lib/selenium/webdriver/common/platform.rb +3 -0
- data/lib/selenium/webdriver/common/port_prober.rb +4 -6
- data/lib/selenium/webdriver/common/profile_helper.rb +10 -2
- data/lib/selenium/webdriver/common/proxy.rb +0 -0
- data/lib/selenium/webdriver/common/search_context.rb +3 -2
- data/lib/selenium/webdriver/common/service.rb +30 -113
- data/lib/selenium/webdriver/common/service_manager.rb +151 -0
- data/lib/selenium/webdriver/common/socket_lock.rb +2 -2
- data/lib/selenium/webdriver/common/wait.rb +1 -1
- data/lib/selenium/webdriver/devtools.rb +118 -0
- data/lib/selenium/webdriver/devtools/accessibility.rb +62 -0
- data/lib/selenium/webdriver/devtools/animation.rb +98 -0
- data/lib/selenium/webdriver/devtools/application_cache.rb +64 -0
- data/lib/selenium/webdriver/devtools/audits.rb +61 -0
- data/lib/selenium/webdriver/devtools/background_service.rb +67 -0
- data/lib/selenium/webdriver/devtools/browser.rb +123 -0
- data/lib/selenium/webdriver/devtools/cache_storage.rb +73 -0
- data/lib/selenium/webdriver/devtools/cast.rb +70 -0
- data/lib/selenium/webdriver/devtools/console.rb +57 -0
- data/lib/selenium/webdriver/devtools/css.rb +165 -0
- data/lib/selenium/webdriver/devtools/database.rb +64 -0
- data/lib/selenium/webdriver/devtools/debugger.rb +229 -0
- data/lib/selenium/webdriver/devtools/device_orientation.rb +53 -0
- data/lib/selenium/webdriver/devtools/dom.rb +320 -0
- data/lib/selenium/webdriver/devtools/domdebugger.rb +93 -0
- data/lib/selenium/webdriver/devtools/domsnapshot.rb +65 -0
- data/lib/selenium/webdriver/devtools/domstorage.rb +79 -0
- data/lib/selenium/webdriver/devtools/emulation.rb +180 -0
- data/lib/selenium/webdriver/devtools/fetch.rb +97 -0
- data/lib/selenium/webdriver/devtools/headless_experimental.rb +61 -0
- data/lib/selenium/webdriver/devtools/heap_profiler.rb +107 -0
- data/lib/selenium/webdriver/devtools/indexed_db.rb +100 -0
- data/lib/selenium/webdriver/devtools/input.rb +140 -0
- data/lib/selenium/webdriver/devtools/inspector.rb +55 -0
- data/lib/selenium/webdriver/devtools/io.rb +59 -0
- data/lib/selenium/webdriver/devtools/layer_tree.rb +95 -0
- data/lib/selenium/webdriver/devtools/log.rb +66 -0
- data/lib/selenium/webdriver/devtools/media.rb +57 -0
- data/lib/selenium/webdriver/devtools/memory.rb +86 -0
- data/lib/selenium/webdriver/devtools/network.rb +228 -0
- data/lib/selenium/webdriver/devtools/overlay.rb +157 -0
- data/lib/selenium/webdriver/devtools/page.rb +374 -0
- data/lib/selenium/webdriver/devtools/performance.rb +63 -0
- data/lib/selenium/webdriver/devtools/profiler.rb +111 -0
- data/lib/selenium/webdriver/devtools/runtime.rb +193 -0
- data/lib/selenium/webdriver/devtools/schema.rb +46 -0
- data/lib/selenium/webdriver/devtools/security.rb +71 -0
- data/lib/selenium/webdriver/devtools/service_worker.rb +116 -0
- data/lib/selenium/webdriver/devtools/storage.rb +95 -0
- data/lib/selenium/webdriver/devtools/system_info.rb +50 -0
- data/lib/selenium/webdriver/devtools/target.rb +141 -0
- data/lib/selenium/webdriver/devtools/tethering.rb +55 -0
- data/lib/selenium/webdriver/devtools/tracing.rb +76 -0
- data/lib/selenium/webdriver/devtools/web_audio.rb +70 -0
- data/lib/selenium/webdriver/devtools/web_authn.rb +94 -0
- data/lib/selenium/webdriver/edge.rb +29 -9
- data/lib/selenium/webdriver/{firefox/util.rb → edge_chrome/bridge.rb} +11 -20
- data/lib/selenium/webdriver/{common/w3c_options.rb → edge_chrome/driver.rb} +14 -17
- data/lib/selenium/webdriver/edge_chrome/options.rb +36 -0
- data/lib/selenium/webdriver/edge_chrome/profile.rb +33 -0
- data/lib/selenium/webdriver/edge_chrome/service.rb +36 -0
- data/lib/selenium/webdriver/{common/w3c_manager.rb → edge_html/driver.rb} +11 -17
- data/lib/selenium/webdriver/{edge → edge_html}/options.rb +26 -22
- data/lib/selenium/webdriver/{edge → edge_html}/service.rb +2 -6
- data/lib/selenium/webdriver/firefox.rb +18 -15
- data/lib/selenium/webdriver/firefox/bridge.rb +1 -1
- data/lib/selenium/webdriver/firefox/driver.rb +2 -30
- data/lib/selenium/webdriver/firefox/extension.rb +8 -0
- data/lib/selenium/webdriver/firefox/options.rb +47 -52
- data/lib/selenium/webdriver/firefox/profile.rb +7 -78
- data/lib/selenium/webdriver/firefox/service.rb +0 -4
- data/lib/selenium/webdriver/ie.rb +8 -7
- data/lib/selenium/webdriver/ie/driver.rb +0 -32
- data/lib/selenium/webdriver/ie/options.rb +10 -33
- data/lib/selenium/webdriver/ie/service.rb +5 -9
- data/lib/selenium/webdriver/remote.rb +16 -10
- data/lib/selenium/webdriver/remote/bridge.rb +34 -42
- data/lib/selenium/webdriver/remote/capabilities.rb +22 -6
- data/lib/selenium/webdriver/remote/driver.rb +6 -12
- data/lib/selenium/webdriver/remote/http/default.rb +9 -4
- data/lib/selenium/webdriver/remote/http/persistent.rb +5 -6
- data/lib/selenium/webdriver/safari.rb +9 -8
- data/lib/selenium/webdriver/safari/bridge.rb +4 -4
- data/lib/selenium/webdriver/safari/driver.rb +3 -29
- data/lib/selenium/webdriver/safari/options.rb +18 -19
- data/lib/selenium/webdriver/safari/service.rb +0 -4
- data/lib/selenium/webdriver/support.rb +1 -0
- data/lib/selenium/webdriver/support/cdp_client_generator.rb +77 -0
- data/lib/selenium/webdriver/support/color.rb +2 -2
- data/lib/selenium/webdriver/support/event_firing_bridge.rb +1 -1
- data/lib/selenium/webdriver/support/relative_locator.rb +51 -0
- data/lib/selenium/webdriver/version.rb +1 -1
- data/selenium-webdriver.gemspec +5 -4
- metadata +81 -42
- data/lib/selenium/webdriver/common/bridge_helper.rb +0 -82
- data/lib/selenium/webdriver/common/keyboard.rb +0 -70
- data/lib/selenium/webdriver/common/mouse.rb +0 -89
- data/lib/selenium/webdriver/common/touch_action_builder.rb +0 -78
- data/lib/selenium/webdriver/common/touch_screen.rb +0 -123
- data/lib/selenium/webdriver/common/w3c_action_builder.rb +0 -212
- data/lib/selenium/webdriver/edge/bridge.rb +0 -76
- data/lib/selenium/webdriver/edge/driver.rb +0 -70
- data/lib/selenium/webdriver/firefox/binary.rb +0 -110
- data/lib/selenium/webdriver/firefox/extension/prefs.json +0 -69
- data/lib/selenium/webdriver/firefox/extension/webdriver.xpi +0 -0
- data/lib/selenium/webdriver/firefox/launcher.rb +0 -111
- data/lib/selenium/webdriver/firefox/legacy/driver.rb +0 -83
- data/lib/selenium/webdriver/firefox/marionette/bridge.rb +0 -49
- data/lib/selenium/webdriver/firefox/marionette/driver.rb +0 -90
- data/lib/selenium/webdriver/firefox/native/linux/amd64/x_ignore_nofocus.so +0 -0
- data/lib/selenium/webdriver/firefox/native/linux/x86/x_ignore_nofocus.so +0 -0
- data/lib/selenium/webdriver/remote/oss/bridge.rb +0 -594
- data/lib/selenium/webdriver/remote/oss/commands.rb +0 -223
- data/lib/selenium/webdriver/remote/w3c/bridge.rb +0 -605
- data/lib/selenium/webdriver/remote/w3c/capabilities.rb +0 -310
- data/lib/selenium/webdriver/remote/w3c/commands.rb +0 -157
@@ -1,310 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
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 Remote
|
23
|
-
module W3C
|
24
|
-
|
25
|
-
#
|
26
|
-
# Specification of the desired and/or actual capabilities of the browser that the
|
27
|
-
# server is being asked to create.
|
28
|
-
#
|
29
|
-
# @api private
|
30
|
-
#
|
31
|
-
|
32
|
-
class Capabilities
|
33
|
-
|
34
|
-
EXTENSION_CAPABILITY_PATTERN = /\A[\w-]+:.*\z/.freeze
|
35
|
-
|
36
|
-
KNOWN = [
|
37
|
-
:browser_name,
|
38
|
-
:browser_version,
|
39
|
-
:platform_name,
|
40
|
-
:accept_insecure_certs,
|
41
|
-
:page_load_strategy,
|
42
|
-
:proxy,
|
43
|
-
:set_window_rect,
|
44
|
-
:timeouts,
|
45
|
-
:unhandled_prompt_behavior,
|
46
|
-
:strict_file_interactability,
|
47
|
-
|
48
|
-
# remote-specific
|
49
|
-
:remote_session_id,
|
50
|
-
|
51
|
-
# TODO: (alex) deprecate in favor of Firefox::Options?
|
52
|
-
:accessibility_checks,
|
53
|
-
:device,
|
54
|
-
|
55
|
-
# TODO: (alex) deprecate compatibility with OSS-capabilities
|
56
|
-
:implicit_timeout,
|
57
|
-
:page_load_timeout,
|
58
|
-
:script_timeout
|
59
|
-
].freeze
|
60
|
-
|
61
|
-
KNOWN.each do |key|
|
62
|
-
define_method key do
|
63
|
-
@capabilities.fetch(key)
|
64
|
-
end
|
65
|
-
|
66
|
-
next if key == :proxy
|
67
|
-
|
68
|
-
define_method "#{key}=" do |value|
|
69
|
-
case key
|
70
|
-
when :accessibility_checks
|
71
|
-
WebDriver.logger.deprecate(":accessibility_checks capability")
|
72
|
-
when :device
|
73
|
-
WebDriver.logger.deprecate(":device capability")
|
74
|
-
end
|
75
|
-
@capabilities[key] = value
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
#
|
80
|
-
# Backward compatibility
|
81
|
-
#
|
82
|
-
|
83
|
-
alias_method :version, :browser_version
|
84
|
-
alias_method :version=, :browser_version=
|
85
|
-
alias_method :platform, :platform_name
|
86
|
-
alias_method :platform=, :platform_name=
|
87
|
-
|
88
|
-
#
|
89
|
-
# Convenience methods for the common choices.
|
90
|
-
#
|
91
|
-
|
92
|
-
class << self
|
93
|
-
def edge(opts = {})
|
94
|
-
WebDriver.logger.deprecate('Selenium::WebDriver::Remote::W3C::Capabilities.edge',
|
95
|
-
'Selenium::WebDriver::Remote::Capabilities.edge')
|
96
|
-
Remote::Capabilities.edge(opts)
|
97
|
-
end
|
98
|
-
|
99
|
-
def firefox(opts = {})
|
100
|
-
WebDriver.logger.deprecate('Selenium::WebDriver::Remote::W3C::Capabilities.firefox',
|
101
|
-
'Selenium::WebDriver::Remote::Capabilities.firefox')
|
102
|
-
Remote::Capabilities.firefox(opts)
|
103
|
-
end
|
104
|
-
|
105
|
-
alias_method :ff, :firefox
|
106
|
-
|
107
|
-
#
|
108
|
-
# @api private
|
109
|
-
#
|
110
|
-
|
111
|
-
def json_create(data)
|
112
|
-
data = data.dup
|
113
|
-
|
114
|
-
caps = new
|
115
|
-
caps.browser_name = data.delete('browserName')
|
116
|
-
caps.browser_version = data.delete('browserVersion')
|
117
|
-
caps.platform_name = data.delete('platformName')
|
118
|
-
caps.accept_insecure_certs = data.delete('acceptInsecureCerts') if data.key?('acceptInsecureCerts')
|
119
|
-
caps.page_load_strategy = data.delete('pageLoadStrategy')
|
120
|
-
timeouts = data.delete('timeouts')
|
121
|
-
caps.implicit_timeout = timeouts['implicit'] if timeouts
|
122
|
-
caps.page_load_timeout = timeouts['pageLoad'] if timeouts
|
123
|
-
caps.script_timeout = timeouts['script'] if timeouts
|
124
|
-
|
125
|
-
proxy = data.delete('proxy')
|
126
|
-
caps.proxy = Proxy.json_create(proxy) unless proxy.nil? || proxy.empty?
|
127
|
-
|
128
|
-
# Remote Server Specific
|
129
|
-
caps[:remote_session_id] = data.delete('webdriver.remote.sessionid')
|
130
|
-
|
131
|
-
# Marionette Specific
|
132
|
-
caps[:accessibility_checks] = data.delete('moz:accessibilityChecks')
|
133
|
-
caps[:profile] = data.delete('moz:profile')
|
134
|
-
caps[:rotatable] = data.delete('rotatable')
|
135
|
-
caps[:device] = data.delete('device')
|
136
|
-
|
137
|
-
# any remaining pairs will be added as is, with no conversion
|
138
|
-
caps.merge!(data)
|
139
|
-
|
140
|
-
caps
|
141
|
-
end
|
142
|
-
|
143
|
-
#
|
144
|
-
# Creates W3C compliant capabilities from OSS ones.
|
145
|
-
# @param oss_capabilities [Hash, Remote::Capabilities]
|
146
|
-
#
|
147
|
-
|
148
|
-
def from_oss(oss_capabilities) # rubocop:disable Metrics/MethodLength
|
149
|
-
w3c_capabilities = new
|
150
|
-
|
151
|
-
# TODO: (alex) make capabilities enumerable?
|
152
|
-
oss_capabilities = oss_capabilities.__send__(:capabilities) unless oss_capabilities.is_a?(Hash)
|
153
|
-
oss_capabilities.each do |name, value|
|
154
|
-
next if value.nil?
|
155
|
-
next if value.is_a?(String) && value.empty?
|
156
|
-
|
157
|
-
capability_name = name.to_s
|
158
|
-
|
159
|
-
snake_cased_capability_names = KNOWN.map(&:to_s)
|
160
|
-
camel_cased_capability_names = snake_cased_capability_names.map(&w3c_capabilities.method(:camel_case))
|
161
|
-
|
162
|
-
next unless snake_cased_capability_names.include?(capability_name) ||
|
163
|
-
camel_cased_capability_names.include?(capability_name) ||
|
164
|
-
capability_name.match(EXTENSION_CAPABILITY_PATTERN)
|
165
|
-
|
166
|
-
w3c_capabilities[name] = value
|
167
|
-
end
|
168
|
-
|
169
|
-
# User can pass :firefox_options or :firefox_profile.
|
170
|
-
#
|
171
|
-
# TODO: (alex) Refactor this whole method into converter class.
|
172
|
-
firefox_options = oss_capabilities['firefoxOptions'] || oss_capabilities['firefox_options'] || oss_capabilities[:firefox_options]
|
173
|
-
firefox_profile = oss_capabilities['firefox_profile'] || oss_capabilities[:firefox_profile]
|
174
|
-
firefox_binary = oss_capabilities['firefox_binary'] || oss_capabilities[:firefox_binary]
|
175
|
-
|
176
|
-
if firefox_options
|
177
|
-
WebDriver.logger.deprecate(':firefox_options capabilitiy', 'Selenium::WebDriver::Firefox::Options')
|
178
|
-
end
|
179
|
-
|
180
|
-
if firefox_profile
|
181
|
-
WebDriver.logger.deprecate(':firefox_profile capabilitiy', 'Selenium::WebDriver::Firefox::Options#profile')
|
182
|
-
end
|
183
|
-
|
184
|
-
if firefox_binary
|
185
|
-
WebDriver.logger.deprecate(':firefox_binary capabilitiy', 'Selenium::WebDriver::Firefox::Options#binary')
|
186
|
-
end
|
187
|
-
|
188
|
-
if firefox_profile && firefox_options
|
189
|
-
second_profile = firefox_options['profile'] || firefox_options[:profile]
|
190
|
-
if second_profile && firefox_profile != second_profile
|
191
|
-
raise Error::WebDriverError, 'You cannot pass 2 different Firefox profiles'
|
192
|
-
end
|
193
|
-
end
|
194
|
-
|
195
|
-
if firefox_options || firefox_profile || firefox_binary
|
196
|
-
options = WebDriver::Firefox::Options.new(firefox_options || {})
|
197
|
-
options.binary = firefox_binary if firefox_binary
|
198
|
-
options.profile = firefox_profile if firefox_profile
|
199
|
-
w3c_capabilities.merge!(options.as_json)
|
200
|
-
end
|
201
|
-
|
202
|
-
w3c_capabilities
|
203
|
-
end
|
204
|
-
end
|
205
|
-
|
206
|
-
#
|
207
|
-
# @param [Hash] opts
|
208
|
-
# @option :browser_name [String] required browser name
|
209
|
-
# @option :browser_version [String] required browser version number
|
210
|
-
# @option :platform_name [Symbol] one of :any, :win, :mac, or :x
|
211
|
-
# @option :accept_insecure_certs [Boolean] does the driver accept insecure SSL certifications?
|
212
|
-
# @option :proxy [Selenium::WebDriver::Proxy, Hash] proxy configuration
|
213
|
-
#
|
214
|
-
# @api public
|
215
|
-
#
|
216
|
-
|
217
|
-
def initialize(opts = {})
|
218
|
-
@capabilities = opts
|
219
|
-
self.proxy = opts.delete(:proxy)
|
220
|
-
end
|
221
|
-
|
222
|
-
#
|
223
|
-
# Allows setting arbitrary capabilities.
|
224
|
-
#
|
225
|
-
|
226
|
-
def []=(key, value)
|
227
|
-
@capabilities[key] = value
|
228
|
-
end
|
229
|
-
|
230
|
-
def [](key)
|
231
|
-
@capabilities[key]
|
232
|
-
end
|
233
|
-
|
234
|
-
def merge!(other)
|
235
|
-
if other.respond_to?(:capabilities, true) && other.capabilities.is_a?(Hash)
|
236
|
-
@capabilities.merge! other.capabilities
|
237
|
-
elsif other.is_a? Hash
|
238
|
-
@capabilities.merge! other
|
239
|
-
else
|
240
|
-
raise ArgumentError, 'argument should be a Hash or implement #capabilities'
|
241
|
-
end
|
242
|
-
end
|
243
|
-
|
244
|
-
def proxy=(proxy)
|
245
|
-
case proxy
|
246
|
-
when Hash
|
247
|
-
@capabilities[:proxy] = Proxy.new(proxy)
|
248
|
-
when Proxy, nil
|
249
|
-
@capabilities[:proxy] = proxy
|
250
|
-
else
|
251
|
-
raise TypeError, "expected Hash or #{Proxy.name}, got #{proxy.inspect}:#{proxy.class}"
|
252
|
-
end
|
253
|
-
end
|
254
|
-
|
255
|
-
#
|
256
|
-
# @api private
|
257
|
-
#
|
258
|
-
|
259
|
-
def as_json(*)
|
260
|
-
hash = {}
|
261
|
-
|
262
|
-
@capabilities.each do |key, value|
|
263
|
-
case key
|
264
|
-
when :platform
|
265
|
-
hash['platform'] = value.to_s.upcase
|
266
|
-
when :proxy
|
267
|
-
if value
|
268
|
-
hash['proxy'] = value.as_json
|
269
|
-
hash['proxy']['proxyType'] &&= hash['proxy']['proxyType'].downcase
|
270
|
-
hash['proxy']['noProxy'] = hash['proxy']['noProxy'].split(', ') if hash['proxy']['noProxy'].is_a?(String)
|
271
|
-
end
|
272
|
-
when String, :firefox_binary
|
273
|
-
hash[key.to_s] = value
|
274
|
-
when Symbol
|
275
|
-
hash[camel_case(key.to_s)] = value
|
276
|
-
else
|
277
|
-
raise TypeError, "expected String or Symbol, got #{key.inspect}:#{key.class} / #{value.inspect}"
|
278
|
-
end
|
279
|
-
end
|
280
|
-
|
281
|
-
hash
|
282
|
-
end
|
283
|
-
|
284
|
-
def to_json(*)
|
285
|
-
JSON.generate as_json
|
286
|
-
end
|
287
|
-
|
288
|
-
def ==(other)
|
289
|
-
return false unless other.is_a? self.class
|
290
|
-
|
291
|
-
as_json == other.as_json
|
292
|
-
end
|
293
|
-
|
294
|
-
alias_method :eql?, :==
|
295
|
-
|
296
|
-
protected
|
297
|
-
|
298
|
-
attr_reader :capabilities
|
299
|
-
|
300
|
-
private
|
301
|
-
|
302
|
-
def camel_case(str)
|
303
|
-
str.gsub(/_([a-z])/) { Regexp.last_match(1).upcase }
|
304
|
-
end
|
305
|
-
|
306
|
-
end # Capabilities
|
307
|
-
end # W3c
|
308
|
-
end # Remote
|
309
|
-
end # WebDriver
|
310
|
-
end # Selenium
|
@@ -1,157 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
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 Remote
|
23
|
-
module W3C
|
24
|
-
|
25
|
-
#
|
26
|
-
# http://www.w3.org/TR/2015/WD-webdriver-20150918/#list-of-endpoints
|
27
|
-
# @api private
|
28
|
-
#
|
29
|
-
|
30
|
-
class Bridge
|
31
|
-
COMMANDS = {
|
32
|
-
|
33
|
-
#
|
34
|
-
# session handling
|
35
|
-
#
|
36
|
-
|
37
|
-
new_session: [:post, 'session'],
|
38
|
-
delete_session: [:delete, 'session/:session_id'],
|
39
|
-
|
40
|
-
#
|
41
|
-
# basic driver
|
42
|
-
#
|
43
|
-
|
44
|
-
get: [:post, 'session/:session_id/url'],
|
45
|
-
get_current_url: [:get, 'session/:session_id/url'],
|
46
|
-
back: [:post, 'session/:session_id/back'],
|
47
|
-
forward: [:post, 'session/:session_id/forward'],
|
48
|
-
refresh: [:post, 'session/:session_id/refresh'],
|
49
|
-
get_title: [:get, 'session/:session_id/title'],
|
50
|
-
|
51
|
-
#
|
52
|
-
# window and Frame handling
|
53
|
-
#
|
54
|
-
|
55
|
-
get_window_handle: [:get, 'session/:session_id/window'],
|
56
|
-
new_window: [:post, 'session/:session_id/window/new'],
|
57
|
-
close_window: [:delete, 'session/:session_id/window'],
|
58
|
-
switch_to_window: [:post, 'session/:session_id/window'],
|
59
|
-
get_window_handles: [:get, 'session/:session_id/window/handles'],
|
60
|
-
fullscreen_window: [:post, 'session/:session_id/window/fullscreen'],
|
61
|
-
minimize_window: [:post, 'session/:session_id/window/minimize'],
|
62
|
-
maximize_window: [:post, 'session/:session_id/window/maximize'],
|
63
|
-
set_window_size: [:post, 'session/:session_id/window/size'],
|
64
|
-
get_window_size: [:get, 'session/:session_id/window/size'],
|
65
|
-
set_window_position: [:post, 'session/:session_id/window/position'],
|
66
|
-
get_window_position: [:get, 'session/:session_id/window/position'],
|
67
|
-
set_window_rect: [:post, 'session/:session_id/window/rect'],
|
68
|
-
get_window_rect: [:get, 'session/:session_id/window/rect'],
|
69
|
-
switch_to_frame: [:post, 'session/:session_id/frame'],
|
70
|
-
switch_to_parent_frame: [:post, 'session/:session_id/frame/parent'],
|
71
|
-
|
72
|
-
#
|
73
|
-
# element
|
74
|
-
#
|
75
|
-
|
76
|
-
find_element: [:post, 'session/:session_id/element'],
|
77
|
-
find_elements: [:post, 'session/:session_id/elements'],
|
78
|
-
find_child_element: [:post, 'session/:session_id/element/:id/element'],
|
79
|
-
find_child_elements: [:post, 'session/:session_id/element/:id/elements'],
|
80
|
-
get_active_element: [:get, 'session/:session_id/element/active'],
|
81
|
-
is_element_selected: [:get, 'session/:session_id/element/:id/selected'],
|
82
|
-
get_element_attribute: [:get, 'session/:session_id/element/:id/attribute/:name'],
|
83
|
-
get_element_property: [:get, 'session/:session_id/element/:id/property/:name'],
|
84
|
-
get_element_css_value: [:get, 'session/:session_id/element/:id/css/:property_name'],
|
85
|
-
get_element_text: [:get, 'session/:session_id/element/:id/text'],
|
86
|
-
get_element_tag_name: [:get, 'session/:session_id/element/:id/name'],
|
87
|
-
get_element_rect: [:get, 'session/:session_id/element/:id/rect'],
|
88
|
-
is_element_enabled: [:get, 'session/:session_id/element/:id/enabled'],
|
89
|
-
|
90
|
-
#
|
91
|
-
# document handling
|
92
|
-
#
|
93
|
-
|
94
|
-
get_page_source: [:get, 'session/:session_id/source'],
|
95
|
-
execute_script: [:post, 'session/:session_id/execute/sync'],
|
96
|
-
execute_async_script: [:post, 'session/:session_id/execute/async'],
|
97
|
-
|
98
|
-
#
|
99
|
-
# cookies
|
100
|
-
#
|
101
|
-
|
102
|
-
get_all_cookies: [:get, 'session/:session_id/cookie'],
|
103
|
-
get_cookie: [:get, 'session/:session_id/cookie/:name'],
|
104
|
-
add_cookie: [:post, 'session/:session_id/cookie'],
|
105
|
-
delete_cookie: [:delete, 'session/:session_id/cookie/:name'],
|
106
|
-
delete_all_cookies: [:delete, 'session/:session_id/cookie'],
|
107
|
-
|
108
|
-
#
|
109
|
-
# timeouts
|
110
|
-
#
|
111
|
-
|
112
|
-
set_timeout: [:post, 'session/:session_id/timeouts'],
|
113
|
-
|
114
|
-
#
|
115
|
-
# actions
|
116
|
-
#
|
117
|
-
|
118
|
-
actions: [:post, 'session/:session_id/actions'],
|
119
|
-
release_actions: [:delete, 'session/:session_id/actions'],
|
120
|
-
|
121
|
-
#
|
122
|
-
# Element Operations
|
123
|
-
#
|
124
|
-
|
125
|
-
element_click: [:post, 'session/:session_id/element/:id/click'],
|
126
|
-
element_tap: [:post, 'session/:session_id/element/:id/tap'],
|
127
|
-
element_clear: [:post, 'session/:session_id/element/:id/clear'],
|
128
|
-
element_send_keys: [:post, 'session/:session_id/element/:id/value'],
|
129
|
-
|
130
|
-
#
|
131
|
-
# alerts
|
132
|
-
#
|
133
|
-
|
134
|
-
dismiss_alert: [:post, 'session/:session_id/alert/dismiss'],
|
135
|
-
accept_alert: [:post, 'session/:session_id/alert/accept'],
|
136
|
-
get_alert_text: [:get, 'session/:session_id/alert/text'],
|
137
|
-
send_alert_text: [:post, 'session/:session_id/alert/text'],
|
138
|
-
|
139
|
-
#
|
140
|
-
# screenshot
|
141
|
-
#
|
142
|
-
|
143
|
-
take_screenshot: [:get, 'session/:session_id/screenshot'],
|
144
|
-
take_element_screenshot: [:get, 'session/:session_id/element/:id/screenshot'],
|
145
|
-
|
146
|
-
#
|
147
|
-
# server extensions
|
148
|
-
#
|
149
|
-
|
150
|
-
upload_file: [:post, 'session/:session_id/se/file']
|
151
|
-
}.freeze
|
152
|
-
|
153
|
-
end # Bridge
|
154
|
-
end # W3C
|
155
|
-
end # Remote
|
156
|
-
end # WebDriver
|
157
|
-
end # Selenium
|