selenium-webdriver 3.141.0 → 3.142.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES +150 -0
- data/Gemfile +2 -0
- data/LICENSE +1 -1
- data/lib/selenium/server.rb +9 -7
- data/lib/selenium/webdriver/atoms/getAttribute.js +6 -7
- data/lib/selenium/webdriver/atoms/isDisplayed.js +60 -59
- data/lib/selenium/webdriver/atoms.rb +20 -1
- data/lib/selenium/webdriver/chrome/bridge.rb +23 -3
- data/lib/selenium/webdriver/chrome/driver.rb +30 -20
- data/lib/selenium/webdriver/chrome/options.rb +11 -7
- data/lib/selenium/webdriver/chrome/profile.rb +6 -5
- data/lib/selenium/webdriver/chrome/service.rb +13 -13
- data/lib/selenium/webdriver/chrome.rb +10 -4
- data/lib/selenium/webdriver/common/action_builder.rb +2 -0
- data/lib/selenium/webdriver/common/alert.rb +2 -0
- data/lib/selenium/webdriver/common/bridge_helper.rb +8 -5
- data/lib/selenium/webdriver/common/driver.rb +22 -7
- data/lib/selenium/webdriver/common/driver_extensions/downloads_files.rb +2 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_addons.rb +2 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_debugger.rb +2 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_location.rb +3 -3
- data/lib/selenium/webdriver/common/driver_extensions/has_network_conditions.rb +2 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_network_connection.rb +3 -1
- data/lib/selenium/webdriver/common/driver_extensions/has_permissions.rb +2 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_remote_status.rb +2 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_session_id.rb +2 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_touch_screen.rb +2 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_web_storage.rb +2 -0
- data/lib/selenium/webdriver/common/driver_extensions/rotatable.rb +3 -1
- data/lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb +2 -0
- data/lib/selenium/webdriver/common/driver_extensions/uploads_files.rb +3 -3
- data/lib/selenium/webdriver/common/element.rb +3 -1
- data/lib/selenium/webdriver/common/error.rb +74 -18
- data/lib/selenium/webdriver/common/file_reaper.rb +3 -3
- data/lib/selenium/webdriver/common/html5/local_storage.rb +2 -0
- data/lib/selenium/webdriver/common/html5/session_storage.rb +2 -0
- data/lib/selenium/webdriver/common/html5/shared_web_storage.rb +4 -1
- data/lib/selenium/webdriver/common/interactions/input_device.rb +3 -0
- data/lib/selenium/webdriver/common/interactions/interaction.rb +3 -0
- data/lib/selenium/webdriver/common/interactions/interactions.rb +3 -1
- data/lib/selenium/webdriver/common/interactions/key_actions.rb +2 -0
- data/lib/selenium/webdriver/common/interactions/key_input.rb +4 -0
- data/lib/selenium/webdriver/common/interactions/none_input.rb +3 -0
- data/lib/selenium/webdriver/common/interactions/pointer_actions.rb +2 -0
- data/lib/selenium/webdriver/common/interactions/pointer_input.rb +7 -0
- data/lib/selenium/webdriver/common/keyboard.rb +4 -1
- data/lib/selenium/webdriver/common/keys.rb +3 -0
- data/lib/selenium/webdriver/common/log_entry.rb +4 -2
- data/lib/selenium/webdriver/common/logger.rb +15 -40
- data/lib/selenium/webdriver/common/logs.rb +2 -0
- data/lib/selenium/webdriver/common/manager.rb +177 -0
- data/lib/selenium/webdriver/common/mouse.rb +3 -0
- data/lib/selenium/webdriver/common/navigation.rb +2 -0
- data/lib/selenium/webdriver/common/options.rb +28 -126
- data/lib/selenium/webdriver/common/platform.rb +26 -30
- data/lib/selenium/webdriver/common/port_prober.rb +6 -19
- data/lib/selenium/webdriver/common/profile_helper.rb +2 -0
- data/lib/selenium/webdriver/common/proxy.rb +13 -5
- data/lib/selenium/webdriver/common/search_context.rb +6 -8
- data/lib/selenium/webdriver/common/service.rb +87 -29
- data/lib/selenium/webdriver/common/socket_lock.rb +10 -3
- data/lib/selenium/webdriver/common/socket_poller.rb +26 -18
- data/lib/selenium/webdriver/common/target_locator.rb +6 -4
- data/lib/selenium/webdriver/common/timeouts.rb +2 -0
- data/lib/selenium/webdriver/common/touch_action_builder.rb +5 -6
- data/lib/selenium/webdriver/common/touch_screen.rb +4 -1
- data/lib/selenium/webdriver/common/w3c_action_builder.rb +3 -0
- data/lib/selenium/webdriver/common/{w3c_options.rb → w3c_manager.rb} +3 -1
- data/lib/selenium/webdriver/common/wait.rb +13 -5
- data/lib/selenium/webdriver/common/window.rb +2 -0
- data/lib/selenium/webdriver/common/zipper.rb +3 -3
- data/lib/selenium/webdriver/common.rb +5 -2
- data/lib/selenium/webdriver/edge/bridge.rb +2 -0
- data/lib/selenium/webdriver/edge/driver.rb +6 -13
- data/lib/selenium/webdriver/edge/options.rb +3 -0
- data/lib/selenium/webdriver/edge/service.rb +8 -12
- data/lib/selenium/webdriver/edge.rb +11 -5
- data/lib/selenium/webdriver/firefox/binary.rb +9 -8
- data/lib/selenium/webdriver/firefox/driver.rb +2 -0
- data/lib/selenium/webdriver/firefox/extension.rb +4 -4
- data/lib/selenium/webdriver/firefox/launcher.rb +3 -0
- data/lib/selenium/webdriver/firefox/legacy/driver.rb +7 -3
- data/lib/selenium/webdriver/firefox/marionette/bridge.rb +4 -2
- data/lib/selenium/webdriver/firefox/marionette/driver.rb +6 -12
- data/lib/selenium/webdriver/firefox/options.rb +22 -9
- data/lib/selenium/webdriver/firefox/profile.rb +7 -8
- data/lib/selenium/webdriver/firefox/profiles_ini.rb +3 -0
- data/lib/selenium/webdriver/firefox/service.rb +8 -19
- data/lib/selenium/webdriver/firefox/util.rb +2 -0
- data/lib/selenium/webdriver/firefox.rb +10 -4
- data/lib/selenium/webdriver/ie/driver.rb +5 -11
- data/lib/selenium/webdriver/ie/options.rb +6 -4
- data/lib/selenium/webdriver/ie/service.rb +8 -12
- data/lib/selenium/webdriver/ie.rb +10 -4
- data/lib/selenium/webdriver/remote/bridge.rb +8 -6
- data/lib/selenium/webdriver/remote/capabilities.rb +23 -10
- data/lib/selenium/webdriver/remote/driver.rb +2 -0
- data/lib/selenium/webdriver/remote/http/common.rb +11 -4
- data/lib/selenium/webdriver/remote/http/curb.rb +4 -2
- data/lib/selenium/webdriver/remote/http/default.rb +31 -25
- data/lib/selenium/webdriver/remote/http/persistent.rb +3 -1
- data/lib/selenium/webdriver/remote/oss/bridge.rb +5 -2
- data/lib/selenium/webdriver/remote/oss/commands.rb +106 -104
- data/lib/selenium/webdriver/remote/response.rb +11 -3
- data/lib/selenium/webdriver/remote/server_error.rb +2 -0
- data/lib/selenium/webdriver/remote/w3c/bridge.rb +28 -13
- data/lib/selenium/webdriver/remote/w3c/capabilities.rb +37 -21
- data/lib/selenium/webdriver/remote/w3c/commands.rb +61 -58
- data/lib/selenium/webdriver/remote.rb +2 -0
- data/lib/selenium/webdriver/safari/bridge.rb +5 -3
- data/lib/selenium/webdriver/safari/driver.rb +9 -11
- data/lib/selenium/webdriver/safari/options.rb +2 -0
- data/lib/selenium/webdriver/safari/service.rb +6 -25
- data/lib/selenium/webdriver/safari.rb +11 -4
- data/lib/selenium/webdriver/support/abstract_event_listener.rb +2 -0
- data/lib/selenium/webdriver/support/block_event_listener.rb +3 -1
- data/lib/selenium/webdriver/support/color.rb +11 -9
- data/lib/selenium/webdriver/support/escaper.rb +2 -0
- data/lib/selenium/webdriver/support/event_firing_bridge.rb +3 -1
- data/lib/selenium/webdriver/support/select.rb +19 -18
- data/lib/selenium/webdriver/support.rb +2 -0
- data/lib/selenium/webdriver/version.rb +3 -1
- data/lib/selenium/webdriver.rb +3 -1
- data/lib/selenium-webdriver.rb +2 -0
- data/selenium-webdriver.gemspec +15 -8
- metadata +86 -27
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Licensed to the Software Freedom Conservancy (SFC) under one
|
2
4
|
# or more contributor license agreements. See the NOTICE file
|
3
5
|
# distributed with this work for additional information
|
@@ -17,19 +19,23 @@
|
|
17
19
|
|
18
20
|
require 'selenium/webdriver/ie/driver'
|
19
21
|
require 'selenium/webdriver/ie/options'
|
20
|
-
require 'selenium/webdriver/ie/service'
|
21
22
|
|
22
23
|
module Selenium
|
23
24
|
module WebDriver
|
24
25
|
module IE
|
25
26
|
def self.driver_path=(path)
|
26
|
-
|
27
|
-
|
27
|
+
WebDriver.logger.deprecate 'Selenium::WebDriver::IE#driver_path=',
|
28
|
+
'Selenium::WebDriver::IE::Service#driver_path='
|
29
|
+
Selenium::WebDriver::IE::Service.driver_path = path
|
28
30
|
end
|
29
31
|
|
30
32
|
def self.driver_path
|
31
|
-
|
33
|
+
WebDriver.logger.deprecate 'Selenium::WebDriver::IE#driver_path',
|
34
|
+
'Selenium::WebDriver::IE::Service#driver_path'
|
35
|
+
Selenium::WebDriver::IE::Service.driver_path
|
32
36
|
end
|
33
37
|
end # IE
|
34
38
|
end # WebDriver
|
35
39
|
end # Selenium
|
40
|
+
|
41
|
+
require 'selenium/webdriver/ie/service'
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Licensed to the Software Freedom Conservancy (SFC) under one
|
2
4
|
# or more contributor license agreements. See the NOTICE file
|
3
5
|
# distributed with this work for additional information
|
@@ -24,7 +26,7 @@ module Selenium
|
|
24
26
|
|
25
27
|
PORT = 4444
|
26
28
|
COMMANDS = {
|
27
|
-
new_session: [:post, 'session'
|
29
|
+
new_session: [:post, 'session']
|
28
30
|
}.freeze
|
29
31
|
|
30
32
|
attr_accessor :context, :http, :file_detector
|
@@ -46,6 +48,7 @@ module Selenium
|
|
46
48
|
unless Capabilities.respond_to?(desired_capabilities)
|
47
49
|
raise Error::WebDriverError, "invalid desired capability: #{desired_capabilities.inspect}"
|
48
50
|
end
|
51
|
+
|
49
52
|
desired_capabilities = Capabilities.__send__(desired_capabilities)
|
50
53
|
end
|
51
54
|
|
@@ -54,9 +57,9 @@ module Selenium
|
|
54
57
|
|
55
58
|
case bridge.dialect
|
56
59
|
when :oss
|
57
|
-
Remote::OSS::Bridge.new(capabilities, bridge.session_id, opts)
|
60
|
+
Remote::OSS::Bridge.new(capabilities, bridge.session_id, **opts)
|
58
61
|
when :w3c
|
59
|
-
Remote::W3C::Bridge.new(capabilities, bridge.session_id, opts)
|
62
|
+
Remote::W3C::Bridge.new(capabilities, bridge.session_id, **opts)
|
60
63
|
else
|
61
64
|
raise WebDriverError, 'cannot understand dialect'
|
62
65
|
end
|
@@ -112,9 +115,7 @@ module Selenium
|
|
112
115
|
end
|
113
116
|
end
|
114
117
|
|
115
|
-
unless @session_id
|
116
|
-
raise Error::WebDriverError, 'no sessionId in returned payload'
|
117
|
-
end
|
118
|
+
raise Error::WebDriverError, 'no sessionId in returned payload' unless @session_id
|
118
119
|
|
119
120
|
if oss_status
|
120
121
|
WebDriver.logger.info 'Detected OSS dialect.'
|
@@ -172,6 +173,7 @@ module Selenium
|
|
172
173
|
|
173
174
|
def commands(command)
|
174
175
|
raise NotImplementedError unless command == :new_session
|
176
|
+
|
175
177
|
COMMANDS[command]
|
176
178
|
end
|
177
179
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Licensed to the Software Freedom Conservancy (SFC) under one
|
2
4
|
# or more contributor license agreements. See the NOTICE file
|
3
5
|
# distributed with this work for additional information
|
@@ -44,6 +46,7 @@ module Selenium
|
|
44
46
|
end
|
45
47
|
|
46
48
|
next if key == :proxy
|
49
|
+
|
47
50
|
define_method "#{key}=" do |value|
|
48
51
|
@capabilities[key] = value
|
49
52
|
end
|
@@ -80,14 +83,21 @@ module Selenium
|
|
80
83
|
def edge(opts = {})
|
81
84
|
new({
|
82
85
|
browser_name: 'MicrosoftEdge',
|
83
|
-
platform: :windows
|
84
|
-
javascript_enabled: true,
|
85
|
-
takes_screenshot: true,
|
86
|
-
css_selectors_enabled: true
|
86
|
+
platform: :windows
|
87
87
|
}.merge(opts))
|
88
88
|
end
|
89
89
|
|
90
90
|
def firefox(opts = {})
|
91
|
+
opts[:browser_version] = opts.delete(:version) if opts.key?(:version)
|
92
|
+
opts[:platform_name] = opts.delete(:platform) if opts.key?(:platform)
|
93
|
+
opts[:timeouts] = {}
|
94
|
+
opts[:timeouts]['implicit'] = opts.delete(:implicit_timeout) if opts.key?(:implicit_timeout)
|
95
|
+
opts[:timeouts]['pageLoad'] = opts.delete(:page_load_timeout) if opts.key?(:page_load_timeout)
|
96
|
+
opts[:timeouts]['script'] = opts.delete(:script_timeout) if opts.key?(:script_timeout)
|
97
|
+
new({browser_name: 'firefox', marionette: true}.merge(opts))
|
98
|
+
end
|
99
|
+
|
100
|
+
def firefox_legacy(opts = {})
|
91
101
|
new({
|
92
102
|
browser_name: 'firefox',
|
93
103
|
javascript_enabled: true,
|
@@ -175,10 +185,6 @@ module Selenium
|
|
175
185
|
# @option :native_events [Boolean] does this driver use native events?
|
176
186
|
# @option :proxy [Selenium::WebDriver::Proxy, Hash] proxy configuration
|
177
187
|
#
|
178
|
-
# Firefox-specific options:
|
179
|
-
#
|
180
|
-
# @option :firefox_profile [Selenium::WebDriver::Firefox::Profile] the firefox profile to use
|
181
|
-
#
|
182
188
|
# @api public
|
183
189
|
#
|
184
190
|
|
@@ -224,7 +230,7 @@ module Selenium
|
|
224
230
|
# @api private
|
225
231
|
#
|
226
232
|
|
227
|
-
def as_json(*)
|
233
|
+
def as_json(*) # rubocop:disable Metrics/CyclomaticComplexity
|
228
234
|
hash = {}
|
229
235
|
|
230
236
|
@capabilities.each do |key, value|
|
@@ -232,10 +238,16 @@ module Selenium
|
|
232
238
|
when :platform
|
233
239
|
hash['platform'] = value.to_s.upcase
|
234
240
|
when :firefox_profile
|
235
|
-
|
241
|
+
if value
|
242
|
+
WebDriver.logger.deprecate(':firefox_profile capabilitiy', 'Selenium::WebDriver::Firefox::Options#profile')
|
243
|
+
hash['firefox_profile'] = value.as_json['zip']
|
244
|
+
end
|
236
245
|
when :proxy
|
237
246
|
hash['proxy'] = value.as_json if value
|
238
247
|
when String, :firefox_binary
|
248
|
+
if key == :firefox_binary && value
|
249
|
+
WebDriver.logger.deprecate(':firefox_binary capabilitiy', 'Selenium::WebDriver::Firefox::Options#binary')
|
250
|
+
end
|
239
251
|
hash[key.to_s] = value
|
240
252
|
when Symbol
|
241
253
|
hash[camel_case(key.to_s)] = value
|
@@ -253,6 +265,7 @@ module Selenium
|
|
253
265
|
|
254
266
|
def ==(other)
|
255
267
|
return false unless other.is_a? self.class
|
268
|
+
|
256
269
|
as_json == other.as_json
|
257
270
|
end
|
258
271
|
alias_method :eql?, :==
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Licensed to the Software Freedom Conservancy (SFC) under one
|
2
4
|
# or more contributor license agreements. See the NOTICE file
|
3
5
|
# distributed with this work for additional information
|
@@ -21,7 +23,7 @@ module Selenium
|
|
21
23
|
module Http
|
22
24
|
class Common
|
23
25
|
MAX_REDIRECTS = 20 # same as chromium/gecko
|
24
|
-
CONTENT_TYPE = 'application/json'
|
26
|
+
CONTENT_TYPE = 'application/json'
|
25
27
|
DEFAULT_HEADERS = {
|
26
28
|
'Accept' => CONTENT_TYPE,
|
27
29
|
'Content-Type' => "#{CONTENT_TYPE}; charset=UTF-8",
|
@@ -50,7 +52,7 @@ module Selenium
|
|
50
52
|
|
51
53
|
if command_hash
|
52
54
|
payload = JSON.generate(command_hash)
|
53
|
-
headers['Content-Length'] = payload.bytesize.to_s if [
|
55
|
+
headers['Content-Length'] = payload.bytesize.to_s if %i[post put].include?(verb)
|
54
56
|
|
55
57
|
WebDriver.logger.info(" >>> #{url} | #{payload}")
|
56
58
|
WebDriver.logger.debug(" > #{headers.inspect}")
|
@@ -66,6 +68,7 @@ module Selenium
|
|
66
68
|
|
67
69
|
def server_url
|
68
70
|
return @server_url if @server_url
|
71
|
+
|
69
72
|
raise Error::WebDriverError, 'server_url not set'
|
70
73
|
end
|
71
74
|
|
@@ -81,12 +84,16 @@ module Selenium
|
|
81
84
|
|
82
85
|
if content_type.include? CONTENT_TYPE
|
83
86
|
raise Error::WebDriverError, "empty body: #{content_type.inspect} (#{code})\n#{body}" if body.empty?
|
87
|
+
|
84
88
|
Response.new(code, JSON.parse(body))
|
85
89
|
elsif code == 204
|
86
90
|
Response.new(code)
|
87
91
|
else
|
88
|
-
msg =
|
89
|
-
|
92
|
+
msg = if body.empty?
|
93
|
+
"unexpected response, code=#{code}, content-type=#{content_type.inspect}"
|
94
|
+
else
|
95
|
+
"unexpected response, code=#{code}, content-type=#{content_type.inspect}\n#{body}"
|
96
|
+
end
|
90
97
|
|
91
98
|
raise Error::WebDriverError, msg
|
92
99
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Licensed to the Software Freedom Conservancy (SFC) under one
|
2
4
|
# or more contributor license agreements. See the NOTICE file
|
3
5
|
# distributed with this work for additional information
|
@@ -77,7 +79,7 @@ module Selenium
|
|
77
79
|
end
|
78
80
|
|
79
81
|
def client
|
80
|
-
@client ||=
|
82
|
+
@client ||= begin
|
81
83
|
c = Curl::Easy.new
|
82
84
|
|
83
85
|
c.max_redirects = MAX_REDIRECTS
|
@@ -86,7 +88,7 @@ module Selenium
|
|
86
88
|
c.verbose = WebDriver.logger.info?
|
87
89
|
|
88
90
|
c
|
89
|
-
|
91
|
+
end
|
90
92
|
end
|
91
93
|
end # Curb
|
92
94
|
end # Http
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Licensed to the Software Freedom Conservancy (SFC) under one
|
2
4
|
# or more contributor license agreements. See the NOTICE file
|
3
5
|
# distributed with this work for additional information
|
@@ -48,22 +50,26 @@ module Selenium
|
|
48
50
|
self.read_timeout = value
|
49
51
|
end
|
50
52
|
|
53
|
+
def close
|
54
|
+
@http&.finish
|
55
|
+
end
|
56
|
+
|
51
57
|
private
|
52
58
|
|
53
59
|
def http
|
54
|
-
@http ||=
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
+
@http ||= begin
|
61
|
+
http = new_http_client
|
62
|
+
if server_url.scheme == 'https'
|
63
|
+
http.use_ssl = true
|
64
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
65
|
+
end
|
60
66
|
|
61
|
-
|
62
|
-
|
63
|
-
|
67
|
+
# Defaulting open_timeout to nil to be consistent with Ruby 2.2 and earlier.
|
68
|
+
http.open_timeout = open_timeout
|
69
|
+
http.read_timeout = read_timeout if read_timeout
|
64
70
|
|
65
|
-
|
66
|
-
|
71
|
+
http.start
|
72
|
+
end
|
67
73
|
end
|
68
74
|
|
69
75
|
MAX_RETRIES = 3
|
@@ -83,22 +89,26 @@ module Selenium
|
|
83
89
|
#
|
84
90
|
# http://msdn.microsoft.com/en-us/library/aa560610%28v=bts.20%29.aspx
|
85
91
|
raise if retries >= MAX_RETRIES
|
92
|
+
|
86
93
|
retries += 1
|
87
94
|
sleep 2
|
88
95
|
retry
|
89
96
|
rescue Errno::EADDRNOTAVAIL => ex
|
90
97
|
# a retry is sometimes needed when the port becomes temporarily unavailable
|
91
98
|
raise if retries >= MAX_RETRIES
|
99
|
+
|
92
100
|
retries += 1
|
93
101
|
sleep 2
|
94
102
|
retry
|
95
103
|
rescue Errno::ECONNREFUSED => ex
|
96
104
|
raise ex.class, "using proxy: #{proxy.http}" if use_proxy?
|
105
|
+
|
97
106
|
raise
|
98
107
|
end
|
99
108
|
|
100
109
|
if response.is_a? Net::HTTPRedirection
|
101
110
|
raise Error::WebDriverError, 'too many redirects' if redirects >= MAX_REDIRECTS
|
111
|
+
|
102
112
|
request(:get, URI.parse(response['Location']), DEFAULT_HEADERS.dup, nil, redirects + 1)
|
103
113
|
else
|
104
114
|
create_response response.code, response.body, response.content_type
|
@@ -108,9 +118,7 @@ module Selenium
|
|
108
118
|
def new_request_for(verb, url, headers, payload)
|
109
119
|
req = Net::HTTP.const_get(verb.to_s.capitalize).new(url.path, headers)
|
110
120
|
|
111
|
-
if server_url.userinfo
|
112
|
-
req.basic_auth server_url.user, server_url.password
|
113
|
-
end
|
121
|
+
req.basic_auth server_url.user, server_url.password if server_url.userinfo
|
114
122
|
|
115
123
|
req.body = payload if payload
|
116
124
|
|
@@ -124,9 +132,7 @@ module Selenium
|
|
124
132
|
def new_http_client
|
125
133
|
if use_proxy?
|
126
134
|
url = @proxy.http
|
127
|
-
unless proxy.respond_to?(:http) && url
|
128
|
-
raise Error::WebDriverError, "expected HTTP proxy, got #{@proxy.inspect}"
|
129
|
-
end
|
135
|
+
raise Error::WebDriverError, "expected HTTP proxy, got #{@proxy.inspect}" unless proxy.respond_to?(:http) && url
|
130
136
|
|
131
137
|
proxy = URI.parse(url)
|
132
138
|
|
@@ -138,15 +144,15 @@ module Selenium
|
|
138
144
|
end
|
139
145
|
|
140
146
|
def proxy
|
141
|
-
@proxy ||=
|
142
|
-
|
143
|
-
|
147
|
+
@proxy ||= begin
|
148
|
+
proxy = ENV['http_proxy'] || ENV['HTTP_PROXY']
|
149
|
+
no_proxy = ENV['no_proxy'] || ENV['NO_PROXY']
|
144
150
|
|
145
|
-
|
146
|
-
|
147
|
-
|
151
|
+
if proxy
|
152
|
+
proxy = "http://#{proxy}" unless proxy.start_with?('http://')
|
153
|
+
Proxy.new(http: proxy, no_proxy: no_proxy)
|
154
|
+
end
|
148
155
|
end
|
149
|
-
)
|
150
156
|
end
|
151
157
|
|
152
158
|
def use_proxy?
|
@@ -161,7 +167,7 @@ module Selenium
|
|
161
167
|
rescue ArgumentError
|
162
168
|
false
|
163
169
|
end
|
164
|
-
|
170
|
+
)
|
165
171
|
end
|
166
172
|
|
167
173
|
!ignored
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Licensed to the Software Freedom Conservancy (SFC) under one
|
2
4
|
# or more contributor license agreements. See the NOTICE file
|
3
5
|
# distributed with this work for additional information
|
@@ -24,7 +26,7 @@ module Selenium
|
|
24
26
|
# @api private
|
25
27
|
class Persistent < Default
|
26
28
|
def close
|
27
|
-
@http
|
29
|
+
@http&.shutdown
|
28
30
|
end
|
29
31
|
|
30
32
|
private
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Licensed to the Software Freedom Conservancy (SFC) under one
|
2
4
|
# or more contributor license agreements. See the NOTICE file
|
3
5
|
# distributed with this work for additional information
|
@@ -279,8 +281,8 @@ module Selenium
|
|
279
281
|
# cookies
|
280
282
|
#
|
281
283
|
|
282
|
-
def
|
283
|
-
@
|
284
|
+
def manage
|
285
|
+
@manage ||= WebDriver::Manager.new(self)
|
284
286
|
end
|
285
287
|
|
286
288
|
def add_cookie(cookie)
|
@@ -571,6 +573,7 @@ module Selenium
|
|
571
573
|
|
572
574
|
def assert_javascript_enabled
|
573
575
|
return if capabilities.javascript_enabled?
|
576
|
+
|
574
577
|
raise Error::UnsupportedOperationError, 'underlying webdriver instance does not support javascript'
|
575
578
|
end
|
576
579
|
|