selenium-webdriver 4.5.0 → 4.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES +117 -1
- data/LICENSE +1 -1
- data/NOTICE +1 -1
- data/bin/linux/selenium-manager +0 -0
- data/bin/macos/selenium-manager +0 -0
- data/bin/windows/selenium-manager.exe +0 -0
- data/lib/selenium/server.rb +6 -8
- data/lib/selenium/webdriver/atoms/findElements.js +0 -0
- data/lib/selenium/webdriver/atoms/getAttribute.js +0 -0
- data/lib/selenium/webdriver/atoms/isDisplayed.js +0 -0
- data/lib/selenium/webdriver/atoms/mutationListener.js +0 -0
- data/lib/selenium/webdriver/atoms.rb +2 -3
- data/lib/selenium/webdriver/bidi/browsing_context.rb +88 -0
- data/lib/selenium/webdriver/bidi/browsing_context_info.rb +35 -0
- data/lib/selenium/webdriver/bidi/log/base_log_entry.rb +35 -0
- data/lib/selenium/webdriver/bidi/log/console_log_entry.rb +35 -0
- data/lib/selenium/webdriver/bidi/log/filter_by.rb +40 -0
- data/lib/selenium/webdriver/bidi/log/generic_log_entry.rb +33 -0
- data/lib/selenium/webdriver/bidi/log/javascript_log_entry.rb +33 -0
- data/lib/selenium/webdriver/bidi/log_inspector.rb +143 -0
- data/lib/selenium/webdriver/bidi/navigate_result.rb +33 -0
- data/lib/selenium/webdriver/bidi/session.rb +13 -0
- data/lib/selenium/webdriver/bidi.rb +3 -2
- data/lib/selenium/webdriver/chrome/driver.rb +9 -30
- data/lib/selenium/webdriver/chrome/features.rb +5 -72
- data/lib/selenium/webdriver/chrome/options.rb +3 -237
- data/lib/selenium/webdriver/chrome/profile.rb +3 -83
- data/lib/selenium/webdriver/chrome/service.rb +3 -23
- data/lib/selenium/webdriver/chromium/driver.rb +61 -0
- data/lib/selenium/webdriver/chromium/features.rb +103 -0
- data/lib/selenium/webdriver/chromium/options.rb +261 -0
- data/lib/selenium/webdriver/chromium/profile.rb +113 -0
- data/lib/selenium/webdriver/chromium/service.rb +42 -0
- data/lib/selenium/webdriver/chromium.rb +32 -0
- data/lib/selenium/webdriver/common/action_builder.rb +11 -48
- data/lib/selenium/webdriver/common/child_process.rb +124 -0
- data/lib/selenium/webdriver/common/driver.rb +21 -26
- data/lib/selenium/webdriver/common/driver_extensions/downloads_files.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/full_page_screenshot.rb +0 -1
- data/lib/selenium/webdriver/common/driver_extensions/has_addons.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_apple_permissions.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_authentication.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_bidi.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_casting.rb +0 -1
- data/lib/selenium/webdriver/common/driver_extensions/has_cdp.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_context.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_debugger.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_devtools.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_launching.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_location.rb +1 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_log_events.rb +0 -1
- data/lib/selenium/webdriver/common/driver_extensions/has_network_conditions.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_network_interception.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_permissions.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_pinned_scripts.rb +0 -2
- data/lib/selenium/webdriver/common/driver_finder.rb +43 -0
- data/lib/selenium/webdriver/common/element.rb +6 -6
- data/lib/selenium/webdriver/common/error.rb +0 -2
- data/lib/selenium/webdriver/common/html5/shared_web_storage.rb +2 -2
- data/lib/selenium/webdriver/common/interactions/pointer_actions.rb +3 -3
- data/lib/selenium/webdriver/common/interactions/pointer_move.rb +2 -2
- data/lib/selenium/webdriver/common/interactions/scroll.rb +7 -5
- data/lib/selenium/webdriver/common/local_driver.rb +55 -0
- data/lib/selenium/webdriver/common/logger.rb +10 -2
- data/lib/selenium/webdriver/common/options.rb +30 -8
- data/lib/selenium/webdriver/common/platform.rb +4 -0
- data/lib/selenium/webdriver/common/profile_helper.rb +1 -1
- data/lib/selenium/webdriver/common/proxy.rb +1 -1
- data/lib/selenium/webdriver/common/selenium_manager.rb +108 -0
- data/lib/selenium/webdriver/common/service.rb +11 -22
- data/lib/selenium/webdriver/common/service_manager.rb +3 -11
- data/lib/selenium/webdriver/common/shadow_root.rb +1 -2
- data/lib/selenium/webdriver/common/socket_lock.rb +2 -2
- data/lib/selenium/webdriver/common/takes_screenshot.rb +2 -3
- data/lib/selenium/webdriver/common/target_locator.rb +2 -3
- data/lib/selenium/webdriver/common/timeouts.rb +2 -2
- data/lib/selenium/webdriver/common/virtual_authenticator/credential.rb +8 -6
- data/lib/selenium/webdriver/common/virtual_authenticator/virtual_authenticator.rb +0 -1
- data/lib/selenium/webdriver/common/virtual_authenticator/virtual_authenticator_options.rb +16 -16
- data/lib/selenium/webdriver/common/websocket_connection.rb +10 -2
- data/lib/selenium/webdriver/common.rb +4 -0
- data/lib/selenium/webdriver/devtools/console_event.rb +0 -2
- data/lib/selenium/webdriver/devtools/exception_event.rb +0 -2
- data/lib/selenium/webdriver/devtools/mutation_event.rb +0 -2
- data/lib/selenium/webdriver/devtools/network_interceptor.rb +4 -7
- data/lib/selenium/webdriver/devtools/pinned_script.rb +0 -2
- data/lib/selenium/webdriver/devtools/request.rb +0 -2
- data/lib/selenium/webdriver/devtools/response.rb +0 -2
- data/lib/selenium/webdriver/devtools.rb +11 -2
- data/lib/selenium/webdriver/edge/driver.rb +9 -3
- data/lib/selenium/webdriver/edge/features.rb +3 -4
- data/lib/selenium/webdriver/edge/options.rb +3 -5
- data/lib/selenium/webdriver/edge/profile.rb +2 -2
- data/lib/selenium/webdriver/edge/service.rb +2 -6
- data/lib/selenium/webdriver/firefox/driver.rb +8 -2
- data/lib/selenium/webdriver/firefox/features.rb +0 -1
- data/lib/selenium/webdriver/firefox/options.rb +4 -1
- data/lib/selenium/webdriver/firefox/profile.rb +6 -6
- data/lib/selenium/webdriver/firefox/service.rb +0 -6
- data/lib/selenium/webdriver/ie/driver.rb +7 -1
- data/lib/selenium/webdriver/ie/service.rb +1 -7
- data/lib/selenium/webdriver/remote/{commands.rb → bridge/commands.rb} +0 -2
- data/lib/selenium/webdriver/remote/bridge.rb +9 -15
- data/lib/selenium/webdriver/remote/capabilities.rb +34 -12
- data/lib/selenium/webdriver/remote/driver.rb +19 -13
- data/lib/selenium/webdriver/remote/http/curb.rb +0 -2
- data/lib/selenium/webdriver/remote/http/default.rb +1 -0
- data/lib/selenium/webdriver/remote/response.rb +0 -1
- data/lib/selenium/webdriver/remote.rb +0 -1
- data/lib/selenium/webdriver/safari/driver.rb +7 -1
- data/lib/selenium/webdriver/safari/features.rb +0 -2
- data/lib/selenium/webdriver/safari/options.rb +5 -1
- data/lib/selenium/webdriver/safari/service.rb +0 -4
- data/lib/selenium/webdriver/safari.rb +1 -1
- data/lib/selenium/webdriver/support/color.rb +15 -15
- data/lib/selenium/webdriver/support/guards/guard.rb +0 -2
- data/lib/selenium/webdriver/support/guards/guard_condition.rb +0 -2
- data/lib/selenium/webdriver/support/relative_locator.rb +0 -1
- data/lib/selenium/webdriver/support/select.rb +2 -5
- data/lib/selenium/webdriver/version.rb +1 -1
- data/lib/selenium/webdriver.rb +3 -4
- data/selenium-webdriver.gemspec +8 -9
- metadata +33 -74
- data/lib/selenium/webdriver/support/cdp/domain.rb.erb +0 -63
- data/lib/selenium/webdriver/support/cdp_client_generator.rb +0 -108
@@ -20,14 +20,12 @@
|
|
20
20
|
module Selenium
|
21
21
|
module WebDriver
|
22
22
|
module Remote
|
23
|
-
|
24
23
|
#
|
25
24
|
# Specification of the desired and/or actual capabilities of the browser that the
|
26
25
|
# server is being asked to create.
|
27
26
|
#
|
28
27
|
|
29
28
|
class Capabilities
|
30
|
-
|
31
29
|
KNOWN = [
|
32
30
|
:browser_name,
|
33
31
|
:browser_version,
|
@@ -59,10 +57,25 @@ module Selenium
|
|
59
57
|
# Backward compatibility
|
60
58
|
#
|
61
59
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
60
|
+
def version
|
61
|
+
WebDriver.logger.deprecate('`Capabilities#version`', '`Capabilities#browser_version`', id: :jwp_caps)
|
62
|
+
browser_version
|
63
|
+
end
|
64
|
+
|
65
|
+
def version=(value)
|
66
|
+
WebDriver.logger.deprecate('`Capabilities#version=`', '`Capabilities#browser_version=`', id: :jwp_caps)
|
67
|
+
self.browser_version = value
|
68
|
+
end
|
69
|
+
|
70
|
+
def platform
|
71
|
+
WebDriver.logger.deprecate('`Capabilities#platform`', '`Capabilities#platform_name`', id: :jwp_caps)
|
72
|
+
platform_name
|
73
|
+
end
|
74
|
+
|
75
|
+
def platform=(value)
|
76
|
+
WebDriver.logger.deprecate('`Capabilities#platform=`', '`Capabilities#platform_name=`', id: :jwp_caps)
|
77
|
+
self.platform_name = value
|
78
|
+
end
|
66
79
|
|
67
80
|
#
|
68
81
|
# Convenience methods for the common choices.
|
@@ -70,44 +83,52 @@ module Selenium
|
|
70
83
|
|
71
84
|
class << self
|
72
85
|
def chrome(opts = {})
|
86
|
+
WebDriver.logger.deprecate('Remote::Capabilities.chrome', 'Options.chrome', id: :caps_browsers)
|
73
87
|
new({
|
74
88
|
browser_name: 'chrome'
|
75
89
|
}.merge(opts))
|
76
90
|
end
|
77
91
|
|
78
92
|
def edge(opts = {})
|
93
|
+
WebDriver.logger.deprecate('Remote::Capabilities.edge', 'Options.edge', id: :caps_browsers)
|
79
94
|
new({
|
80
95
|
browser_name: 'MicrosoftEdge'
|
81
96
|
}.merge(opts))
|
82
97
|
end
|
83
|
-
|
98
|
+
alias microsoftedge edge
|
84
99
|
|
85
100
|
def firefox(opts = {})
|
101
|
+
WebDriver.logger.deprecate('Remote::Capabilities.firefox', 'Options.firefox', id: :caps_browsers)
|
86
102
|
new({
|
87
103
|
browser_name: 'firefox'
|
88
104
|
}.merge(opts))
|
89
105
|
end
|
90
|
-
|
106
|
+
alias ff firefox
|
91
107
|
|
92
108
|
def safari(opts = {})
|
109
|
+
WebDriver.logger.deprecate('Remote::Capabilities.safari', 'Options.safari', id: :caps_browsers)
|
93
110
|
new({
|
94
|
-
browser_name: Selenium::WebDriver::Safari.technology_preview? ?
|
111
|
+
browser_name: Selenium::WebDriver::Safari.technology_preview? ? 'Safari Technology Preview' : 'safari'
|
95
112
|
}.merge(opts))
|
96
113
|
end
|
97
114
|
|
98
115
|
def htmlunit(opts = {})
|
116
|
+
WebDriver.logger.deprecate('Remote::Capabilities.htmlunit',
|
117
|
+
'as argument in constructor',
|
118
|
+
id: :caps_browsers)
|
99
119
|
new({
|
100
120
|
browser_name: 'htmlunit'
|
101
121
|
}.merge(opts))
|
102
122
|
end
|
103
123
|
|
104
124
|
def internet_explorer(opts = {})
|
125
|
+
WebDriver.logger.deprecate('Remote::Capabilities.ie', 'Options.ie', id: :caps_browsers)
|
105
126
|
new({
|
106
127
|
browser_name: 'internet explorer',
|
107
128
|
platform_name: :windows
|
108
129
|
}.merge(opts))
|
109
130
|
end
|
110
|
-
|
131
|
+
alias ie internet_explorer
|
111
132
|
|
112
133
|
def always_match(capabilities)
|
113
134
|
new(always_match: capabilities)
|
@@ -134,7 +155,8 @@ module Selenium
|
|
134
155
|
|
135
156
|
# Remote Server Specific
|
136
157
|
if data.key?('webdriver.remote.sessionid')
|
137
|
-
caps[:remote_session_id] =
|
158
|
+
caps[:remote_session_id] =
|
159
|
+
data.delete('webdriver.remote.sessionid')
|
138
160
|
end
|
139
161
|
|
140
162
|
KNOWN.each do |cap|
|
@@ -269,7 +291,7 @@ module Selenium
|
|
269
291
|
as_json == other.as_json
|
270
292
|
end
|
271
293
|
|
272
|
-
|
294
|
+
alias eql? ==
|
273
295
|
|
274
296
|
protected
|
275
297
|
|
@@ -20,7 +20,6 @@
|
|
20
20
|
module Selenium
|
21
21
|
module WebDriver
|
22
22
|
module Remote
|
23
|
-
|
24
23
|
#
|
25
24
|
# Driver implementation for remote server.
|
26
25
|
# @api private
|
@@ -30,17 +29,12 @@ module Selenium
|
|
30
29
|
include DriverExtensions::UploadsFiles
|
31
30
|
include DriverExtensions::HasSessionId
|
32
31
|
|
33
|
-
def initialize(
|
34
|
-
|
35
|
-
if desired_capabilities.is_a?(Symbol)
|
36
|
-
unless Remote::Capabilities.respond_to?(desired_capabilities)
|
37
|
-
raise Error::WebDriverError, "invalid desired capability: #{desired_capabilities.inspect}"
|
38
|
-
end
|
32
|
+
def initialize(capabilities: nil, options: nil, service: nil, url: nil, **opts)
|
33
|
+
raise ArgumentError, "Can not set :service object on #{self.class}" if service
|
39
34
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
super
|
35
|
+
url ||= "http://#{Platform.localhost}:4444/wd/hub"
|
36
|
+
caps = process_options(options, capabilities)
|
37
|
+
super(caps: caps, url: url, **opts)
|
44
38
|
@bridge.file_detector = ->((filename, *)) { File.exist?(filename) && filename.to_s }
|
45
39
|
end
|
46
40
|
|
@@ -51,8 +45,20 @@ module Selenium
|
|
51
45
|
end
|
52
46
|
|
53
47
|
def devtools_version
|
54
|
-
capabilities['se:cdpVersion']&.split('.')&.first
|
55
|
-
|
48
|
+
cdp_version = capabilities['se:cdpVersion']&.split('.')&.first
|
49
|
+
raise Error::WebDriverError, 'DevTools is not supported by the Remote Server' unless cdp_version
|
50
|
+
|
51
|
+
Integer(cdp_version)
|
52
|
+
end
|
53
|
+
|
54
|
+
def process_options(options, capabilities)
|
55
|
+
if options && capabilities
|
56
|
+
msg = "Don't use both :options and :capabilities when initializing #{self.class}, prefer :options"
|
57
|
+
raise ArgumentError, msg
|
58
|
+
elsif options.nil? && capabilities.nil?
|
59
|
+
raise ArgumentError, "#{self.class} needs :options to be set"
|
60
|
+
end
|
61
|
+
options ? options.as_json : generate_capabilities(capabilities)
|
56
62
|
end
|
57
63
|
end # Driver
|
58
64
|
end # Remote
|
@@ -22,7 +22,6 @@ require 'curb'
|
|
22
22
|
module Selenium
|
23
23
|
module WebDriver
|
24
24
|
module Remote
|
25
|
-
|
26
25
|
module Http
|
27
26
|
#
|
28
27
|
# An alternative to the default Net::HTTP client.
|
@@ -38,7 +37,6 @@ module Selenium
|
|
38
37
|
#
|
39
38
|
|
40
39
|
class Curb < Common
|
41
|
-
|
42
40
|
def quit_errors
|
43
41
|
[Curl::Err::RecvError] + super
|
44
42
|
end
|
@@ -100,6 +100,7 @@ module Selenium
|
|
100
100
|
|
101
101
|
request(:get, URI.parse(response['Location']), DEFAULT_HEADERS.dup, nil, redirects + 1)
|
102
102
|
else
|
103
|
+
WebDriver.logger.debug(" <<< #{response.instance_variable_get(:@header).inspect}")
|
103
104
|
create_response response.code, response.body, response.content_type
|
104
105
|
end
|
105
106
|
end
|
@@ -27,7 +27,6 @@ module Selenium
|
|
27
27
|
autoload :Driver, 'selenium/webdriver/remote/driver'
|
28
28
|
autoload :Response, 'selenium/webdriver/remote/response'
|
29
29
|
autoload :Capabilities, 'selenium/webdriver/remote/capabilities'
|
30
|
-
autoload :COMMANDS, 'selenium/webdriver/remote/commands'
|
31
30
|
|
32
31
|
module Http
|
33
32
|
autoload :Common, 'selenium/webdriver/remote/http/common'
|
@@ -20,7 +20,6 @@
|
|
20
20
|
module Selenium
|
21
21
|
module WebDriver
|
22
22
|
module Safari
|
23
|
-
|
24
23
|
#
|
25
24
|
# Driver implementation for Safari.
|
26
25
|
# @api private
|
@@ -31,6 +30,13 @@ module Selenium
|
|
31
30
|
DriverExtensions::HasApplePermissions,
|
32
31
|
DriverExtensions::HasWebStorage].freeze
|
33
32
|
|
33
|
+
include LocalDriver
|
34
|
+
|
35
|
+
def initialize(capabilities: nil, options: nil, service: nil, url: nil, **opts)
|
36
|
+
caps, url = initialize_local_driver(capabilities, options, service, url)
|
37
|
+
super(caps: caps, url: url, **opts)
|
38
|
+
end
|
39
|
+
|
34
40
|
def browser
|
35
41
|
:safari
|
36
42
|
end
|
@@ -21,7 +21,6 @@ module Selenium
|
|
21
21
|
module WebDriver
|
22
22
|
module Safari
|
23
23
|
module Features
|
24
|
-
|
25
24
|
# https://developer.apple.com/library/content/documentation/NetworkingInternetWeb/Conceptual/WebDriverEndpointDoc/Commands/Commands.html
|
26
25
|
SAFARI_COMMANDS = {
|
27
26
|
get_permissions: [:get, 'session/:session_id/apple/permissions'],
|
@@ -44,7 +43,6 @@ module Selenium
|
|
44
43
|
def attach_debugger
|
45
44
|
execute :attach_debugger, {}, {}
|
46
45
|
end
|
47
|
-
|
48
46
|
end # Bridge
|
49
47
|
end # Safari
|
50
48
|
end # WebDriver
|
@@ -26,7 +26,7 @@ module Selenium
|
|
26
26
|
# @see https://developer.apple.com/documentation/webkit/about_webdriver_for_safari
|
27
27
|
CAPABILITIES = {automatic_inspection: 'safari:automaticInspection',
|
28
28
|
automatic_profiling: 'safari:automaticProfiling'}.freeze
|
29
|
-
BROWSER = 'safari'
|
29
|
+
BROWSER = Selenium::WebDriver::Safari.technology_preview? ? 'Safari Technology Preview' : 'safari'
|
30
30
|
|
31
31
|
def add_option(name, value = nil)
|
32
32
|
key = name.is_a?(Hash) ? name.keys.first : name
|
@@ -35,6 +35,10 @@ module Selenium
|
|
35
35
|
super
|
36
36
|
end
|
37
37
|
|
38
|
+
def as_json(*)
|
39
|
+
@options[:browser_name] = Safari.technology_preview? ? 'Safari Technology Preview' : 'safari'
|
40
|
+
super
|
41
|
+
end
|
38
42
|
end # Options
|
39
43
|
end # Safari
|
40
44
|
end # WebDriver
|
@@ -23,10 +23,6 @@ module Selenium
|
|
23
23
|
class Service < WebDriver::Service
|
24
24
|
DEFAULT_PORT = 7050
|
25
25
|
EXECUTABLE = 'safaridriver'
|
26
|
-
MISSING_TEXT = <<~ERROR
|
27
|
-
Unable to find Apple's safaridriver which comes with Safari 10.
|
28
|
-
More info at https://webkit.org/blog/6900/webdriver-support-in-safari-10/
|
29
|
-
ERROR
|
30
26
|
SHUTDOWN_SUPPORTED = false
|
31
27
|
end # Service
|
32
28
|
end # Safari
|
@@ -29,7 +29,7 @@ module Selenium
|
|
29
29
|
attr_accessor :use_technology_preview
|
30
30
|
|
31
31
|
def technology_preview
|
32
|
-
|
32
|
+
'/Applications/Safari Technology Preview.app/Contents/MacOS/safaridriver'
|
33
33
|
end
|
34
34
|
|
35
35
|
def technology_preview!
|
@@ -21,29 +21,29 @@ module Selenium
|
|
21
21
|
module WebDriver
|
22
22
|
module Support
|
23
23
|
class Color
|
24
|
-
RGB_PATTERN =
|
24
|
+
RGB_PATTERN = /^\s*rgb\(\s*(\d{1,3})\s*,
|
25
25
|
\s*(\d{1,3})\s*,
|
26
|
-
\s*(\d{1,3})\s*\)\s
|
27
|
-
RGB_PCT_PATTERN =
|
26
|
+
\s*(\d{1,3})\s*\)\s*$/x.freeze
|
27
|
+
RGB_PCT_PATTERN = /^\s*rgb\(\s*(\d{1,3}|\d{1,2}\.\d+)%\s*,
|
28
28
|
\s*(\d{1,3}|\d{1,2}\.\d+)%\s*,
|
29
|
-
\s*(\d{1,3}|\d{1,2}\.\d+)%\s*\)\s
|
30
|
-
RGBA_PATTERN =
|
29
|
+
\s*(\d{1,3}|\d{1,2}\.\d+)%\s*\)\s*$/x.freeze
|
30
|
+
RGBA_PATTERN = /^\s*rgba\(\s*(\d{1,3})\s*,
|
31
31
|
\s*(\d{1,3})\s*,
|
32
32
|
\s*(\d{1,3})\s*,
|
33
|
-
\s*(0|1|0\.\d+)\s*\)\s
|
34
|
-
RGBA_PCT_PATTERN =
|
33
|
+
\s*(0|1|0\.\d+)\s*\)\s*$/x.freeze
|
34
|
+
RGBA_PCT_PATTERN = /^\s*rgba\(\s*(\d{1,3}|\d{1,2}\.\d+)
|
35
35
|
%\s*,\s*(\d{1,3}|\d{1,2}\.\d+)
|
36
36
|
%\s*,\s*(\d{1,3}|\d{1,2}\.\d+)
|
37
|
-
%\s*,\s*(0|1|0\.\d+)\s*\)\s
|
37
|
+
%\s*,\s*(0|1|0\.\d+)\s*\)\s*$/x.freeze
|
38
38
|
HEX_PATTERN = /#(\h{2})(\h{2})(\h{2})/.freeze
|
39
39
|
HEX3_PATTERN = /#(\h)(\h)(\h)/.freeze
|
40
|
-
HSL_PATTERN =
|
40
|
+
HSL_PATTERN = /^\s*hsl\(\s*(\d{1,3})\s*,
|
41
41
|
\s*(\d{1,3})%\s*,
|
42
|
-
\s*(\d{1,3})%\s*\)\s
|
43
|
-
HSLA_PATTERN =
|
42
|
+
\s*(\d{1,3})%\s*\)\s*$/x.freeze
|
43
|
+
HSLA_PATTERN = /^\s*hsla\(\s*(\d{1,3})\s*,
|
44
44
|
\s*(\d{1,3})%\s*,
|
45
45
|
\s*(\d{1,3})%\s*,
|
46
|
-
\s*(0|1|0\.\d+)\s*\)\s
|
46
|
+
\s*(0|1|0\.\d+)\s*\)\s*$/x.freeze
|
47
47
|
|
48
48
|
attr_reader :red, :green, :blue, :alpha
|
49
49
|
|
@@ -83,8 +83,8 @@ module Selenium
|
|
83
83
|
g = r
|
84
84
|
b = r
|
85
85
|
else
|
86
|
-
luminocity2 = l < 0.5 ? l * (
|
87
|
-
luminocity1 = (
|
86
|
+
luminocity2 = l < 0.5 ? l * (s + 1) : l + s - (l * s)
|
87
|
+
luminocity1 = (l * 2) - luminocity2
|
88
88
|
|
89
89
|
r = hue_to_rgb(luminocity1, luminocity2, h + (1.0 / 3.0))
|
90
90
|
g = hue_to_rgb(luminocity1, luminocity2, h)
|
@@ -122,7 +122,7 @@ module Selenium
|
|
122
122
|
|
123
123
|
[red, green, blue, alpha] == [other.red, other.green, other.blue, other.alpha]
|
124
124
|
end
|
125
|
-
|
125
|
+
alias eql? ==
|
126
126
|
|
127
127
|
def hash
|
128
128
|
[red, green, blue, alpha, self.class].hash
|
@@ -21,14 +21,12 @@ module Selenium
|
|
21
21
|
module WebDriver
|
22
22
|
module Support
|
23
23
|
class Guards
|
24
|
-
|
25
24
|
#
|
26
25
|
# Guard derived from RSpec example metadata.
|
27
26
|
# @api private
|
28
27
|
#
|
29
28
|
|
30
29
|
class Guard
|
31
|
-
|
32
30
|
attr_reader :guarded, :type, :messages, :reason
|
33
31
|
|
34
32
|
def initialize(guarded, type, guards = nil)
|
@@ -21,7 +21,6 @@ module Selenium
|
|
21
21
|
module WebDriver
|
22
22
|
module Support
|
23
23
|
class Guards
|
24
|
-
|
25
24
|
#
|
26
25
|
# Guard derived from RSpec example metadata.
|
27
26
|
# @api private
|
@@ -44,7 +43,6 @@ module Selenium
|
|
44
43
|
|
45
44
|
list.empty? || @execution.call(list)
|
46
45
|
end
|
47
|
-
|
48
46
|
end # GuardCondition
|
49
47
|
end # Guards
|
50
48
|
end # Support
|
@@ -26,11 +26,8 @@ module Selenium
|
|
26
26
|
#
|
27
27
|
|
28
28
|
def initialize(element)
|
29
|
-
unless element.enabled?
|
30
|
-
raise Error::UnsupportedOperationError, 'Select element is disabled and may not be used.'
|
31
|
-
end
|
32
|
-
|
33
29
|
tag_name = element.tag_name
|
30
|
+
|
34
31
|
raise ArgumentError, "unexpected tag name #{tag_name.inspect}" unless tag_name.casecmp('select').zero?
|
35
32
|
|
36
33
|
@element = element
|
@@ -89,7 +86,7 @@ module Selenium
|
|
89
86
|
#
|
90
87
|
# <option value="foo">Bar</option>
|
91
88
|
#
|
92
|
-
# When
|
89
|
+
# When selecting by :value, selects all options that have a value matching the argument. That is, when given "foo" this
|
93
90
|
# would select an option like:
|
94
91
|
#
|
95
92
|
# <option value="foo">Bar</option>
|
data/lib/selenium/webdriver.rb
CHANGED
@@ -17,7 +17,6 @@
|
|
17
17
|
# specific language governing permissions and limitations
|
18
18
|
# under the License.
|
19
19
|
|
20
|
-
require 'childprocess'
|
21
20
|
require 'tmpdir'
|
22
21
|
require 'fileutils'
|
23
22
|
require 'date'
|
@@ -34,9 +33,9 @@ module Selenium
|
|
34
33
|
Point = Struct.new(:x, :y)
|
35
34
|
Dimension = Struct.new(:width, :height)
|
36
35
|
Rectangle = Struct.new(:x, :y, :width, :height)
|
37
|
-
Location = Struct.new(:latitude, :longitude, :altitude)
|
38
36
|
|
39
37
|
autoload :BiDi, 'selenium/webdriver/bidi'
|
38
|
+
autoload :Chromium, 'selenium/webdriver/chromium'
|
40
39
|
autoload :Chrome, 'selenium/webdriver/chrome'
|
41
40
|
autoload :DevTools, 'selenium/webdriver/devtools'
|
42
41
|
autoload :Edge, 'selenium/webdriver/edge'
|
@@ -95,8 +94,8 @@ module Selenium
|
|
95
94
|
# @return [Logger]
|
96
95
|
#
|
97
96
|
|
98
|
-
def self.logger
|
99
|
-
@logger ||= WebDriver::Logger.new
|
97
|
+
def self.logger(**opts)
|
98
|
+
@logger ||= WebDriver::Logger.new('Selenium', **opts)
|
100
99
|
end
|
101
100
|
end # WebDriver
|
102
101
|
end # Selenium
|
data/selenium-webdriver.gemspec
CHANGED
@@ -24,6 +24,7 @@ Gem::Specification.new do |s|
|
|
24
24
|
s.homepage = 'https://selenium.dev'
|
25
25
|
s.metadata = {
|
26
26
|
'changelog_uri' => 'https://github.com/SeleniumHQ/selenium/blob/trunk/rb/CHANGES',
|
27
|
+
'github_repo' => 'ssh://github.com/SeleniumHQ/selenium',
|
27
28
|
'source_code_uri' => 'https://github.com/SeleniumHQ/selenium/tree/trunk/rb',
|
28
29
|
'rubygems_mfa_required' => 'true'
|
29
30
|
}
|
@@ -41,25 +42,23 @@ Gem::Specification.new do |s|
|
|
41
42
|
'lib/selenium-webdriver.rb',
|
42
43
|
'lib/selenium/server.rb',
|
43
44
|
'lib/selenium/webdriver.rb'
|
44
|
-
]
|
45
|
+
]
|
46
|
+
s.files += Dir['bin/**/*']
|
47
|
+
s.files += Dir['lib/selenium/webdriver/**/*']
|
45
48
|
|
49
|
+
s.bindir = 'bin'
|
46
50
|
s.require_paths = ['lib']
|
47
51
|
|
48
|
-
s.add_runtime_dependency 'childprocess', ['>= 0.5', '< 5.0']
|
49
52
|
s.add_runtime_dependency 'rexml', ['~> 3.2', '>= 3.2.5']
|
50
53
|
s.add_runtime_dependency 'rubyzip', ['>= 1.2.2', '< 3.0']
|
51
54
|
s.add_runtime_dependency 'websocket', ['~> 1.0']
|
52
55
|
|
53
|
-
# childprocess requires ffi on windows but doesn't declare it in its dependencies
|
54
|
-
s.add_development_dependency 'ffi'
|
55
56
|
s.add_development_dependency 'pry', ['~> 0.14']
|
56
57
|
s.add_development_dependency 'rack', ['~> 2.0']
|
57
|
-
s.add_development_dependency 'rake'
|
58
58
|
s.add_development_dependency 'rspec', ['~> 3.0']
|
59
|
-
s.add_development_dependency 'rubocop', ['~> 1.
|
60
|
-
s.add_development_dependency 'rubocop-performance', ['~> 1.
|
61
|
-
s.add_development_dependency 'rubocop-
|
62
|
-
s.add_development_dependency 'rubocop-rspec', ['~> 2.12']
|
59
|
+
s.add_development_dependency 'rubocop', ['~> 1.42']
|
60
|
+
s.add_development_dependency 'rubocop-performance', ['~> 1.15']
|
61
|
+
s.add_development_dependency 'rubocop-rspec', ['~> 2.16']
|
63
62
|
s.add_development_dependency 'webmock', ['~> 3.5']
|
64
63
|
s.add_development_dependency 'webrick', ['~> 1.7']
|
65
64
|
s.add_development_dependency 'yard', ['~> 0.9.11']
|