selenium-webdriver 4.7.0 → 4.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGES +34 -0
- data/LICENSE +1 -1
- data/NOTICE +1 -1
- data/lib/selenium/server.rb +1 -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/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 +140 -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 +2 -1
- data/lib/selenium/webdriver/chrome/driver.rb +19 -29
- 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 -18
- 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 +0 -2
- data/lib/selenium/webdriver/common/driver.rb +34 -25
- 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/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/logger.rb +10 -2
- data/lib/selenium/webdriver/common/options.rb +30 -8
- 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 +10 -12
- data/lib/selenium/webdriver/common/service.rb +9 -5
- data/lib/selenium/webdriver/common/service_manager.rb +1 -1
- data/lib/selenium/webdriver/common/shadow_root.rb +1 -2
- data/lib/selenium/webdriver/common/socket_lock.rb +1 -0
- 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 +1 -2
- 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 +3 -6
- 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 +0 -1
- data/lib/selenium/webdriver/edge/driver.rb +20 -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 -2
- data/lib/selenium/webdriver/firefox/driver.rb +19 -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 -1
- data/lib/selenium/webdriver/ie/driver.rb +20 -1
- data/lib/selenium/webdriver/ie/service.rb +1 -2
- data/lib/selenium/webdriver/remote/bridge.rb +8 -15
- data/lib/selenium/webdriver/remote/capabilities.rb +34 -12
- data/lib/selenium/webdriver/remote/commands.rb +0 -2
- data/lib/selenium/webdriver/remote/driver.rb +13 -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/safari/driver.rb +20 -1
- data/lib/selenium/webdriver/safari/features.rb +0 -2
- data/lib/selenium/webdriver/safari/options.rb +5 -1
- 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/version.rb +1 -1
- data/lib/selenium/webdriver.rb +3 -3
- data/selenium-webdriver.gemspec +3 -5
- metadata +25 -41
- data/lib/selenium/webdriver/support/cdp_client_generator.rb +0 -108
- data/lib/selenium/webdriver/support/nightly_version_generator.rb +0 -60
|
@@ -51,7 +51,7 @@ module Selenium
|
|
|
51
51
|
Safari::Driver.new(**opts)
|
|
52
52
|
when :firefox, :ff
|
|
53
53
|
Firefox::Driver.new(**opts)
|
|
54
|
-
when :edge
|
|
54
|
+
when :edge, :microsoftedge, :msedge
|
|
55
55
|
Edge::Driver.new(**opts)
|
|
56
56
|
when :remote
|
|
57
57
|
Remote::Driver.new(**opts)
|
|
@@ -69,7 +69,7 @@ module Selenium
|
|
|
69
69
|
#
|
|
70
70
|
|
|
71
71
|
def initialize(bridge: nil, listener: nil, **opts)
|
|
72
|
-
@
|
|
72
|
+
@service_manager = nil
|
|
73
73
|
@devtools = nil
|
|
74
74
|
bridge ||= create_bridge(**opts)
|
|
75
75
|
add_extensions(bridge.browser)
|
|
@@ -127,14 +127,6 @@ module Selenium
|
|
|
127
127
|
bridge.action(**opts)
|
|
128
128
|
end
|
|
129
129
|
|
|
130
|
-
def mouse
|
|
131
|
-
bridge.mouse
|
|
132
|
-
end
|
|
133
|
-
|
|
134
|
-
def keyboard
|
|
135
|
-
bridge.keyboard
|
|
136
|
-
end
|
|
137
|
-
|
|
138
130
|
#
|
|
139
131
|
# Opens the specified URL in the browser.
|
|
140
132
|
#
|
|
@@ -180,7 +172,7 @@ module Selenium
|
|
|
180
172
|
def quit
|
|
181
173
|
bridge.quit
|
|
182
174
|
ensure
|
|
183
|
-
@
|
|
175
|
+
@service_manager&.stop
|
|
184
176
|
@devtools&.close
|
|
185
177
|
end
|
|
186
178
|
|
|
@@ -263,19 +255,19 @@ module Selenium
|
|
|
263
255
|
# driver.first(id: 'foo')
|
|
264
256
|
#
|
|
265
257
|
|
|
266
|
-
|
|
258
|
+
alias first find_element
|
|
267
259
|
|
|
268
260
|
#
|
|
269
261
|
# driver.all(class: 'bar') #=> [#<WebDriver::Element:0x1011c3b88, ...]
|
|
270
262
|
#
|
|
271
263
|
|
|
272
|
-
|
|
264
|
+
alias all find_elements
|
|
273
265
|
|
|
274
266
|
#
|
|
275
267
|
# driver.script('function() { ... };')
|
|
276
268
|
#
|
|
277
269
|
|
|
278
|
-
|
|
270
|
+
alias script execute_script
|
|
279
271
|
|
|
280
272
|
# Get the first element matching the given selector. If given a
|
|
281
273
|
# String or Symbol, it will be used as the id of the element.
|
|
@@ -316,30 +308,45 @@ module Selenium
|
|
|
316
308
|
|
|
317
309
|
attr_reader :bridge
|
|
318
310
|
|
|
319
|
-
def create_bridge(
|
|
320
|
-
Remote::Bridge.new(http_client: http_client,
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
311
|
+
def create_bridge(caps:, url:, http_client: nil)
|
|
312
|
+
Remote::Bridge.new(http_client: http_client, url: url).tap do |bridge|
|
|
313
|
+
bridge.create_session(caps)
|
|
314
|
+
end
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
def process_options(options, capabilities)
|
|
318
|
+
if options && capabilities
|
|
319
|
+
msg = "Don't use both :options and :capabilities when initializing #{self.class}, prefer :options"
|
|
320
|
+
raise ArgumentError, msg
|
|
321
|
+
end
|
|
322
|
+
|
|
323
|
+
options ? options.as_json : deprecate_capabilities(capabilities)
|
|
324
|
+
end
|
|
325
|
+
|
|
326
|
+
def deprecate_capabilities(capabilities)
|
|
327
|
+
unless is_a?(Remote::Driver)
|
|
328
|
+
WebDriver.logger.deprecate("The :capabilities parameter for #{self.class}",
|
|
329
|
+
":options argument with an instance of #{self.class}",
|
|
330
|
+
id: :capabilities)
|
|
324
331
|
end
|
|
332
|
+
generate_capabilities(capabilities)
|
|
325
333
|
end
|
|
326
334
|
|
|
327
335
|
def generate_capabilities(capabilities)
|
|
328
336
|
Array(capabilities).map { |cap|
|
|
329
337
|
if cap.is_a? Symbol
|
|
330
|
-
cap =
|
|
338
|
+
cap = WebDriver::Options.send(cap)
|
|
331
339
|
elsif !cap.respond_to? :as_json
|
|
332
340
|
msg = ":capabilities parameter only accepts objects responding to #as_json which #{cap.class} does not"
|
|
333
341
|
raise ArgumentError, msg
|
|
334
342
|
end
|
|
335
343
|
cap.as_json
|
|
336
|
-
}.inject(:merge)
|
|
344
|
+
}.inject(:merge)
|
|
337
345
|
end
|
|
338
346
|
|
|
339
347
|
def service_url(service)
|
|
340
|
-
|
|
341
|
-
@
|
|
342
|
-
@service.uri
|
|
348
|
+
@service_manager = service.launch
|
|
349
|
+
@service_manager.uri
|
|
343
350
|
end
|
|
344
351
|
|
|
345
352
|
def screenshot
|
|
@@ -349,11 +356,13 @@ module Selenium
|
|
|
349
356
|
def add_extensions(browser)
|
|
350
357
|
extensions = case browser
|
|
351
358
|
when :chrome, :msedge
|
|
352
|
-
|
|
359
|
+
Chromium::Driver::EXTENSIONS
|
|
353
360
|
when :firefox
|
|
354
361
|
Firefox::Driver::EXTENSIONS
|
|
355
362
|
when :safari, :safari_technology_preview
|
|
356
363
|
Safari::Driver::EXTENSIONS
|
|
364
|
+
when :ie, :internet_explorer
|
|
365
|
+
IE::Driver::EXTENSIONS
|
|
357
366
|
else
|
|
358
367
|
[]
|
|
359
368
|
end
|
|
@@ -21,7 +21,6 @@ module Selenium
|
|
|
21
21
|
module WebDriver
|
|
22
22
|
module DriverExtensions
|
|
23
23
|
module DownloadsFiles
|
|
24
|
-
|
|
25
24
|
#
|
|
26
25
|
# Sets download path for Chromium.
|
|
27
26
|
#
|
|
@@ -38,7 +37,6 @@ module Selenium
|
|
|
38
37
|
}
|
|
39
38
|
@bridge.send_command(params)
|
|
40
39
|
end
|
|
41
|
-
|
|
42
40
|
end # DownloadsFiles
|
|
43
41
|
end # DriverExtensions
|
|
44
42
|
end # WebDriver
|
|
@@ -21,7 +21,6 @@ module Selenium
|
|
|
21
21
|
module WebDriver
|
|
22
22
|
module DriverExtensions
|
|
23
23
|
module HasAddons
|
|
24
|
-
|
|
25
24
|
#
|
|
26
25
|
# Installs addon.
|
|
27
26
|
#
|
|
@@ -43,7 +42,6 @@ module Selenium
|
|
|
43
42
|
def uninstall_addon(id)
|
|
44
43
|
@bridge.uninstall_addon(id)
|
|
45
44
|
end
|
|
46
|
-
|
|
47
45
|
end # HasAddons
|
|
48
46
|
end # DriverExtensions
|
|
49
47
|
end # WebDriver
|
|
@@ -21,7 +21,6 @@ module Selenium
|
|
|
21
21
|
module WebDriver
|
|
22
22
|
module DriverExtensions
|
|
23
23
|
module HasApplePermissions
|
|
24
|
-
|
|
25
24
|
#
|
|
26
25
|
# Returns permissions.
|
|
27
26
|
#
|
|
@@ -44,7 +43,6 @@ module Selenium
|
|
|
44
43
|
def permissions=(permissions)
|
|
45
44
|
@bridge.permissions = permissions
|
|
46
45
|
end
|
|
47
|
-
|
|
48
46
|
end # HasPermissions
|
|
49
47
|
end # DriverExtensions
|
|
50
48
|
end # WebDriver
|
|
@@ -21,7 +21,6 @@ module Selenium
|
|
|
21
21
|
module WebDriver
|
|
22
22
|
module DriverExtensions
|
|
23
23
|
module HasAuthentication
|
|
24
|
-
|
|
25
24
|
#
|
|
26
25
|
# Registers basic authentication handler which is automatically
|
|
27
26
|
# used whenever browser gets an authentication required response.
|
|
@@ -82,7 +81,6 @@ module Selenium
|
|
|
82
81
|
)
|
|
83
82
|
end
|
|
84
83
|
end
|
|
85
|
-
|
|
86
84
|
end # HasAuthentication
|
|
87
85
|
end # DriverExtensions
|
|
88
86
|
end # WebDriver
|
|
@@ -21,7 +21,6 @@ module Selenium
|
|
|
21
21
|
module WebDriver
|
|
22
22
|
module DriverExtensions
|
|
23
23
|
module HasBiDi
|
|
24
|
-
|
|
25
24
|
#
|
|
26
25
|
# Retrieves WebDriver BiDi connection.
|
|
27
26
|
#
|
|
@@ -31,7 +30,6 @@ module Selenium
|
|
|
31
30
|
def bidi
|
|
32
31
|
@bidi ||= Selenium::WebDriver::BiDi.new(url: capabilities[:web_socket_url])
|
|
33
32
|
end
|
|
34
|
-
|
|
35
33
|
end # HasBiDi
|
|
36
34
|
end # DriverExtensions
|
|
37
35
|
end # WebDriver
|
|
@@ -21,7 +21,6 @@ module Selenium
|
|
|
21
21
|
module WebDriver
|
|
22
22
|
module DriverExtensions
|
|
23
23
|
module HasCDP
|
|
24
|
-
|
|
25
24
|
#
|
|
26
25
|
# Returns network conditions.
|
|
27
26
|
#
|
|
@@ -31,7 +30,6 @@ module Selenium
|
|
|
31
30
|
def execute_cdp(cmd, **params)
|
|
32
31
|
@bridge.send_command(cmd: cmd, params: params)
|
|
33
32
|
end
|
|
34
|
-
|
|
35
33
|
end # HasCDP
|
|
36
34
|
end # DriverExtensions
|
|
37
35
|
end # WebDriver
|
|
@@ -21,7 +21,6 @@ module Selenium
|
|
|
21
21
|
module WebDriver
|
|
22
22
|
module DriverExtensions
|
|
23
23
|
module HasContext
|
|
24
|
-
|
|
25
24
|
#
|
|
26
25
|
# Sets the context that Selenium commands are running in using
|
|
27
26
|
# a `with` statement. The state of the context on the server is
|
|
@@ -37,7 +36,6 @@ module Selenium
|
|
|
37
36
|
def context
|
|
38
37
|
@bridge.context
|
|
39
38
|
end
|
|
40
|
-
|
|
41
39
|
end # HasContext
|
|
42
40
|
end # DriverExtensions
|
|
43
41
|
end # WebDriver
|
|
@@ -21,7 +21,6 @@ module Selenium
|
|
|
21
21
|
module WebDriver
|
|
22
22
|
module DriverExtensions
|
|
23
23
|
module HasDebugger
|
|
24
|
-
|
|
25
24
|
#
|
|
26
25
|
# Attaches debugger to session.
|
|
27
26
|
#
|
|
@@ -35,7 +34,6 @@ module Selenium
|
|
|
35
34
|
def attach_debugger
|
|
36
35
|
@bridge.attach_debugger
|
|
37
36
|
end
|
|
38
|
-
|
|
39
37
|
end # HasDebugger
|
|
40
38
|
end # DriverExtensions
|
|
41
39
|
end # WebDriver
|
|
@@ -21,7 +21,6 @@ module Selenium
|
|
|
21
21
|
module WebDriver
|
|
22
22
|
module DriverExtensions
|
|
23
23
|
module HasDevTools
|
|
24
|
-
|
|
25
24
|
#
|
|
26
25
|
# Retrieves connection to DevTools.
|
|
27
26
|
#
|
|
@@ -36,7 +35,6 @@ module Selenium
|
|
|
36
35
|
Selenium::WebDriver::DevTools.new(url: devtools_url)
|
|
37
36
|
end
|
|
38
37
|
end
|
|
39
|
-
|
|
40
38
|
end # HasDevTools
|
|
41
39
|
end # DriverExtensions
|
|
42
40
|
end # WebDriver
|
|
@@ -21,7 +21,6 @@ module Selenium
|
|
|
21
21
|
module WebDriver
|
|
22
22
|
module DriverExtensions
|
|
23
23
|
module HasLaunching
|
|
24
|
-
|
|
25
24
|
#
|
|
26
25
|
# Launches Chromium app specified by id.
|
|
27
26
|
#
|
|
@@ -31,7 +30,6 @@ module Selenium
|
|
|
31
30
|
def launch_app(id)
|
|
32
31
|
@bridge.launch_app(id)
|
|
33
32
|
end
|
|
34
|
-
|
|
35
33
|
end # HasLaunching
|
|
36
34
|
end # DriverExtensions
|
|
37
35
|
end # WebDriver
|
|
@@ -29,8 +29,7 @@ module Selenium
|
|
|
29
29
|
def location=(*)
|
|
30
30
|
raise Error::UnsupportedOperationError, 'The W3C standard does not currently support setting location'
|
|
31
31
|
end
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
alias set_location location
|
|
34
33
|
end # HasLocation
|
|
35
34
|
end # DriverExtensions
|
|
36
35
|
end # WebDriver
|
|
@@ -21,7 +21,6 @@ module Selenium
|
|
|
21
21
|
module WebDriver
|
|
22
22
|
module DriverExtensions
|
|
23
23
|
module HasNetworkConditions
|
|
24
|
-
|
|
25
24
|
#
|
|
26
25
|
# Returns network conditions.
|
|
27
26
|
#
|
|
@@ -61,7 +60,6 @@ module Selenium
|
|
|
61
60
|
def delete_network_conditions
|
|
62
61
|
@bridge.delete_network_conditions
|
|
63
62
|
end
|
|
64
|
-
|
|
65
63
|
end # HasNetworkConditions
|
|
66
64
|
end # DriverExtensions
|
|
67
65
|
end # WebDriver
|
|
@@ -21,7 +21,6 @@ module Selenium
|
|
|
21
21
|
module WebDriver
|
|
22
22
|
module DriverExtensions
|
|
23
23
|
module HasNetworkInterception
|
|
24
|
-
|
|
25
24
|
#
|
|
26
25
|
# Intercepts requests coming from browser allowing
|
|
27
26
|
# to either pass them through like proxy or provide
|
|
@@ -64,7 +63,6 @@ module Selenium
|
|
|
64
63
|
@interceptor ||= DevTools::NetworkInterceptor.new(devtools)
|
|
65
64
|
@interceptor.intercept(&block)
|
|
66
65
|
end
|
|
67
|
-
|
|
68
66
|
end # HasNetworkInterception
|
|
69
67
|
end # DriverExtensions
|
|
70
68
|
end # WebDriver
|
|
@@ -21,7 +21,6 @@ module Selenium
|
|
|
21
21
|
module WebDriver
|
|
22
22
|
module DriverExtensions
|
|
23
23
|
module HasPermissions
|
|
24
|
-
|
|
25
24
|
#
|
|
26
25
|
# Set one permission.
|
|
27
26
|
#
|
|
@@ -44,7 +43,6 @@ module Selenium
|
|
|
44
43
|
@bridge.set_permission(key, value)
|
|
45
44
|
end
|
|
46
45
|
end
|
|
47
|
-
|
|
48
46
|
end # HasPermissions
|
|
49
47
|
end # DriverExtensions
|
|
50
48
|
end # WebDriver
|
|
@@ -21,7 +21,6 @@ module Selenium
|
|
|
21
21
|
module WebDriver
|
|
22
22
|
module DriverExtensions
|
|
23
23
|
module HasPinnedScripts
|
|
24
|
-
|
|
25
24
|
#
|
|
26
25
|
# Returns the list of all pinned scripts.
|
|
27
26
|
#
|
|
@@ -70,7 +69,6 @@ module Selenium
|
|
|
70
69
|
devtools.page.remove_script_to_evaluate_on_new_document(identifier: script.devtools_identifier)
|
|
71
70
|
pinned_scripts.delete(script)
|
|
72
71
|
end
|
|
73
|
-
|
|
74
72
|
end # HasPinnedScripts
|
|
75
73
|
end # DriverExtensions
|
|
76
74
|
end # WebDriver
|
|
@@ -43,7 +43,7 @@ module Selenium
|
|
|
43
43
|
def ==(other)
|
|
44
44
|
other.is_a?(self.class) && ref == other.ref
|
|
45
45
|
end
|
|
46
|
-
|
|
46
|
+
alias eql? ==
|
|
47
47
|
|
|
48
48
|
def hash
|
|
49
49
|
[@id, @bridge].hash
|
|
@@ -207,7 +207,7 @@ module Selenium
|
|
|
207
207
|
def send_keys(*args)
|
|
208
208
|
bridge.send_keys_to_element @id, Keys.encode(args)
|
|
209
209
|
end
|
|
210
|
-
|
|
210
|
+
alias send_key send_keys
|
|
211
211
|
|
|
212
212
|
#
|
|
213
213
|
# If this element is a text entry element, this will clear the value. Has no effect on other
|
|
@@ -275,7 +275,7 @@ module Selenium
|
|
|
275
275
|
def css_value(prop)
|
|
276
276
|
bridge.element_value_of_css_property @id, prop
|
|
277
277
|
end
|
|
278
|
-
|
|
278
|
+
alias style css_value
|
|
279
279
|
|
|
280
280
|
#
|
|
281
281
|
# Get the location of this element.
|
|
@@ -333,18 +333,18 @@ module Selenium
|
|
|
333
333
|
# element.first(id: 'foo')
|
|
334
334
|
#
|
|
335
335
|
|
|
336
|
-
|
|
336
|
+
alias first find_element
|
|
337
337
|
|
|
338
338
|
#
|
|
339
339
|
# element.all(class: 'bar')
|
|
340
340
|
#
|
|
341
341
|
|
|
342
|
-
|
|
342
|
+
alias all find_elements
|
|
343
343
|
|
|
344
344
|
#
|
|
345
345
|
# element['class'] or element[:class] #=> "someclass"
|
|
346
346
|
#
|
|
347
|
-
|
|
347
|
+
alias [] attribute
|
|
348
348
|
|
|
349
349
|
#
|
|
350
350
|
# @api private
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
module Selenium
|
|
21
21
|
module WebDriver
|
|
22
22
|
module Error
|
|
23
|
-
|
|
24
23
|
#
|
|
25
24
|
# Returns exception from its string representation.
|
|
26
25
|
# @param [String, nil] error
|
|
@@ -213,7 +212,6 @@ module Selenium
|
|
|
213
212
|
#
|
|
214
213
|
|
|
215
214
|
class UnsupportedOperationError < WebDriverError; end
|
|
216
|
-
|
|
217
215
|
end # Error
|
|
218
216
|
end # WebDriver
|
|
219
217
|
end # Selenium
|
|
@@ -95,9 +95,9 @@ module Selenium
|
|
|
95
95
|
# @return [ActionBuilder] A self reference.
|
|
96
96
|
#
|
|
97
97
|
|
|
98
|
-
def move_to(element, right_by = nil, down_by = nil,
|
|
99
|
-
pointer = pointer_input(device)
|
|
100
|
-
pointer.create_pointer_move(duration: duration,
|
|
98
|
+
def move_to(element, right_by = nil, down_by = nil, **opts)
|
|
99
|
+
pointer = pointer_input(opts.delete(:device))
|
|
100
|
+
pointer.create_pointer_move(duration: opts.delete(:duration) || default_move_duration,
|
|
101
101
|
x: right_by || 0,
|
|
102
102
|
y: down_by || 0,
|
|
103
103
|
origin: element,
|
|
@@ -33,12 +33,12 @@ module Selenium
|
|
|
33
33
|
POINTER = :pointer
|
|
34
34
|
ORIGINS = [VIEWPORT, POINTER].freeze
|
|
35
35
|
|
|
36
|
-
def initialize(source, duration, x, y,
|
|
36
|
+
def initialize(source, duration, x, y, **opts)
|
|
37
37
|
super(source)
|
|
38
38
|
@duration = duration * 1000
|
|
39
39
|
@x_offset = x
|
|
40
40
|
@y_offset = y
|
|
41
|
-
@origin = element || origin || :viewport
|
|
41
|
+
@origin = opts.delete(:element) || opts.delete(:origin) || :viewport
|
|
42
42
|
@type = :pointerMove
|
|
43
43
|
@opts = opts
|
|
44
44
|
end
|
|
@@ -27,15 +27,17 @@ module Selenium
|
|
|
27
27
|
#
|
|
28
28
|
|
|
29
29
|
class Scroll < Interaction
|
|
30
|
-
def initialize(source:,
|
|
30
|
+
def initialize(source:, origin: :viewport, duration: 0.25, **opts)
|
|
31
31
|
super(source)
|
|
32
32
|
@type = :scroll
|
|
33
33
|
@duration = duration * 1000
|
|
34
34
|
@origin = origin
|
|
35
|
-
@x_offset = x
|
|
36
|
-
@y_offset = y
|
|
37
|
-
@delta_x = delta_x
|
|
38
|
-
@delta_y = delta_y
|
|
35
|
+
@x_offset = opts.delete(:x) || 0
|
|
36
|
+
@y_offset = opts.delete(:y) || 0
|
|
37
|
+
@delta_x = opts.delete(:delta_x) || 0
|
|
38
|
+
@delta_y = opts.delete(:delta_y) || 0
|
|
39
|
+
|
|
40
|
+
raise ArgumentError, "Invalid arguments: #{opts.keys}" unless opts.empty?
|
|
39
41
|
end
|
|
40
42
|
|
|
41
43
|
def assert_source(source)
|
|
@@ -48,9 +48,10 @@ module Selenium
|
|
|
48
48
|
#
|
|
49
49
|
# @param [String] progname Allow child projects to use Selenium's Logger pattern
|
|
50
50
|
#
|
|
51
|
-
def initialize(progname = 'Selenium')
|
|
51
|
+
def initialize(progname = 'Selenium', ignored: nil)
|
|
52
52
|
@logger = create_logger(progname)
|
|
53
|
-
@ignored =
|
|
53
|
+
@ignored = Array(ignored)
|
|
54
|
+
@first_warning = false
|
|
54
55
|
end
|
|
55
56
|
|
|
56
57
|
#
|
|
@@ -94,6 +95,13 @@ module Selenium
|
|
|
94
95
|
# @yield see #deprecate
|
|
95
96
|
#
|
|
96
97
|
def warn(message, id: [])
|
|
98
|
+
unless @first_warning
|
|
99
|
+
@first_warning = true
|
|
100
|
+
warn("Details on how to use and modify Selenium logger:\n", id: [:logger_info]) do
|
|
101
|
+
"https://selenium.dev/documentation/webdriver/troubleshooting/logging#ruby\n"
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
97
105
|
id = Array(id)
|
|
98
106
|
return if (@ignored & id).any?
|
|
99
107
|
|
|
@@ -38,12 +38,12 @@ module Selenium
|
|
|
38
38
|
def ie(**opts)
|
|
39
39
|
IE::Options.new(**opts)
|
|
40
40
|
end
|
|
41
|
-
|
|
41
|
+
alias internet_explorer ie
|
|
42
42
|
|
|
43
43
|
def edge(**opts)
|
|
44
44
|
Edge::Options.new(**opts)
|
|
45
45
|
end
|
|
46
|
-
|
|
46
|
+
alias microsoftedge edge
|
|
47
47
|
|
|
48
48
|
def safari(**opts)
|
|
49
49
|
Safari::Options.new(**opts)
|
|
@@ -85,7 +85,13 @@ module Selenium
|
|
|
85
85
|
#
|
|
86
86
|
|
|
87
87
|
def add_option(name, value = nil)
|
|
88
|
-
|
|
88
|
+
name, value = name.first if value.nil? && name.is_a?(Hash)
|
|
89
|
+
|
|
90
|
+
unless name.to_s.include?(':')
|
|
91
|
+
WebDriver.logger.deprecate('Options#add_option for w3c or browser specific capabilities',
|
|
92
|
+
'applicable attribute accessors or pass into constructor',
|
|
93
|
+
id: :add_option)
|
|
94
|
+
end
|
|
89
95
|
@options[name] = value
|
|
90
96
|
end
|
|
91
97
|
|
|
@@ -95,7 +101,7 @@ module Selenium
|
|
|
95
101
|
as_json == other.as_json
|
|
96
102
|
end
|
|
97
103
|
|
|
98
|
-
|
|
104
|
+
alias eql? ==
|
|
99
105
|
|
|
100
106
|
#
|
|
101
107
|
# @api private
|
|
@@ -106,11 +112,27 @@ module Selenium
|
|
|
106
112
|
|
|
107
113
|
w3c_options = process_w3c_options(options)
|
|
108
114
|
|
|
109
|
-
self.class::CAPABILITIES.
|
|
110
|
-
|
|
111
|
-
|
|
115
|
+
browser_options = self.class::CAPABILITIES.each_with_object({}) do |(capability_alias, capability_name), hash|
|
|
116
|
+
from_name = options.delete(capability_name)
|
|
117
|
+
from_alias = options.delete(capability_alias)
|
|
118
|
+
capability_value = if !from_name.nil? && capability_alias != capability_name
|
|
119
|
+
WebDriver.logger.deprecate("#{capability_name} as option",
|
|
120
|
+
capability_alias.to_s, id: :option_symbols)
|
|
121
|
+
from_name
|
|
122
|
+
elsif !from_alias.nil?
|
|
123
|
+
from_alias
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
hash[capability_name] = capability_value unless capability_value.nil?
|
|
112
127
|
end
|
|
113
|
-
|
|
128
|
+
|
|
129
|
+
unless options.empty?
|
|
130
|
+
msg = 'These options are not w3c compliant and will result in failures in a future release'
|
|
131
|
+
WebDriver.logger.warn("#{msg}: #{options}")
|
|
132
|
+
browser_options.merge!(options)
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
browser_options = {self.class::KEY => browser_options} if defined?(self.class::KEY)
|
|
114
136
|
|
|
115
137
|
process_browser_options(browser_options)
|
|
116
138
|
generate_as_json(w3c_options.merge(browser_options))
|