selenium-webdriver 4.0.0.beta1 → 4.0.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/selenium/{webdriver/edge/bridge.rb → devtools.rb} +8 -15
- data/lib/selenium/webdriver/atoms/findElements.js +77 -78
- data/lib/selenium/webdriver/atoms/getAttribute.js +64 -68
- data/lib/selenium/webdriver/atoms/isDisplayed.js +27 -27
- data/lib/selenium/webdriver/atoms/mutationListener.js +17 -0
- data/lib/selenium/webdriver/chrome.rb +1 -1
- data/lib/selenium/webdriver/chrome/driver.rb +12 -18
- data/lib/selenium/webdriver/chrome/service.rb +3 -1
- data/lib/selenium/webdriver/common.rb +1 -0
- data/lib/selenium/webdriver/common/driver.rb +20 -3
- data/lib/selenium/webdriver/common/driver_extensions/has_devtools.rb +23 -1
- data/lib/selenium/webdriver/common/driver_extensions/has_network_connection.rb +4 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_network_interception.rb +67 -0
- data/lib/selenium/webdriver/common/element.rb +41 -12
- data/lib/selenium/webdriver/common/interactions/interaction.rb +4 -1
- data/lib/selenium/webdriver/common/logger.rb +5 -2
- data/lib/selenium/webdriver/common/options.rb +42 -8
- data/lib/selenium/webdriver/common/proxy.rb +4 -1
- data/lib/selenium/webdriver/common/search_context.rb +4 -1
- data/lib/selenium/webdriver/common/service.rb +1 -0
- data/lib/selenium/webdriver/devtools.rb +34 -25
- data/lib/selenium/webdriver/devtools/{v87/console.rb → request.rb} +32 -34
- data/lib/selenium/webdriver/edge.rb +1 -1
- data/lib/selenium/webdriver/edge/driver.rb +2 -6
- data/lib/selenium/webdriver/firefox.rb +5 -1
- data/lib/selenium/webdriver/firefox/driver.rb +8 -15
- data/lib/selenium/webdriver/ie/driver.rb +1 -1
- data/lib/selenium/webdriver/ie/service.rb +3 -1
- data/lib/selenium/webdriver/remote/bridge.rb +24 -3
- data/lib/selenium/webdriver/remote/capabilities.rb +25 -15
- data/lib/selenium/webdriver/remote/driver.rb +6 -1
- data/lib/selenium/webdriver/remote/http/common.rb +0 -5
- data/lib/selenium/webdriver/remote/http/default.rb +5 -3
- data/lib/selenium/webdriver/safari.rb +1 -1
- data/lib/selenium/webdriver/safari/driver.rb +3 -7
- data/lib/selenium/webdriver/support/guards.rb +95 -0
- data/lib/selenium/webdriver/support/guards/guard.rb +89 -0
- data/lib/selenium/webdriver/{devtools/v87/system_info.rb → support/guards/guard_condition.rb} +24 -24
- data/lib/selenium/webdriver/support/select.rb +2 -2
- data/lib/selenium/webdriver/version.rb +1 -1
- metadata +15 -197
- data/CHANGES +0 -1825
- data/Gemfile +0 -4
- data/LICENSE +0 -202
- data/README.md +0 -34
- data/lib/selenium/webdriver/chrome/bridge.rb +0 -66
- data/lib/selenium/webdriver/devtools/v85/accessibility.rb +0 -64
- data/lib/selenium/webdriver/devtools/v85/animation.rb +0 -100
- data/lib/selenium/webdriver/devtools/v85/application_cache.rb +0 -66
- data/lib/selenium/webdriver/devtools/v85/audits.rb +0 -63
- data/lib/selenium/webdriver/devtools/v85/background_service.rb +0 -69
- data/lib/selenium/webdriver/devtools/v85/browser.rb +0 -125
- data/lib/selenium/webdriver/devtools/v85/cache_storage.rb +0 -75
- data/lib/selenium/webdriver/devtools/v85/cast.rb +0 -72
- data/lib/selenium/webdriver/devtools/v85/console.rb +0 -59
- data/lib/selenium/webdriver/devtools/v85/css.rb +0 -167
- data/lib/selenium/webdriver/devtools/v85/database.rb +0 -66
- data/lib/selenium/webdriver/devtools/v85/debugger.rb +0 -231
- data/lib/selenium/webdriver/devtools/v85/device_orientation.rb +0 -55
- data/lib/selenium/webdriver/devtools/v85/dom.rb +0 -322
- data/lib/selenium/webdriver/devtools/v85/dom_debugger.rb +0 -95
- data/lib/selenium/webdriver/devtools/v85/dom_snapshot.rb +0 -67
- data/lib/selenium/webdriver/devtools/v85/dom_storage.rb +0 -81
- data/lib/selenium/webdriver/devtools/v85/emulation.rb +0 -182
- data/lib/selenium/webdriver/devtools/v85/fetch.rb +0 -99
- data/lib/selenium/webdriver/devtools/v85/headless_experimental.rb +0 -63
- data/lib/selenium/webdriver/devtools/v85/heap_profiler.rb +0 -109
- data/lib/selenium/webdriver/devtools/v85/indexed_db.rb +0 -102
- data/lib/selenium/webdriver/devtools/v85/input.rb +0 -143
- data/lib/selenium/webdriver/devtools/v85/inspector.rb +0 -57
- data/lib/selenium/webdriver/devtools/v85/io.rb +0 -61
- data/lib/selenium/webdriver/devtools/v85/layer_tree.rb +0 -97
- data/lib/selenium/webdriver/devtools/v85/log.rb +0 -68
- data/lib/selenium/webdriver/devtools/v85/media.rb +0 -59
- data/lib/selenium/webdriver/devtools/v85/memory.rb +0 -88
- data/lib/selenium/webdriver/devtools/v85/network.rb +0 -230
- data/lib/selenium/webdriver/devtools/v85/overlay.rb +0 -160
- data/lib/selenium/webdriver/devtools/v85/page.rb +0 -376
- data/lib/selenium/webdriver/devtools/v85/performance.rb +0 -65
- data/lib/selenium/webdriver/devtools/v85/profiler.rb +0 -113
- data/lib/selenium/webdriver/devtools/v85/runtime.rb +0 -196
- data/lib/selenium/webdriver/devtools/v85/schema.rb +0 -48
- data/lib/selenium/webdriver/devtools/v85/security.rb +0 -73
- data/lib/selenium/webdriver/devtools/v85/service_worker.rb +0 -118
- data/lib/selenium/webdriver/devtools/v85/storage.rb +0 -97
- data/lib/selenium/webdriver/devtools/v85/system_info.rb +0 -52
- data/lib/selenium/webdriver/devtools/v85/target.rb +0 -145
- data/lib/selenium/webdriver/devtools/v85/tethering.rb +0 -57
- data/lib/selenium/webdriver/devtools/v85/tracing.rb +0 -78
- data/lib/selenium/webdriver/devtools/v85/web_audio.rb +0 -72
- data/lib/selenium/webdriver/devtools/v85/web_authn.rb +0 -96
- data/lib/selenium/webdriver/devtools/v86/accessibility.rb +0 -64
- data/lib/selenium/webdriver/devtools/v86/animation.rb +0 -100
- data/lib/selenium/webdriver/devtools/v86/application_cache.rb +0 -66
- data/lib/selenium/webdriver/devtools/v86/audits.rb +0 -63
- data/lib/selenium/webdriver/devtools/v86/background_service.rb +0 -69
- data/lib/selenium/webdriver/devtools/v86/browser.rb +0 -125
- data/lib/selenium/webdriver/devtools/v86/cache_storage.rb +0 -75
- data/lib/selenium/webdriver/devtools/v86/cast.rb +0 -72
- data/lib/selenium/webdriver/devtools/v86/console.rb +0 -59
- data/lib/selenium/webdriver/devtools/v86/css.rb +0 -181
- data/lib/selenium/webdriver/devtools/v86/database.rb +0 -66
- data/lib/selenium/webdriver/devtools/v86/debugger.rb +0 -233
- data/lib/selenium/webdriver/devtools/v86/device_orientation.rb +0 -55
- data/lib/selenium/webdriver/devtools/v86/dom.rb +0 -329
- data/lib/selenium/webdriver/devtools/v86/dom_debugger.rb +0 -95
- data/lib/selenium/webdriver/devtools/v86/dom_snapshot.rb +0 -67
- data/lib/selenium/webdriver/devtools/v86/dom_storage.rb +0 -81
- data/lib/selenium/webdriver/devtools/v86/emulation.rb +0 -193
- data/lib/selenium/webdriver/devtools/v86/fetch.rb +0 -99
- data/lib/selenium/webdriver/devtools/v86/headless_experimental.rb +0 -63
- data/lib/selenium/webdriver/devtools/v86/heap_profiler.rb +0 -109
- data/lib/selenium/webdriver/devtools/v86/indexed_db.rb +0 -102
- data/lib/selenium/webdriver/devtools/v86/input.rb +0 -143
- data/lib/selenium/webdriver/devtools/v86/inspector.rb +0 -57
- data/lib/selenium/webdriver/devtools/v86/io.rb +0 -61
- data/lib/selenium/webdriver/devtools/v86/layer_tree.rb +0 -97
- data/lib/selenium/webdriver/devtools/v86/log.rb +0 -68
- data/lib/selenium/webdriver/devtools/v86/media.rb +0 -59
- data/lib/selenium/webdriver/devtools/v86/memory.rb +0 -88
- data/lib/selenium/webdriver/devtools/v86/network.rb +0 -235
- data/lib/selenium/webdriver/devtools/v86/overlay.rb +0 -183
- data/lib/selenium/webdriver/devtools/v86/page.rb +0 -376
- data/lib/selenium/webdriver/devtools/v86/performance.rb +0 -65
- data/lib/selenium/webdriver/devtools/v86/profiler.rb +0 -113
- data/lib/selenium/webdriver/devtools/v86/runtime.rb +0 -196
- data/lib/selenium/webdriver/devtools/v86/schema.rb +0 -48
- data/lib/selenium/webdriver/devtools/v86/security.rb +0 -73
- data/lib/selenium/webdriver/devtools/v86/service_worker.rb +0 -118
- data/lib/selenium/webdriver/devtools/v86/storage.rb +0 -97
- data/lib/selenium/webdriver/devtools/v86/system_info.rb +0 -52
- data/lib/selenium/webdriver/devtools/v86/target.rb +0 -145
- data/lib/selenium/webdriver/devtools/v86/tethering.rb +0 -57
- data/lib/selenium/webdriver/devtools/v86/tracing.rb +0 -78
- data/lib/selenium/webdriver/devtools/v86/web_audio.rb +0 -72
- data/lib/selenium/webdriver/devtools/v86/web_authn.rb +0 -102
- data/lib/selenium/webdriver/devtools/v87/accessibility.rb +0 -73
- data/lib/selenium/webdriver/devtools/v87/animation.rb +0 -100
- data/lib/selenium/webdriver/devtools/v87/application_cache.rb +0 -66
- data/lib/selenium/webdriver/devtools/v87/audits.rb +0 -63
- data/lib/selenium/webdriver/devtools/v87/background_service.rb +0 -69
- data/lib/selenium/webdriver/devtools/v87/browser.rb +0 -125
- data/lib/selenium/webdriver/devtools/v87/cache_storage.rb +0 -75
- data/lib/selenium/webdriver/devtools/v87/cast.rb +0 -72
- data/lib/selenium/webdriver/devtools/v87/css.rb +0 -181
- data/lib/selenium/webdriver/devtools/v87/database.rb +0 -66
- data/lib/selenium/webdriver/devtools/v87/debugger.rb +0 -233
- data/lib/selenium/webdriver/devtools/v87/device_orientation.rb +0 -55
- data/lib/selenium/webdriver/devtools/v87/dom.rb +0 -329
- data/lib/selenium/webdriver/devtools/v87/dom_debugger.rb +0 -95
- data/lib/selenium/webdriver/devtools/v87/dom_snapshot.rb +0 -67
- data/lib/selenium/webdriver/devtools/v87/dom_storage.rb +0 -81
- data/lib/selenium/webdriver/devtools/v87/emulation.rb +0 -193
- data/lib/selenium/webdriver/devtools/v87/fetch.rb +0 -99
- data/lib/selenium/webdriver/devtools/v87/headless_experimental.rb +0 -63
- data/lib/selenium/webdriver/devtools/v87/heap_profiler.rb +0 -109
- data/lib/selenium/webdriver/devtools/v87/indexed_db.rb +0 -102
- data/lib/selenium/webdriver/devtools/v87/input.rb +0 -143
- data/lib/selenium/webdriver/devtools/v87/inspector.rb +0 -57
- data/lib/selenium/webdriver/devtools/v87/io.rb +0 -61
- data/lib/selenium/webdriver/devtools/v87/layer_tree.rb +0 -97
- data/lib/selenium/webdriver/devtools/v87/log.rb +0 -68
- data/lib/selenium/webdriver/devtools/v87/media.rb +0 -59
- data/lib/selenium/webdriver/devtools/v87/memory.rb +0 -88
- data/lib/selenium/webdriver/devtools/v87/network.rb +0 -247
- data/lib/selenium/webdriver/devtools/v87/overlay.rb +0 -183
- data/lib/selenium/webdriver/devtools/v87/page.rb +0 -376
- data/lib/selenium/webdriver/devtools/v87/performance.rb +0 -65
- data/lib/selenium/webdriver/devtools/v87/profiler.rb +0 -125
- data/lib/selenium/webdriver/devtools/v87/runtime.rb +0 -196
- data/lib/selenium/webdriver/devtools/v87/schema.rb +0 -48
- data/lib/selenium/webdriver/devtools/v87/security.rb +0 -73
- data/lib/selenium/webdriver/devtools/v87/service_worker.rb +0 -118
- data/lib/selenium/webdriver/devtools/v87/storage.rb +0 -97
- data/lib/selenium/webdriver/devtools/v87/target.rb +0 -145
- data/lib/selenium/webdriver/devtools/v87/tethering.rb +0 -57
- data/lib/selenium/webdriver/devtools/v87/tracing.rb +0 -78
- data/lib/selenium/webdriver/devtools/v87/web_audio.rb +0 -72
- data/lib/selenium/webdriver/devtools/v87/web_authn.rb +0 -102
- data/lib/selenium/webdriver/devtools/v88/accessibility.rb +0 -73
- data/lib/selenium/webdriver/devtools/v88/animation.rb +0 -100
- data/lib/selenium/webdriver/devtools/v88/application_cache.rb +0 -66
- data/lib/selenium/webdriver/devtools/v88/audits.rb +0 -63
- data/lib/selenium/webdriver/devtools/v88/background_service.rb +0 -69
- data/lib/selenium/webdriver/devtools/v88/browser.rb +0 -130
- data/lib/selenium/webdriver/devtools/v88/cache_storage.rb +0 -75
- data/lib/selenium/webdriver/devtools/v88/cast.rb +0 -72
- data/lib/selenium/webdriver/devtools/v88/console.rb +0 -59
- data/lib/selenium/webdriver/devtools/v88/css.rb +0 -181
- data/lib/selenium/webdriver/devtools/v88/database.rb +0 -66
- data/lib/selenium/webdriver/devtools/v88/debugger.rb +0 -233
- data/lib/selenium/webdriver/devtools/v88/device_orientation.rb +0 -55
- data/lib/selenium/webdriver/devtools/v88/dom.rb +0 -329
- data/lib/selenium/webdriver/devtools/v88/dom_debugger.rb +0 -95
- data/lib/selenium/webdriver/devtools/v88/dom_snapshot.rb +0 -67
- data/lib/selenium/webdriver/devtools/v88/dom_storage.rb +0 -81
- data/lib/selenium/webdriver/devtools/v88/emulation.rb +0 -198
- data/lib/selenium/webdriver/devtools/v88/fetch.rb +0 -99
- data/lib/selenium/webdriver/devtools/v88/headless_experimental.rb +0 -63
- data/lib/selenium/webdriver/devtools/v88/heap_profiler.rb +0 -109
- data/lib/selenium/webdriver/devtools/v88/indexed_db.rb +0 -102
- data/lib/selenium/webdriver/devtools/v88/input.rb +0 -148
- data/lib/selenium/webdriver/devtools/v88/inspector.rb +0 -57
- data/lib/selenium/webdriver/devtools/v88/io.rb +0 -61
- data/lib/selenium/webdriver/devtools/v88/layer_tree.rb +0 -97
- data/lib/selenium/webdriver/devtools/v88/log.rb +0 -68
- data/lib/selenium/webdriver/devtools/v88/media.rb +0 -59
- data/lib/selenium/webdriver/devtools/v88/memory.rb +0 -88
- data/lib/selenium/webdriver/devtools/v88/network.rb +0 -247
- data/lib/selenium/webdriver/devtools/v88/overlay.rb +0 -183
- data/lib/selenium/webdriver/devtools/v88/page.rb +0 -376
- data/lib/selenium/webdriver/devtools/v88/performance.rb +0 -65
- data/lib/selenium/webdriver/devtools/v88/profiler.rb +0 -125
- data/lib/selenium/webdriver/devtools/v88/runtime.rb +0 -197
- data/lib/selenium/webdriver/devtools/v88/schema.rb +0 -48
- data/lib/selenium/webdriver/devtools/v88/security.rb +0 -73
- data/lib/selenium/webdriver/devtools/v88/service_worker.rb +0 -118
- data/lib/selenium/webdriver/devtools/v88/storage.rb +0 -103
- data/lib/selenium/webdriver/devtools/v88/system_info.rb +0 -52
- data/lib/selenium/webdriver/devtools/v88/target.rb +0 -145
- data/lib/selenium/webdriver/devtools/v88/tethering.rb +0 -57
- data/lib/selenium/webdriver/devtools/v88/tracing.rb +0 -79
- data/lib/selenium/webdriver/devtools/v88/web_audio.rb +0 -72
- data/lib/selenium/webdriver/devtools/v88/web_authn.rb +0 -102
- data/lib/selenium/webdriver/firefox/bridge.rb +0 -47
- data/lib/selenium/webdriver/safari/bridge.rb +0 -51
- data/selenium-webdriver.gemspec +0 -50
- data/selenium_server_deploy.jar +0 -0
@@ -22,7 +22,7 @@ require 'net/http'
|
|
22
22
|
module Selenium
|
23
23
|
module WebDriver
|
24
24
|
module Chrome
|
25
|
-
autoload :
|
25
|
+
autoload :Features, 'selenium/webdriver/chrome/features'
|
26
26
|
autoload :Driver, 'selenium/webdriver/chrome/driver'
|
27
27
|
autoload :Profile, 'selenium/webdriver/chrome/profile'
|
28
28
|
autoload :Options, 'selenium/webdriver/chrome/options'
|
@@ -27,37 +27,31 @@ module Selenium
|
|
27
27
|
#
|
28
28
|
|
29
29
|
class Driver < WebDriver::Driver
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
30
|
+
EXTENSIONS = [DriverExtensions::HasNetworkConditions,
|
31
|
+
DriverExtensions::HasNetworkInterception,
|
32
|
+
DriverExtensions::HasWebStorage,
|
33
|
+
DriverExtensions::HasLocation,
|
34
|
+
DriverExtensions::DownloadsFiles,
|
35
|
+
DriverExtensions::HasDevTools,
|
36
|
+
DriverExtensions::HasAuthentication,
|
37
|
+
DriverExtensions::HasLogs,
|
38
|
+
DriverExtensions::HasLogEvents,
|
39
|
+
DriverExtensions::PrintsPage].freeze
|
39
40
|
|
40
41
|
def browser
|
41
42
|
:chrome
|
42
43
|
end
|
43
44
|
|
44
|
-
def bridge_class
|
45
|
-
Bridge
|
46
|
-
end
|
47
|
-
|
48
45
|
def execute_cdp(cmd, **params)
|
49
46
|
@bridge.send_command(cmd: cmd, params: params)
|
50
47
|
end
|
51
48
|
|
52
49
|
private
|
53
50
|
|
54
|
-
def
|
55
|
-
|
51
|
+
def devtools_address
|
52
|
+
"http://#{capabilities['goog:chromeOptions']['debuggerAddress']}"
|
56
53
|
end
|
57
54
|
|
58
|
-
def debugger_address
|
59
|
-
capabilities['goog:chromeOptions']['debuggerAddress']
|
60
|
-
end
|
61
55
|
end # Driver
|
62
56
|
end # Chrome
|
63
57
|
end # WebDriver
|
@@ -39,7 +39,9 @@ module Selenium
|
|
39
39
|
driver_args << "--log-path=#{driver_opts.delete(:log_path)}" if driver_opts.key?(:log_path)
|
40
40
|
driver_args << "--url-base=#{driver_opts.delete(:url_base)}" if driver_opts.key?(:url_base)
|
41
41
|
driver_args << "--port-server=#{driver_opts.delete(:port_server)}" if driver_opts.key?(:port_server)
|
42
|
-
|
42
|
+
if driver_opts.key?(:whitelisted_ips)
|
43
|
+
driver_args << "--whitelisted-ips=#{driver_opts.delete(:whitelisted_ips)}"
|
44
|
+
end
|
43
45
|
driver_args << "--verbose" if driver_opts.key?(:verbose)
|
44
46
|
driver_args << "--silent" if driver_opts.key?(:silent)
|
45
47
|
driver_args
|
@@ -57,6 +57,7 @@ require 'selenium/webdriver/common/driver_extensions/has_session_id'
|
|
57
57
|
require 'selenium/webdriver/common/driver_extensions/has_remote_status'
|
58
58
|
require 'selenium/webdriver/common/driver_extensions/has_network_conditions'
|
59
59
|
require 'selenium/webdriver/common/driver_extensions/has_network_connection'
|
60
|
+
require 'selenium/webdriver/common/driver_extensions/has_network_interception'
|
60
61
|
require 'selenium/webdriver/common/driver_extensions/has_permissions'
|
61
62
|
require 'selenium/webdriver/common/driver_extensions/has_debugger'
|
62
63
|
require 'selenium/webdriver/common/driver_extensions/prints_page'
|
@@ -71,11 +71,13 @@ module Selenium
|
|
71
71
|
def initialize(bridge: nil, listener: nil, **opts)
|
72
72
|
@service = nil
|
73
73
|
bridge ||= create_bridge(**opts)
|
74
|
+
add_extensions(bridge.browser)
|
74
75
|
@bridge = listener ? Support::EventFiringBridge.new(bridge, listener) : bridge
|
75
76
|
end
|
76
77
|
|
77
78
|
def inspect
|
78
|
-
format '#<%<class>s:0x%<hash>x browser=%<browser>s>', class: self.class, hash: hash * 2,
|
79
|
+
format '#<%<class>s:0x%<hash>x browser=%<browser>s>', class: self.class, hash: hash * 2,
|
80
|
+
browser: bridge.browser.inspect
|
79
81
|
end
|
80
82
|
|
81
83
|
#
|
@@ -329,7 +331,7 @@ module Selenium
|
|
329
331
|
bridge_opts = {http_client: opts.delete(:http_client), url: opts.delete(:url)}
|
330
332
|
raise ArgumentError, "Unable to create a driver with parameters: #{opts}" unless opts.empty?
|
331
333
|
|
332
|
-
bridge =
|
334
|
+
bridge = Remote::Bridge.new(**bridge_opts)
|
333
335
|
|
334
336
|
bridge.create_session(capabilities)
|
335
337
|
bridge
|
@@ -340,8 +342,9 @@ module Selenium
|
|
340
342
|
if cap.is_a? Symbol
|
341
343
|
cap = Remote::Capabilities.send(cap)
|
342
344
|
elsif cap.is_a? Hash
|
345
|
+
new_message = 'Capabilities instance initialized with the Hash, or build values with Options class'
|
343
346
|
WebDriver.logger.deprecate("passing a Hash value to :capabilities",
|
344
|
-
|
347
|
+
new_message,
|
345
348
|
id: :capabilities_hash)
|
346
349
|
cap = Remote::Capabilities.new(cap)
|
347
350
|
elsif !cap.respond_to? :as_json
|
@@ -371,6 +374,20 @@ module Selenium
|
|
371
374
|
def screenshot
|
372
375
|
bridge.screenshot
|
373
376
|
end
|
377
|
+
|
378
|
+
def add_extensions(browser)
|
379
|
+
extensions = case browser
|
380
|
+
when :chrome, :msedge
|
381
|
+
Chrome::Driver::EXTENSIONS
|
382
|
+
when :firefox
|
383
|
+
Firefox::Driver::EXTENSIONS
|
384
|
+
when :safari, :safari_technology_preview
|
385
|
+
Safari::Driver::EXTENSIONS
|
386
|
+
else
|
387
|
+
[]
|
388
|
+
end
|
389
|
+
extensions.each { |extension| extend extension }
|
390
|
+
end
|
374
391
|
end # Driver
|
375
392
|
end # WebDriver
|
376
393
|
end # Selenium
|
@@ -29,7 +29,29 @@ module Selenium
|
|
29
29
|
#
|
30
30
|
|
31
31
|
def devtools
|
32
|
-
@devtools ||=
|
32
|
+
@devtools ||= begin
|
33
|
+
require 'selenium/devtools'
|
34
|
+
Selenium::DevTools.version ||= devtools_version
|
35
|
+
Selenium::DevTools.load_version
|
36
|
+
Selenium::WebDriver::DevTools.new(url: devtools_url)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def devtools_version
|
43
|
+
return Firefox::DEVTOOLS_VERSION if browser == :firefox
|
44
|
+
|
45
|
+
Integer(capabilities.browser_version.split('.').first)
|
46
|
+
end
|
47
|
+
|
48
|
+
def devtools_url
|
49
|
+
return devtools_address if devtools_address.include?('/session/')
|
50
|
+
|
51
|
+
uri = URI(devtools_address)
|
52
|
+
response = Net::HTTP.get(uri.hostname, '/json/version', uri.port)
|
53
|
+
|
54
|
+
JSON.parse(response)['webSocketDebuggerUrl']
|
33
55
|
end
|
34
56
|
|
35
57
|
end # HasDevTools
|
@@ -23,11 +23,13 @@ module Selenium
|
|
23
23
|
module DriverExtensions
|
24
24
|
module HasNetworkConnection
|
25
25
|
def network_connection_type
|
26
|
-
raise Error::UnsupportedOperationError,
|
26
|
+
raise Error::UnsupportedOperationError,
|
27
|
+
'The W3C standard does not currently support getting network connection'
|
27
28
|
end
|
28
29
|
|
29
30
|
def network_connection_type=(*)
|
30
|
-
raise Error::UnsupportedOperationError,
|
31
|
+
raise Error::UnsupportedOperationError,
|
32
|
+
'The W3C standard does not currently support setting network connection'
|
31
33
|
end
|
32
34
|
end # HasNetworkConnection
|
33
35
|
end # DriverExtensions
|
@@ -0,0 +1,67 @@
|
|
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
|
+
module Selenium
|
21
|
+
module WebDriver
|
22
|
+
module DriverExtensions
|
23
|
+
module HasNetworkInterception
|
24
|
+
|
25
|
+
#
|
26
|
+
# Intercepts requests coming from browser allowing
|
27
|
+
# to either pass them through like proxy or provide
|
28
|
+
# a stubbed response instead.
|
29
|
+
#
|
30
|
+
# @example Log requests and pass through
|
31
|
+
# driver.intercept do |request|
|
32
|
+
# puts "#{request.method} #{request.url}"
|
33
|
+
# request.continue
|
34
|
+
# end
|
35
|
+
#
|
36
|
+
# @example Stub response for image requests
|
37
|
+
# driver.intercept do |request|
|
38
|
+
# if request.url.match?(/\.png$/)
|
39
|
+
# request.respond(body: File.read('myfile.png'))
|
40
|
+
# else
|
41
|
+
# request.continue
|
42
|
+
# end
|
43
|
+
# end
|
44
|
+
#
|
45
|
+
# @param [#call] block which is called when request is interecepted
|
46
|
+
# @yieldparam [DevTools::Request]
|
47
|
+
#
|
48
|
+
|
49
|
+
def intercept
|
50
|
+
devtools.network.set_cache_disabled(cache_disabled: true)
|
51
|
+
devtools.fetch.on(:request_paused) do |params|
|
52
|
+
request = DevTools::Request.new(
|
53
|
+
devtools: devtools,
|
54
|
+
id: params['requestId'],
|
55
|
+
url: params.dig('request', 'url'),
|
56
|
+
method: params.dig('request', 'method'),
|
57
|
+
headers: params.dig('request', 'headers')
|
58
|
+
)
|
59
|
+
yield request
|
60
|
+
end
|
61
|
+
devtools.fetch.enable
|
62
|
+
end
|
63
|
+
|
64
|
+
end # HasNetworkInterception
|
65
|
+
end # DriverExtensions
|
66
|
+
end # WebDriver
|
67
|
+
end # Selenium
|
@@ -92,13 +92,18 @@ module Selenium
|
|
92
92
|
end
|
93
93
|
|
94
94
|
#
|
95
|
-
#
|
96
|
-
#
|
97
|
-
#
|
98
|
-
#
|
99
|
-
#
|
100
|
-
#
|
101
|
-
#
|
95
|
+
# This method attempts to provide the most likely desired current value for the attribute
|
96
|
+
# of the element, even when that desired value is actually a JavaScript property.
|
97
|
+
# It is implemented with a custom JavaScript atom. To obtain the exact value of the attribute or property,
|
98
|
+
# use #dom_attribute or #property methods respectively.
|
99
|
+
#
|
100
|
+
# More exactly, this method will return the value of the property with the given name,
|
101
|
+
# if it exists. If it does not, then the value of the attribute with the given name is returned.
|
102
|
+
# If neither exists, null is returned.
|
103
|
+
#
|
104
|
+
# The "style" attribute is converted as best can be to a text representation with a trailing semi-colon.
|
105
|
+
#
|
106
|
+
# The following are deemed to be "boolean" attributes, and will return either "true" or "false":
|
102
107
|
#
|
103
108
|
# async, autofocus, autoplay, checked, compact, complete, controls, declare, defaultchecked,
|
104
109
|
# defaultselected, defer, disabled, draggable, ended, formnovalidate, hidden, indeterminate,
|
@@ -106,22 +111,46 @@ module Selenium
|
|
106
111
|
# nowrap, open, paused, pubdate, readonly, required, reversed, scoped, seamless, seeking,
|
107
112
|
# selected, spellcheck, truespeed, willvalidate
|
108
113
|
#
|
109
|
-
# Finally, the following commonly mis-capitalized attribute/property names are evaluated as
|
110
|
-
# expected:
|
114
|
+
# Finally, the following commonly mis-capitalized attribute/property names are evaluated as expected:
|
111
115
|
#
|
112
|
-
# class,
|
116
|
+
# When the value of "class" is requested, the "className" property is returned.
|
117
|
+
# When the value of "readonly" is requested, the "readOnly" property is returned.
|
113
118
|
#
|
114
119
|
# @param [String] name attribute name
|
115
120
|
# @return [String, nil] attribute value
|
116
121
|
#
|
122
|
+
# @see #dom_attribute
|
123
|
+
# @see #property
|
124
|
+
#
|
117
125
|
|
118
126
|
def attribute(name)
|
119
127
|
bridge.element_attribute self, name
|
120
128
|
end
|
121
129
|
|
122
130
|
#
|
123
|
-
#
|
124
|
-
#
|
131
|
+
# Gets the value of a declared HTML attribute of this element.
|
132
|
+
#
|
133
|
+
# As opposed to the #attribute method, this method
|
134
|
+
# only returns attributes declared in the element's HTML markup.
|
135
|
+
#
|
136
|
+
# If the attribute is not set, nil is returned.
|
137
|
+
#
|
138
|
+
# @param [String] name attribute name
|
139
|
+
# @return [String, nil] attribute value
|
140
|
+
#
|
141
|
+
# @see #attribute
|
142
|
+
# @see #property
|
143
|
+
#
|
144
|
+
|
145
|
+
def dom_attribute(name)
|
146
|
+
bridge.element_dom_attribute self, name
|
147
|
+
end
|
148
|
+
|
149
|
+
#
|
150
|
+
# Gets the value of a JavaScript property of this element
|
151
|
+
# This will return the current value,
|
152
|
+
# even if this has been modified after the page has been loaded.
|
153
|
+
# If the value is not set, nil is returned.
|
125
154
|
#
|
126
155
|
# @param [String] name property name
|
127
156
|
# @return [String, nil] property value
|
@@ -26,7 +26,10 @@ module Selenium
|
|
26
26
|
attr_reader :source
|
27
27
|
|
28
28
|
def initialize(source)
|
29
|
-
|
29
|
+
unless Interactions::SOURCE_TYPES.include? source.type
|
30
|
+
raise TypeError,
|
31
|
+
"#{source.type} is not a valid input type"
|
32
|
+
end
|
30
33
|
|
31
34
|
@source = source
|
32
35
|
end
|
@@ -108,10 +108,11 @@ module Selenium
|
|
108
108
|
#
|
109
109
|
# @param [String] old
|
110
110
|
# @param [String, nil] new
|
111
|
-
# @param [Symbol, Array<
|
111
|
+
# @param [Symbol, Array<Symbol>] id
|
112
|
+
# @param [String] reference
|
112
113
|
# @yield appends additional message to end of provided template
|
113
114
|
#
|
114
|
-
def deprecate(old, new = nil, id: [], &block)
|
115
|
+
def deprecate(old, new = nil, id: [], reference: '', &block)
|
115
116
|
id = Array(id)
|
116
117
|
return if @ignored.include?(:deprecations) || (@ignored & id).any?
|
117
118
|
|
@@ -123,6 +124,8 @@ module Selenium
|
|
123
124
|
else
|
124
125
|
' and will be removed in a future release.'
|
125
126
|
end
|
127
|
+
message << " See explanation for this deprecation: #{reference}." unless reference.empty?
|
128
|
+
|
126
129
|
warn message, &block
|
127
130
|
end
|
128
131
|
|
@@ -23,16 +23,42 @@ module Selenium
|
|
23
23
|
W3C_OPTIONS = %i[browser_name browser_version platform_name accept_insecure_certs page_load_strategy proxy
|
24
24
|
set_window_rect timeouts unhandled_prompt_behavior strict_file_interactability].freeze
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
next if method_defined? key
|
26
|
+
class << self
|
27
|
+
attr_reader :driver_path
|
29
28
|
|
30
|
-
|
31
|
-
|
32
|
-
|
29
|
+
def chrome(**opts)
|
30
|
+
Chrome::Options.new(**opts)
|
31
|
+
end
|
32
|
+
|
33
|
+
def firefox(**opts)
|
34
|
+
Firefox::Options.new(**opts)
|
35
|
+
end
|
36
|
+
|
37
|
+
def ie(**opts)
|
38
|
+
IE::Options.new(**opts)
|
39
|
+
end
|
40
|
+
alias_method :internet_explorer, :ie
|
41
|
+
|
42
|
+
def edge(**opts)
|
43
|
+
Edge::Options.new(**opts)
|
44
|
+
end
|
45
|
+
alias_method :microsoftedge, :edge
|
33
46
|
|
34
|
-
|
35
|
-
|
47
|
+
def safari(**opts)
|
48
|
+
Safari::Options.new(**opts)
|
49
|
+
end
|
50
|
+
|
51
|
+
def set_capabilities
|
52
|
+
(W3C_OPTIONS + self::CAPABILITIES.keys).each do |key|
|
53
|
+
next if method_defined? key
|
54
|
+
|
55
|
+
define_method key do
|
56
|
+
@options[key]
|
57
|
+
end
|
58
|
+
|
59
|
+
define_method "#{key}=" do |value|
|
60
|
+
@options[key] = value
|
61
|
+
end
|
36
62
|
end
|
37
63
|
end
|
38
64
|
end
|
@@ -68,6 +94,14 @@ module Selenium
|
|
68
94
|
@options[name] = value
|
69
95
|
end
|
70
96
|
|
97
|
+
def ==(other)
|
98
|
+
return false unless other.is_a? self.class
|
99
|
+
|
100
|
+
as_json == other.as_json
|
101
|
+
end
|
102
|
+
|
103
|
+
alias_method :eql?, :==
|
104
|
+
|
71
105
|
#
|
72
106
|
# @api private
|
73
107
|
#
|
@@ -127,7 +127,10 @@ module Selenium
|
|
127
127
|
end
|
128
128
|
|
129
129
|
def type=(type)
|
130
|
-
|
130
|
+
unless TYPES.key? type
|
131
|
+
raise ArgumentError,
|
132
|
+
"invalid proxy type: #{type.inspect}, expected one of #{TYPES.keys.inspect}"
|
133
|
+
end
|
131
134
|
|
132
135
|
if defined?(@type) && type != @type
|
133
136
|
raise ArgumentError, "incompatible proxy type #{type.inspect} (already set to #{@type.inspect})"
|