selenium-webdriver 3.142.7 → 4.0.0.alpha1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES +21 -43
- data/lib/selenium/webdriver.rb +2 -4
- data/lib/selenium/webdriver/chrome/bridge.rb +3 -21
- data/lib/selenium/webdriver/chrome/driver.rb +12 -39
- data/lib/selenium/webdriver/chrome/options.rb +3 -7
- data/lib/selenium/webdriver/chrome/profile.rb +2 -2
- data/lib/selenium/webdriver/chrome/service.rb +4 -9
- data/lib/selenium/webdriver/common.rb +7 -16
- data/lib/selenium/webdriver/common/action_builder.rb +97 -249
- data/lib/selenium/webdriver/common/driver.rb +2 -4
- data/lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb +1 -1
- data/lib/selenium/webdriver/common/element.rb +3 -6
- data/lib/selenium/webdriver/common/error.rb +27 -203
- data/lib/selenium/webdriver/common/interactions/key_actions.rb +5 -5
- data/lib/selenium/webdriver/common/interactions/pointer_actions.rb +13 -13
- data/lib/selenium/webdriver/common/manager.rb +1 -1
- data/lib/selenium/webdriver/common/options.rb +148 -24
- data/lib/selenium/webdriver/common/service.rb +16 -34
- data/lib/selenium/webdriver/common/socket_poller.rb +2 -2
- data/lib/selenium/webdriver/common/w3c_options.rb +45 -0
- data/lib/selenium/webdriver/edge.rb +0 -1
- data/lib/selenium/webdriver/edge/driver.rb +14 -10
- data/lib/selenium/webdriver/edge/service.rb +6 -7
- data/lib/selenium/webdriver/firefox.rb +2 -6
- data/lib/selenium/webdriver/firefox/binary.rb +3 -80
- data/lib/selenium/webdriver/firefox/bridge.rb +47 -0
- data/lib/selenium/webdriver/firefox/driver.rb +44 -22
- data/lib/selenium/webdriver/firefox/marionette/driver.rb +1 -1
- data/lib/selenium/webdriver/firefox/options.rb +2 -2
- data/lib/selenium/webdriver/firefox/profile.rb +25 -14
- data/lib/selenium/webdriver/firefox/service.rb +4 -4
- data/lib/selenium/webdriver/ie/driver.rb +5 -18
- data/lib/selenium/webdriver/ie/options.rb +2 -2
- data/lib/selenium/webdriver/ie/service.rb +4 -4
- data/lib/selenium/webdriver/remote.rb +2 -6
- data/lib/selenium/webdriver/remote/bridge.rb +515 -69
- data/lib/selenium/webdriver/remote/capabilities.rb +77 -99
- data/lib/selenium/webdriver/remote/commands.rb +156 -0
- data/lib/selenium/webdriver/remote/driver.rb +12 -5
- data/lib/selenium/webdriver/remote/http/default.rb +0 -9
- data/lib/selenium/webdriver/remote/response.rb +16 -47
- data/lib/selenium/webdriver/safari.rb +1 -1
- data/lib/selenium/webdriver/safari/bridge.rb +3 -3
- data/lib/selenium/webdriver/safari/driver.rb +4 -1
- data/lib/selenium/webdriver/safari/service.rb +4 -4
- data/lib/selenium/webdriver/support/select.rb +1 -1
- data/lib/selenium/webdriver/version.rb +1 -1
- data/selenium-webdriver.gemspec +3 -3
- metadata +14 -5
@@ -41,15 +41,6 @@ module Selenium
|
|
41
41
|
@read_timeout = read_timeout
|
42
42
|
end
|
43
43
|
|
44
|
-
# Maintaining backward compatibility.
|
45
|
-
# @param [Numeric] value - Timeout in seconds to apply to both open timeout and read timeouts.
|
46
|
-
# @deprecated Please set the specific desired timeout {#read_timeout} or {#open_timeout} directly.
|
47
|
-
def timeout=(value)
|
48
|
-
WebDriver.logger.deprecate ':timeout=', '#read_timeout= and #open_timeout='
|
49
|
-
self.open_timeout = value
|
50
|
-
self.read_timeout = value
|
51
|
-
end
|
52
|
-
|
53
44
|
def close
|
54
45
|
@http&.finish
|
55
46
|
end
|
@@ -20,12 +20,13 @@
|
|
20
20
|
module Selenium
|
21
21
|
module WebDriver
|
22
22
|
module Remote
|
23
|
+
|
24
|
+
#
|
23
25
|
# @api private
|
24
|
-
|
25
|
-
STACKTRACE_KEY = 'stackTrace'
|
26
|
+
#
|
26
27
|
|
28
|
+
class Response
|
27
29
|
attr_reader :code, :payload
|
28
|
-
attr_writer :payload
|
29
30
|
|
30
31
|
def initialize(code, payload = nil)
|
31
32
|
@code = code
|
@@ -35,33 +36,16 @@ module Selenium
|
|
35
36
|
end
|
36
37
|
|
37
38
|
def error
|
38
|
-
|
39
|
+
error, message, backtrace = process_error
|
40
|
+
klass = Error.for_error(error) || return
|
39
41
|
|
40
|
-
ex = klass.new(
|
42
|
+
ex = klass.new(message)
|
41
43
|
ex.set_backtrace(caller)
|
42
|
-
add_backtrace ex
|
44
|
+
add_backtrace ex, backtrace
|
43
45
|
|
44
46
|
ex
|
45
47
|
end
|
46
48
|
|
47
|
-
def error_message
|
48
|
-
val = value
|
49
|
-
|
50
|
-
case val
|
51
|
-
when Hash
|
52
|
-
msg = val['message']
|
53
|
-
return 'unknown error' unless msg
|
54
|
-
|
55
|
-
msg << ": #{val['alert']['text'].inspect}" if val['alert'].is_a?(Hash) && val['alert']['text']
|
56
|
-
msg << " (#{val['class']})" if val['class']
|
57
|
-
msg
|
58
|
-
when String
|
59
|
-
val
|
60
|
-
else
|
61
|
-
"unknown error, status=#{status}: #{val.inspect}"
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
49
|
def [](key)
|
66
50
|
@payload[key]
|
67
51
|
end
|
@@ -76,14 +60,7 @@ module Selenium
|
|
76
60
|
raise Error::ServerError, self
|
77
61
|
end
|
78
62
|
|
79
|
-
def add_backtrace(ex)
|
80
|
-
return unless error_payload.is_a?(Hash)
|
81
|
-
|
82
|
-
# Legacy Firefox returns String in ['value'], while we expect Hash.
|
83
|
-
# Use #dig when Firefox legacy is removed (4.0).
|
84
|
-
server_trace = error_payload[STACKTRACE_KEY] ||
|
85
|
-
error_payload[STACKTRACE_KEY.downcase] ||
|
86
|
-
(error_payload['value'] && error_payload['value'][STACKTRACE_KEY])
|
63
|
+
def add_backtrace(ex, server_trace)
|
87
64
|
return unless server_trace
|
88
65
|
|
89
66
|
backtrace = case server_trace
|
@@ -113,22 +90,14 @@ module Selenium
|
|
113
90
|
}.compact
|
114
91
|
end
|
115
92
|
|
116
|
-
def
|
117
|
-
|
118
|
-
# Grab 'value' key for error, leave original payload alone and let the bridge process
|
119
|
-
@error_payload ||= !@payload.key?('sessionId') ? @payload['value'] : @payload
|
120
|
-
end
|
121
|
-
|
122
|
-
def status
|
123
|
-
return unless error_payload.is_a? Hash
|
124
|
-
|
125
|
-
@status ||= error_payload['status'] || error_payload['error']
|
126
|
-
end
|
127
|
-
|
128
|
-
def value
|
129
|
-
return unless error_payload.is_a? Hash
|
93
|
+
def process_error
|
94
|
+
return unless self['value'].is_a?(Hash)
|
130
95
|
|
131
|
-
|
96
|
+
[
|
97
|
+
self['value']['error'],
|
98
|
+
self['value']['message'],
|
99
|
+
self['value']['stacktrace']
|
100
|
+
]
|
132
101
|
end
|
133
102
|
end # Response
|
134
103
|
end # Remote
|
@@ -24,9 +24,9 @@ module Selenium
|
|
24
24
|
|
25
25
|
# https://developer.apple.com/library/content/documentation/NetworkingInternetWeb/Conceptual/WebDriverEndpointDoc/Commands/Commands.html
|
26
26
|
COMMANDS = {
|
27
|
-
get_permissions: [:get, 'session/:session_id/apple/permissions'],
|
28
|
-
set_permissions: [:post, 'session/:session_id/apple/permissions'],
|
29
|
-
attach_debugger: [:post, 'session/:session_id/apple/attach_debugger']
|
27
|
+
get_permissions: [:get, '/session/:session_id/apple/permissions'],
|
28
|
+
set_permissions: [:post, '/session/:session_id/apple/permissions'],
|
29
|
+
attach_debugger: [:post, '/session/:session_id/apple/attach_debugger']
|
30
30
|
}.freeze
|
31
31
|
|
32
32
|
def commands(command)
|
@@ -37,8 +37,11 @@ module Selenium
|
|
37
37
|
opts[:url] ||= service_url(opts)
|
38
38
|
|
39
39
|
listener = opts.delete(:listener)
|
40
|
-
|
40
|
+
desired_capabilities = opts.delete(:desired_capabilities)
|
41
|
+
|
42
|
+
@bridge = Remote::Bridge.new(opts)
|
41
43
|
@bridge.extend Bridge
|
44
|
+
@bridge.create_session(desired_capabilities)
|
42
45
|
|
43
46
|
super(@bridge, listener: listener)
|
44
47
|
end
|
@@ -25,13 +25,13 @@ module Selenium
|
|
25
25
|
#
|
26
26
|
|
27
27
|
class Service < WebDriver::Service
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
DEFAULT_PORT = 7050
|
29
|
+
EXECUTABLE = 'safaridriver'
|
30
|
+
MISSING_TEXT = <<~ERROR
|
31
31
|
Unable to find Apple's safaridriver which comes with Safari 10.
|
32
32
|
More info at https://webkit.org/blog/6900/webdriver-support-in-safari-10/
|
33
33
|
ERROR
|
34
|
-
|
34
|
+
SHUTDOWN_SUPPORTED = false
|
35
35
|
end # Service
|
36
36
|
end # Safari
|
37
37
|
end # WebDriver
|
@@ -242,7 +242,7 @@ module Selenium
|
|
242
242
|
xpath = ".//option[normalize-space(.) = #{Escaper.escape text}]"
|
243
243
|
opts = @element.find_elements(xpath: xpath)
|
244
244
|
|
245
|
-
return opts unless opts.empty? &&
|
245
|
+
return opts unless opts.empty? && /\s+/.match?(text)
|
246
246
|
|
247
247
|
longest_word = text.split(/\s+/).max_by(&:length)
|
248
248
|
if longest_word.empty?
|
data/selenium-webdriver.gemspec
CHANGED
@@ -26,13 +26,13 @@ Gem::Specification.new do |s|
|
|
26
26
|
}
|
27
27
|
|
28
28
|
s.required_rubygems_version = Gem::Requirement.new('> 1.3.1') if s.respond_to? :required_rubygems_version=
|
29
|
-
s.required_ruby_version = Gem::Requirement.new('>= 2.
|
29
|
+
s.required_ruby_version = Gem::Requirement.new('>= 2.4')
|
30
30
|
|
31
31
|
s.files = Dir[root + '/**/*'].reject { |e| e =~ /ruby\.iml|build\.desc/ }.map { |e| e.sub(root + '/', '') }
|
32
32
|
s.require_paths = ['lib']
|
33
33
|
|
34
|
-
s.add_runtime_dependency 'childprocess', ['>= 0.5', '<
|
35
|
-
s.add_runtime_dependency 'rubyzip', ['>= 1.2.2']
|
34
|
+
s.add_runtime_dependency 'childprocess', ['>= 0.5', '< 2.0']
|
35
|
+
s.add_runtime_dependency 'rubyzip', ['~> 1.2', '>= 1.2.2']
|
36
36
|
|
37
37
|
# childprocess requires ffi on windows but doesn't declare it in its dependencies
|
38
38
|
s.add_development_dependency 'ffi'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: selenium-webdriver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0.alpha1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Rodionov
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2019-
|
13
|
+
date: 2019-05-01 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
version: '0.5'
|
21
21
|
- - "<"
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: '
|
23
|
+
version: '2.0'
|
24
24
|
name: childprocess
|
25
25
|
prerelease: false
|
26
26
|
type: :runtime
|
@@ -31,10 +31,13 @@ dependencies:
|
|
31
31
|
version: '0.5'
|
32
32
|
- - "<"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: '
|
34
|
+
version: '2.0'
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
requirement: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.2'
|
38
41
|
- - ">="
|
39
42
|
- !ruby/object:Gem::Version
|
40
43
|
version: 1.2.2
|
@@ -43,6 +46,9 @@ dependencies:
|
|
43
46
|
type: :runtime
|
44
47
|
version_requirements: !ruby/object:Gem::Requirement
|
45
48
|
requirements:
|
49
|
+
- - "~>"
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '1.2'
|
46
52
|
- - ">="
|
47
53
|
- !ruby/object:Gem::Version
|
48
54
|
version: 1.2.2
|
@@ -255,6 +261,7 @@ files:
|
|
255
261
|
- lib/selenium/webdriver/common/touch_screen.rb
|
256
262
|
- lib/selenium/webdriver/common/w3c_action_builder.rb
|
257
263
|
- lib/selenium/webdriver/common/w3c_manager.rb
|
264
|
+
- lib/selenium/webdriver/common/w3c_options.rb
|
258
265
|
- lib/selenium/webdriver/common/wait.rb
|
259
266
|
- lib/selenium/webdriver/common/window.rb
|
260
267
|
- lib/selenium/webdriver/common/zipper.rb
|
@@ -265,6 +272,7 @@ files:
|
|
265
272
|
- lib/selenium/webdriver/edge/service.rb
|
266
273
|
- lib/selenium/webdriver/firefox.rb
|
267
274
|
- lib/selenium/webdriver/firefox/binary.rb
|
275
|
+
- lib/selenium/webdriver/firefox/bridge.rb
|
268
276
|
- lib/selenium/webdriver/firefox/driver.rb
|
269
277
|
- lib/selenium/webdriver/firefox/extension.rb
|
270
278
|
- lib/selenium/webdriver/firefox/extension/prefs.json
|
@@ -287,6 +295,7 @@ files:
|
|
287
295
|
- lib/selenium/webdriver/remote.rb
|
288
296
|
- lib/selenium/webdriver/remote/bridge.rb
|
289
297
|
- lib/selenium/webdriver/remote/capabilities.rb
|
298
|
+
- lib/selenium/webdriver/remote/commands.rb
|
290
299
|
- lib/selenium/webdriver/remote/driver.rb
|
291
300
|
- lib/selenium/webdriver/remote/http/common.rb
|
292
301
|
- lib/selenium/webdriver/remote/http/curb.rb
|
@@ -327,7 +336,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
327
336
|
requirements:
|
328
337
|
- - ">="
|
329
338
|
- !ruby/object:Gem::Version
|
330
|
-
version: '2.
|
339
|
+
version: '2.4'
|
331
340
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
332
341
|
requirements:
|
333
342
|
- - ">"
|