selenium-webdriver 4.1.0 → 4.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES +141 -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 +34 -26
- 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/bidi/session.rb +38 -0
- data/lib/selenium/webdriver/bidi.rb +55 -0
- data/lib/selenium/webdriver/chrome/driver.rb +1 -0
- data/lib/selenium/webdriver/chrome/features.rb +5 -0
- data/lib/selenium/webdriver/chrome/options.rb +33 -19
- data/lib/selenium/webdriver/chrome/service.rb +1 -1
- data/lib/selenium/webdriver/chrome.rb +0 -14
- data/lib/selenium/webdriver/common/action_builder.rb +108 -21
- data/lib/selenium/webdriver/common/child_process.rb +126 -0
- data/lib/selenium/webdriver/common/driver.rb +22 -55
- data/lib/selenium/webdriver/common/driver_extensions/{has_remote_status.rb → has_bidi.rb} +12 -5
- data/lib/selenium/webdriver/common/driver_extensions/has_casting.rb +10 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_context.rb +1 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_log_events.rb +1 -1
- data/lib/selenium/webdriver/common/driver_extensions/has_network_interception.rb +2 -67
- data/lib/selenium/webdriver/common/driver_extensions/has_pinned_scripts.rb +1 -1
- data/lib/selenium/webdriver/common/element.rb +2 -2
- data/lib/selenium/webdriver/common/error.rb +1 -1
- data/lib/selenium/webdriver/common/interactions/input_device.rb +10 -4
- data/lib/selenium/webdriver/common/interactions/interaction.rb +12 -25
- data/lib/selenium/webdriver/common/interactions/interactions.rb +24 -4
- data/lib/selenium/webdriver/common/interactions/key_actions.rb +5 -1
- data/lib/selenium/webdriver/common/interactions/key_input.rb +11 -27
- data/lib/selenium/webdriver/common/interactions/none_input.rb +10 -8
- data/lib/selenium/webdriver/common/interactions/pause.rb +49 -0
- data/lib/selenium/webdriver/common/interactions/pointer_actions.rb +59 -70
- data/lib/selenium/webdriver/common/interactions/pointer_cancel.rb +45 -0
- data/lib/selenium/webdriver/common/interactions/pointer_event_properties.rb +63 -0
- data/lib/selenium/webdriver/common/interactions/pointer_input.rb +15 -84
- data/lib/selenium/webdriver/common/interactions/pointer_move.rb +60 -0
- data/lib/selenium/webdriver/common/interactions/pointer_press.rb +85 -0
- data/lib/selenium/webdriver/common/interactions/scroll.rb +57 -0
- data/lib/selenium/webdriver/common/interactions/scroll_origin.rb +48 -0
- data/lib/selenium/webdriver/common/interactions/typing_interaction.rb +54 -0
- data/lib/selenium/webdriver/common/interactions/wheel_actions.rb +113 -0
- data/lib/selenium/webdriver/common/interactions/wheel_input.rb +42 -0
- data/lib/selenium/webdriver/common/keys.rb +1 -0
- data/lib/selenium/webdriver/common/manager.rb +0 -27
- data/lib/selenium/webdriver/common/options.rb +2 -9
- data/lib/selenium/webdriver/common/platform.rb +8 -5
- data/lib/selenium/webdriver/common/search_context.rb +0 -6
- data/lib/selenium/webdriver/common/selenium_manager.rb +91 -0
- data/lib/selenium/webdriver/common/service.rb +7 -3
- data/lib/selenium/webdriver/common/service_manager.rb +3 -12
- data/lib/selenium/webdriver/common/shadow_root.rb +1 -1
- data/lib/selenium/webdriver/common/socket_lock.rb +1 -2
- data/lib/selenium/webdriver/common/socket_poller.rb +1 -1
- data/lib/selenium/webdriver/common/takes_screenshot.rb +1 -1
- data/lib/selenium/webdriver/common/virtual_authenticator/credential.rb +83 -0
- data/lib/selenium/webdriver/common/virtual_authenticator/virtual_authenticator.rb +73 -0
- data/lib/selenium/webdriver/common/virtual_authenticator/virtual_authenticator_options.rb +62 -0
- data/lib/selenium/webdriver/common/websocket_connection.rb +165 -0
- data/lib/selenium/webdriver/common/window.rb +6 -6
- data/lib/selenium/webdriver/common/zipper.rb +1 -1
- data/lib/selenium/webdriver/common.rb +19 -3
- data/lib/selenium/webdriver/devtools/network_interceptor.rb +176 -0
- data/lib/selenium/webdriver/devtools/request.rb +1 -1
- data/lib/selenium/webdriver/devtools/response.rb +1 -1
- data/lib/selenium/webdriver/devtools.rb +6 -112
- data/lib/selenium/webdriver/edge/features.rb +1 -0
- data/lib/selenium/webdriver/firefox/driver.rb +1 -0
- data/lib/selenium/webdriver/firefox/features.rb +6 -5
- data/lib/selenium/webdriver/firefox/options.rb +5 -2
- data/lib/selenium/webdriver/firefox/profile.rb +1 -5
- data/lib/selenium/webdriver/firefox/util.rb +46 -0
- data/lib/selenium/webdriver/firefox.rb +1 -14
- data/lib/selenium/webdriver/ie.rb +0 -14
- data/lib/selenium/webdriver/remote/bridge.rb +54 -19
- data/lib/selenium/webdriver/remote/commands.rb +15 -6
- data/lib/selenium/webdriver/remote/driver.rb +0 -1
- data/lib/selenium/webdriver/remote/http/default.rb +6 -12
- data/lib/selenium/webdriver/remote/response.rb +2 -2
- data/lib/selenium/webdriver/safari/options.rb +1 -1
- data/lib/selenium/webdriver/safari.rb +0 -14
- data/lib/selenium/webdriver/support/cdp_client_generator.rb +4 -4
- data/lib/selenium/webdriver/support/color.rb +7 -7
- data/lib/selenium/webdriver/support/guards/guard_condition.rb +1 -1
- data/lib/selenium/webdriver/support/guards.rb +1 -1
- data/lib/selenium/webdriver/support/nightly_version_generator.rb +60 -0
- data/lib/selenium/webdriver/support/select.rb +3 -1
- data/lib/selenium/webdriver/version.rb +1 -1
- data/lib/selenium/webdriver.rb +1 -1
- data/selenium-webdriver.gemspec +14 -10
- metadata +66 -42
- data/lib/selenium/webdriver/remote/http/persistent.rb +0 -65
- data/lib/selenium/webdriver/support/cdp/domain.rb.erb +0 -63
@@ -30,8 +30,8 @@ module Selenium
|
|
30
30
|
|
31
31
|
#
|
32
32
|
# Initializes the bridge with the given server URL
|
33
|
-
# @param [String, URI]
|
34
|
-
# @param [Object]
|
33
|
+
# @param [String, URI] url url for the remote server
|
34
|
+
# @param [Object] http_client an HTTP client instance that implements the same protocol as Http::Default
|
35
35
|
# @api private
|
36
36
|
#
|
37
37
|
|
@@ -118,7 +118,7 @@ module Selenium
|
|
118
118
|
end
|
119
119
|
|
120
120
|
def alert=(keys)
|
121
|
-
execute :send_alert_text, {}, {value: keys.
|
121
|
+
execute :send_alert_text, {}, {value: keys.chars, text: keys}
|
122
122
|
end
|
123
123
|
|
124
124
|
def alert_text
|
@@ -146,9 +146,7 @@ module Selenium
|
|
146
146
|
end
|
147
147
|
|
148
148
|
def page_source
|
149
|
-
|
150
|
-
'if (!source) { source = new XMLSerializer().serializeToString(document); }' \
|
151
|
-
'return source;')
|
149
|
+
execute :get_page_source
|
152
150
|
end
|
153
151
|
|
154
152
|
#
|
@@ -369,11 +367,8 @@ module Selenium
|
|
369
367
|
# actions
|
370
368
|
#
|
371
369
|
|
372
|
-
def action(
|
373
|
-
ActionBuilder.new self,
|
374
|
-
Interactions.pointer(:mouse, name: 'mouse'),
|
375
|
-
Interactions.key('keyboard'),
|
376
|
-
async
|
370
|
+
def action(deprecated_async = nil, async: false, devices: [], duration: 250)
|
371
|
+
ActionBuilder.new self, nil, nil, deprecated_async, async: async, devices: devices, duration: duration
|
377
372
|
end
|
378
373
|
alias_method :actions, :action
|
379
374
|
|
@@ -412,8 +407,8 @@ module Selenium
|
|
412
407
|
end
|
413
408
|
|
414
409
|
# Keep .split(//) for backward compatibility for now
|
415
|
-
text = keys.join
|
416
|
-
execute :element_send_keys, {id: element}, {value: text.
|
410
|
+
text = keys.join
|
411
|
+
execute :element_send_keys, {id: element}, {value: text.chars, text: text}
|
417
412
|
end
|
418
413
|
|
419
414
|
def upload(local_file)
|
@@ -430,10 +425,19 @@ module Selenium
|
|
430
425
|
end
|
431
426
|
|
432
427
|
def submit_element(element)
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
428
|
+
script = "var form = arguments[0];\n" \
|
429
|
+
"while (form.nodeName != \"FORM\" && form.parentNode) {\n " \
|
430
|
+
"form = form.parentNode;\n" \
|
431
|
+
"}\n" \
|
432
|
+
"if (!form) { throw Error('Unable to find containing form element'); }\n" \
|
433
|
+
"if (!form.ownerDocument) { throw Error('Unable to find owning document'); }\n" \
|
434
|
+
"var e = form.ownerDocument.createEvent('Event');\n" \
|
435
|
+
"e.initEvent('submit', true, true);\n" \
|
436
|
+
"if (form.dispatchEvent(e)) { HTMLFormElement.prototype.submit.call(form) }\n"
|
437
|
+
|
438
|
+
execute_script(script, Element::ELEMENT_KEY => element)
|
439
|
+
rescue Error::JavascriptError
|
440
|
+
raise Error::UnsupportedOperationError, "To submit an element, it must be nested inside a form element"
|
437
441
|
end
|
438
442
|
|
439
443
|
#
|
@@ -564,6 +568,39 @@ module Selenium
|
|
564
568
|
ShadowRoot.new self, shadow_root_id_from(id)
|
565
569
|
end
|
566
570
|
|
571
|
+
#
|
572
|
+
# virtual-authenticator
|
573
|
+
#
|
574
|
+
|
575
|
+
def add_virtual_authenticator(options)
|
576
|
+
authenticator_id = execute :add_virtual_authenticator, {}, options.as_json
|
577
|
+
VirtualAuthenticator.new(self, authenticator_id, options)
|
578
|
+
end
|
579
|
+
|
580
|
+
def remove_virtual_authenticator(id)
|
581
|
+
execute :remove_virtual_authenticator, {authenticatorId: id}
|
582
|
+
end
|
583
|
+
|
584
|
+
def add_credential(credential, id)
|
585
|
+
execute :add_credential, {authenticatorId: id}, credential
|
586
|
+
end
|
587
|
+
|
588
|
+
def credentials(authenticator_id)
|
589
|
+
execute :get_credentials, {authenticatorId: authenticator_id}
|
590
|
+
end
|
591
|
+
|
592
|
+
def remove_credential(credential_id, authenticator_id)
|
593
|
+
execute :remove_credential, {credentialId: credential_id, authenticatorId: authenticator_id}
|
594
|
+
end
|
595
|
+
|
596
|
+
def remove_all_credentials(authenticator_id)
|
597
|
+
execute :remove_all_credentials, {authenticatorId: authenticator_id}
|
598
|
+
end
|
599
|
+
|
600
|
+
def user_verified(verified, authenticator_id)
|
601
|
+
execute :set_user_verified, {authenticatorId: authenticator_id}, {isUserVerified: verified}
|
602
|
+
end
|
603
|
+
|
567
604
|
private
|
568
605
|
|
569
606
|
#
|
@@ -639,8 +676,6 @@ module Selenium
|
|
639
676
|
when 'name'
|
640
677
|
how = 'css selector'
|
641
678
|
what = "*[name='#{escape_css(what.to_s)}']"
|
642
|
-
when 'tag name'
|
643
|
-
how = 'css selector'
|
644
679
|
end
|
645
680
|
|
646
681
|
if what.is_a?(Hash)
|
@@ -60,10 +60,6 @@ module Selenium
|
|
60
60
|
fullscreen_window: [:post, 'session/:session_id/window/fullscreen'],
|
61
61
|
minimize_window: [:post, 'session/:session_id/window/minimize'],
|
62
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
63
|
set_window_rect: [:post, 'session/:session_id/window/rect'],
|
68
64
|
get_window_rect: [:get, 'session/:session_id/window/rect'],
|
69
65
|
switch_to_frame: [:post, 'session/:session_id/frame'],
|
@@ -130,7 +126,6 @@ module Selenium
|
|
130
126
|
#
|
131
127
|
|
132
128
|
element_click: [:post, 'session/:session_id/element/:id/click'],
|
133
|
-
element_tap: [:post, 'session/:session_id/element/:id/tap'],
|
134
129
|
element_clear: [:post, 'session/:session_id/element/:id/clear'],
|
135
130
|
element_send_keys: [:post, 'session/:session_id/element/:id/value'],
|
136
131
|
|
@@ -154,7 +149,21 @@ module Selenium
|
|
154
149
|
# server extensions
|
155
150
|
#
|
156
151
|
|
157
|
-
upload_file: [:post, 'session/:session_id/se/file']
|
152
|
+
upload_file: [:post, 'session/:session_id/se/file'],
|
153
|
+
|
154
|
+
#
|
155
|
+
# virtual-authenticator
|
156
|
+
#
|
157
|
+
|
158
|
+
add_virtual_authenticator: [:post, 'session/:session_id/webauthn/authenticator'],
|
159
|
+
remove_virtual_authenticator: [:delete, 'session/:session_id/webauthn/authenticator/:authenticatorId'],
|
160
|
+
add_credential: [:post, 'session/:session_id/webauthn/authenticator/:authenticatorId/credential'],
|
161
|
+
get_credentials: [:get, 'session/:session_id/webauthn/authenticator/:authenticatorId/credentials'],
|
162
|
+
remove_credential: [:delete,
|
163
|
+
'session/:session_id/webauthn/authenticator/:authenticatorId/credentials/:credentialId'],
|
164
|
+
remove_all_credentials: [:delete, 'session/:session_id/webauthn/authenticator/:authenticatorId/credentials'],
|
165
|
+
set_user_verified: [:post, 'session/:session_id/webauthn/authenticator/:authenticatorId/uv']
|
166
|
+
|
158
167
|
}.freeze
|
159
168
|
|
160
169
|
end # Bridge
|
@@ -29,7 +29,6 @@ module Selenium
|
|
29
29
|
class Driver < WebDriver::Driver
|
30
30
|
include DriverExtensions::UploadsFiles
|
31
31
|
include DriverExtensions::HasSessionId
|
32
|
-
include DriverExtensions::HasRemoteStatus
|
33
32
|
|
34
33
|
def initialize(bridge: nil, listener: nil, **opts)
|
35
34
|
desired_capabilities = opts[:desired_capabilities]
|
@@ -75,9 +75,10 @@ module Selenium
|
|
75
75
|
begin
|
76
76
|
request = new_request_for(verb, url, headers, payload)
|
77
77
|
response = response_for(request)
|
78
|
-
rescue Errno::ECONNABORTED, Errno::ECONNRESET, Errno::EADDRINUSE
|
79
|
-
# a retry is sometimes needed
|
80
|
-
# run out of ephemeral ports
|
78
|
+
rescue Errno::ECONNABORTED, Errno::ECONNRESET, Errno::EADDRINUSE, Errno::EADDRNOTAVAIL
|
79
|
+
# a retry is sometimes needed:
|
80
|
+
# on Windows XP where we may quickly run out of ephemeral ports
|
81
|
+
# when the port becomes temporarily unavailable
|
81
82
|
#
|
82
83
|
# A more robust solution is bumping the MaxUserPort setting
|
83
84
|
# as described here:
|
@@ -85,13 +86,6 @@ module Selenium
|
|
85
86
|
# http://msdn.microsoft.com/en-us/library/aa560610%28v=bts.20%29.aspx
|
86
87
|
raise if retries >= MAX_RETRIES
|
87
88
|
|
88
|
-
retries += 1
|
89
|
-
sleep 2
|
90
|
-
retry
|
91
|
-
rescue Errno::EADDRNOTAVAIL => e
|
92
|
-
# a retry is sometimes needed when the port becomes temporarily unavailable
|
93
|
-
raise if retries >= MAX_RETRIES
|
94
|
-
|
95
89
|
retries += 1
|
96
90
|
sleep 2
|
97
91
|
retry
|
@@ -142,8 +136,8 @@ module Selenium
|
|
142
136
|
|
143
137
|
def proxy
|
144
138
|
@proxy ||= begin
|
145
|
-
proxy = ENV
|
146
|
-
no_proxy = ENV
|
139
|
+
proxy = ENV.fetch('http_proxy', nil) || ENV.fetch('HTTP_PROXY', nil)
|
140
|
+
no_proxy = ENV.fetch('no_proxy', nil) || ENV.fetch('NO_PROXY', nil)
|
147
141
|
|
148
142
|
if proxy
|
149
143
|
proxy = "http://#{proxy}" unless proxy.start_with?('http://')
|
@@ -74,7 +74,7 @@ module Selenium
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def backtrace_from_remote(server_trace)
|
77
|
-
server_trace.
|
77
|
+
server_trace.filter_map do |frame|
|
78
78
|
next unless frame.is_a?(Hash)
|
79
79
|
|
80
80
|
file = frame['fileName']
|
@@ -87,7 +87,7 @@ module Selenium
|
|
87
87
|
meth = 'unknown' if meth.nil? || meth.empty?
|
88
88
|
|
89
89
|
"[remote server] #{file}:#{line}:in `#{meth}'"
|
90
|
-
|
90
|
+
end
|
91
91
|
end
|
92
92
|
|
93
93
|
def process_error
|
@@ -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
|
@@ -53,20 +53,6 @@ module Selenium
|
|
53
53
|
|
54
54
|
raise Error::WebDriverError, 'Unable to find Safari'
|
55
55
|
end
|
56
|
-
|
57
|
-
def driver_path=(path)
|
58
|
-
WebDriver.logger.deprecate 'Selenium::WebDriver::Safari#driver_path=',
|
59
|
-
'Selenium::WebDriver::Safari::Service#driver_path=',
|
60
|
-
id: :driver_path
|
61
|
-
Selenium::WebDriver::Safari::Service.driver_path = path
|
62
|
-
end
|
63
|
-
|
64
|
-
def driver_path
|
65
|
-
WebDriver.logger.deprecate 'Selenium::WebDriver::Safari#driver_path',
|
66
|
-
'Selenium::WebDriver::Safari::Service#driver_path',
|
67
|
-
id: :driver_path
|
68
|
-
Selenium::WebDriver::Safari::Service.driver_path
|
69
|
-
end
|
70
56
|
end
|
71
57
|
end # Safari
|
72
58
|
end # WebDriver
|
@@ -44,8 +44,8 @@ module Selenium
|
|
44
44
|
|
45
45
|
FileUtils.mkdir_p(@output_dir)
|
46
46
|
|
47
|
-
browser_protocol[:domains].each(
|
48
|
-
js_protocol[:domains].each(
|
47
|
+
browser_protocol[:domains].each { |domain| process_domain(domain) }
|
48
|
+
js_protocol[:domains].each { |domain| process_domain(domain) }
|
49
49
|
require_file
|
50
50
|
end
|
51
51
|
|
@@ -79,7 +79,7 @@ module Selenium
|
|
79
79
|
end
|
80
80
|
|
81
81
|
def remove_empty_lines(string)
|
82
|
-
string.split("\n").
|
82
|
+
string.split("\n").grep_v(/^\s+$/).join("\n")
|
83
83
|
end
|
84
84
|
|
85
85
|
def require_file
|
@@ -88,7 +88,7 @@ module Selenium
|
|
88
88
|
# rubocop:enable Lint/InterpolationCheck
|
89
89
|
|
90
90
|
require_all = "Dir.glob(\"#{dynamic_location}/#{@version}/*\", &method(:require))"
|
91
|
-
File.
|
91
|
+
File.write(@loader_path, require_all)
|
92
92
|
end
|
93
93
|
end
|
94
94
|
end
|
@@ -83,12 +83,12 @@ module Selenium
|
|
83
83
|
g = r
|
84
84
|
b = r
|
85
85
|
else
|
86
|
-
luminocity2 = l < 0.5 ? l * (1 + s) : l + s - l * s
|
87
|
-
luminocity1 = 2 * l - luminocity2
|
86
|
+
luminocity2 = l < 0.5 ? l * (1 + s) : l + s - (l * s)
|
87
|
+
luminocity1 = (2 * l) - luminocity2
|
88
88
|
|
89
|
-
r = hue_to_rgb(luminocity1, luminocity2, h + 1.0 / 3.0)
|
89
|
+
r = hue_to_rgb(luminocity1, luminocity2, h + (1.0 / 3.0))
|
90
90
|
g = hue_to_rgb(luminocity1, luminocity2, h)
|
91
|
-
b = hue_to_rgb(luminocity1, luminocity2, h - 1.0 / 3.0)
|
91
|
+
b = hue_to_rgb(luminocity1, luminocity2, h - (1.0 / 3.0))
|
92
92
|
end
|
93
93
|
|
94
94
|
new (r * 255).round, (g * 255).round, (b * 255).round, a
|
@@ -99,11 +99,11 @@ module Selenium
|
|
99
99
|
hue -= 1 if hue > 1.0
|
100
100
|
|
101
101
|
if hue < 1.0 / 6.0
|
102
|
-
(lum1 + (lum2 - lum1) * 6.0 * hue)
|
102
|
+
(lum1 + ((lum2 - lum1) * 6.0 * hue))
|
103
103
|
elsif hue < 1.0 / 2.0
|
104
104
|
lum2
|
105
105
|
elsif hue < 2.0 / 3.0
|
106
|
-
lum1 + (lum2 - lum1) * ((2.0 / 3.0) - hue) * 6.0
|
106
|
+
lum1 + ((lum2 - lum1) * ((2.0 / 3.0) - hue) * 6.0)
|
107
107
|
else
|
108
108
|
lum1
|
109
109
|
end
|
@@ -125,7 +125,7 @@ module Selenium
|
|
125
125
|
alias_method :eql?, :==
|
126
126
|
|
127
127
|
def hash
|
128
|
-
[red, green, blue, alpha
|
128
|
+
[red, green, blue, alpha, self.class].hash
|
129
129
|
end
|
130
130
|
|
131
131
|
def rgb
|
@@ -48,7 +48,7 @@ module Selenium
|
|
48
48
|
def disposition
|
49
49
|
if !skipping_guard.nil?
|
50
50
|
[:skip, skipping_guard.message]
|
51
|
-
elsif !pending_guard.nil? && ENV
|
51
|
+
elsif !pending_guard.nil? && ENV.fetch('SKIP_PENDING', nil)
|
52
52
|
[:skip, pending_guard.message]
|
53
53
|
elsif !pending_guard.nil?
|
54
54
|
[:pending, pending_guard.message]
|
@@ -0,0 +1,60 @@
|
|
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
|
+
require 'date'
|
21
|
+
|
22
|
+
module Selenium
|
23
|
+
module WebDriver
|
24
|
+
module Support
|
25
|
+
|
26
|
+
#
|
27
|
+
# Updates version in `version.rb` file with nightly suffix:
|
28
|
+
# - VERSION = '4.6.1'
|
29
|
+
# + VERSION = '4.6.1.nightly.20221126'
|
30
|
+
#
|
31
|
+
# @api private
|
32
|
+
#
|
33
|
+
|
34
|
+
class NightlyVersionGenerator
|
35
|
+
|
36
|
+
REGEXP = /VERSION = ['"]([\d.]+)['"]/.freeze
|
37
|
+
|
38
|
+
def self.call(version_file, version_suffix)
|
39
|
+
version_suffix ||= Date.today.strftime('%Y%m%d')
|
40
|
+
version_file_contents = File.read(version_file)
|
41
|
+
version_file_contents.gsub!(REGEXP) do
|
42
|
+
old_version = Regexp.last_match(1)
|
43
|
+
new_version = [old_version, 'nightly', version_suffix].join('.')
|
44
|
+
puts("#{old_version} -> #{new_version}")
|
45
|
+
|
46
|
+
"VERSION = '#{new_version}'"
|
47
|
+
end
|
48
|
+
|
49
|
+
File.write(version_file, version_file_contents)
|
50
|
+
end
|
51
|
+
|
52
|
+
end # NightlyVersionGenerator
|
53
|
+
end # Support
|
54
|
+
end # WebDriver
|
55
|
+
end # Selenium
|
56
|
+
|
57
|
+
if __FILE__ == $PROGRAM_NAME
|
58
|
+
version_file, version_suffix = *ARGV
|
59
|
+
Selenium::WebDriver::Support::NightlyVersionGenerator.call(version_file, version_suffix)
|
60
|
+
end
|
@@ -86,7 +86,7 @@ module Selenium
|
|
86
86
|
#
|
87
87
|
# <option value="foo">Bar</option>
|
88
88
|
#
|
89
|
-
# When
|
89
|
+
# When selecting by :value, selects all options that have a value matching the argument. That is, when given "foo" this
|
90
90
|
# would select an option like:
|
91
91
|
#
|
92
92
|
# <option value="foo">Bar</option>
|
@@ -215,6 +215,8 @@ module Selenium
|
|
215
215
|
end
|
216
216
|
|
217
217
|
def select_option(option)
|
218
|
+
raise Error::UnsupportedOperationError, 'You may not select a disabled option' unless option.enabled?
|
219
|
+
|
218
220
|
option.click unless option.selected?
|
219
221
|
end
|
220
222
|
|
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'
|
@@ -36,6 +35,7 @@ module Selenium
|
|
36
35
|
Rectangle = Struct.new(:x, :y, :width, :height)
|
37
36
|
Location = Struct.new(:latitude, :longitude, :altitude)
|
38
37
|
|
38
|
+
autoload :BiDi, 'selenium/webdriver/bidi'
|
39
39
|
autoload :Chrome, 'selenium/webdriver/chrome'
|
40
40
|
autoload :DevTools, 'selenium/webdriver/devtools'
|
41
41
|
autoload :Edge, 'selenium/webdriver/edge'
|
data/selenium-webdriver.gemspec
CHANGED
@@ -24,11 +24,13 @@ 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
|
-
'
|
27
|
+
'github_repo' => 'ssh://github.com/SeleniumHQ/selenium',
|
28
|
+
'source_code_uri' => 'https://github.com/SeleniumHQ/selenium/tree/trunk/rb',
|
29
|
+
'rubygems_mfa_required' => 'true'
|
28
30
|
}
|
29
31
|
|
30
32
|
s.required_rubygems_version = Gem::Requirement.new('> 1.3.1') if s.respond_to? :required_rubygems_version=
|
31
|
-
s.required_ruby_version = Gem::Requirement.new('>= 2.
|
33
|
+
s.required_ruby_version = Gem::Requirement.new('>= 2.7')
|
32
34
|
|
33
35
|
s.files = [
|
34
36
|
'CHANGES',
|
@@ -40,23 +42,25 @@ Gem::Specification.new do |s|
|
|
40
42
|
'lib/selenium-webdriver.rb',
|
41
43
|
'lib/selenium/server.rb',
|
42
44
|
'lib/selenium/webdriver.rb'
|
43
|
-
]
|
45
|
+
]
|
46
|
+
s.files += Dir['bin/**/*']
|
47
|
+
s.files += Dir['lib/selenium/webdriver/**/*']
|
44
48
|
|
49
|
+
s.bindir = 'bin'
|
45
50
|
s.require_paths = ['lib']
|
46
51
|
|
47
|
-
s.add_runtime_dependency 'childprocess', ['>= 0.5', '< 5.0']
|
48
52
|
s.add_runtime_dependency 'rexml', ['~> 3.2', '>= 3.2.5']
|
49
|
-
s.add_runtime_dependency 'rubyzip', ['>= 1.2.2']
|
53
|
+
s.add_runtime_dependency 'rubyzip', ['>= 1.2.2', '< 3.0']
|
54
|
+
s.add_runtime_dependency 'websocket', ['~> 1.0']
|
50
55
|
|
51
|
-
# childprocess requires ffi on windows but doesn't declare it in its dependencies
|
52
|
-
s.add_development_dependency 'ffi'
|
53
56
|
s.add_development_dependency 'pry', ['~> 0.14']
|
54
57
|
s.add_development_dependency 'rack', ['~> 2.0']
|
55
58
|
s.add_development_dependency 'rake'
|
56
59
|
s.add_development_dependency 'rspec', ['~> 3.0']
|
57
|
-
s.add_development_dependency 'rubocop', ['~> 1.
|
58
|
-
s.add_development_dependency 'rubocop-performance'
|
59
|
-
s.add_development_dependency 'rubocop-
|
60
|
+
s.add_development_dependency 'rubocop', ['~> 1.31']
|
61
|
+
s.add_development_dependency 'rubocop-performance', ['~> 1.13']
|
62
|
+
s.add_development_dependency 'rubocop-rake'
|
63
|
+
s.add_development_dependency 'rubocop-rspec', ['~> 2.12']
|
60
64
|
s.add_development_dependency 'webmock', ['~> 3.5']
|
61
65
|
s.add_development_dependency 'webrick', ['~> 1.7']
|
62
66
|
s.add_development_dependency 'yard', ['~> 0.9.11']
|