selenium-webdriver 4.1.0 → 4.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES +295 -1
- data/Gemfile +2 -0
- data/LICENSE +1 -1
- data/NOTICE +1 -1
- data/README.md +2 -2
- 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 +36 -39
- data/lib/selenium/webdriver/atoms/findElements.js +3 -4
- 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 +5 -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/{common/driver_extensions/has_location.rb → bidi/log/filter_by.rb} +14 -11
- 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 +51 -0
- data/lib/selenium/webdriver/bidi.rb +56 -0
- data/lib/selenium/webdriver/chrome/driver.rb +9 -29
- data/lib/selenium/webdriver/chrome/features.rb +6 -68
- data/lib/selenium/webdriver/chrome/options.rb +3 -223
- data/lib/selenium/webdriver/chrome/profile.rb +3 -83
- data/lib/selenium/webdriver/chrome/service.rb +4 -19
- data/lib/selenium/webdriver/chrome.rb +0 -16
- data/lib/selenium/webdriver/chromium/driver.rb +60 -0
- data/lib/selenium/webdriver/chromium/features.rb +103 -0
- data/lib/selenium/webdriver/chromium/options.rb +243 -0
- data/lib/selenium/webdriver/chromium/profile.rb +113 -0
- data/lib/selenium/webdriver/chromium.rb +29 -0
- data/lib/selenium/webdriver/common/action_builder.rb +62 -22
- data/lib/selenium/webdriver/common/child_process.rb +124 -0
- data/lib/selenium/webdriver/common/driver.rb +31 -81
- 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_remote_status.rb → has_bidi.rb} +10 -5
- data/lib/selenium/webdriver/common/driver_extensions/has_casting.rb +10 -1
- data/lib/selenium/webdriver/common/driver_extensions/has_cdp.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_context.rb +1 -4
- 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_log_events.rb +1 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_network_conditions.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_network_interception.rb +2 -69
- data/lib/selenium/webdriver/common/driver_extensions/has_permissions.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_pinned_scripts.rb +1 -3
- data/lib/selenium/webdriver/common/driver_finder.rb +45 -0
- data/lib/selenium/webdriver/common/element.rb +8 -8
- data/lib/selenium/webdriver/common/error.rb +28 -5
- data/lib/selenium/webdriver/common/html5/shared_web_storage.rb +2 -2
- 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/{driver_extensions/has_network_connection.rb → interactions/pointer_cancel.rb} +19 -11
- 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 +59 -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/local_driver.rb +46 -0
- data/lib/selenium/webdriver/common/logger.rb +90 -25
- data/lib/selenium/webdriver/common/manager.rb +0 -27
- data/lib/selenium/webdriver/common/options.rb +13 -17
- data/lib/selenium/webdriver/common/platform.rb +5 -51
- data/lib/selenium/webdriver/common/port_prober.rb +1 -1
- data/lib/selenium/webdriver/common/profile_helper.rb +1 -1
- data/lib/selenium/webdriver/common/proxy.rb +2 -2
- data/lib/selenium/webdriver/common/search_context.rb +0 -6
- data/lib/selenium/webdriver/common/selenium_manager.rb +134 -0
- data/lib/selenium/webdriver/common/service.rb +21 -30
- data/lib/selenium/webdriver/common/service_manager.rb +8 -15
- data/lib/selenium/webdriver/common/shadow_root.rb +2 -3
- data/lib/selenium/webdriver/common/socket_lock.rb +3 -3
- data/lib/selenium/webdriver/common/socket_poller.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 +85 -0
- data/lib/selenium/webdriver/common/virtual_authenticator/virtual_authenticator.rb +72 -0
- data/lib/selenium/webdriver/common/virtual_authenticator/virtual_authenticator_options.rb +62 -0
- data/lib/selenium/webdriver/common/websocket_connection.rb +164 -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 +21 -5
- 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 +173 -0
- data/lib/selenium/webdriver/devtools/pinned_script.rb +0 -2
- data/lib/selenium/webdriver/devtools/request.rb +1 -3
- data/lib/selenium/webdriver/devtools/response.rb +1 -3
- data/lib/selenium/webdriver/devtools.rb +17 -114
- data/lib/selenium/webdriver/edge/driver.rb +9 -3
- data/lib/selenium/webdriver/edge/features.rb +4 -4
- data/lib/selenium/webdriver/edge/options.rb +17 -5
- data/lib/selenium/webdriver/edge/profile.rb +2 -2
- data/lib/selenium/webdriver/edge/service.rb +8 -7
- data/lib/selenium/webdriver/edge.rb +0 -2
- data/lib/selenium/webdriver/firefox/driver.rb +9 -2
- data/lib/selenium/webdriver/firefox/features.rb +6 -6
- data/lib/selenium/webdriver/firefox/options.rb +7 -16
- data/lib/selenium/webdriver/firefox/profile.rb +8 -12
- data/lib/selenium/webdriver/firefox/service.rb +0 -18
- data/lib/selenium/webdriver/firefox/util.rb +46 -0
- data/lib/selenium/webdriver/firefox.rb +1 -14
- data/lib/selenium/webdriver/ie/driver.rb +7 -1
- data/lib/selenium/webdriver/ie/options.rb +4 -3
- data/lib/selenium/webdriver/ie/service.rb +0 -22
- data/lib/selenium/webdriver/ie.rb +0 -14
- data/lib/selenium/webdriver/remote/{commands.rb → bridge/commands.rb} +15 -8
- data/lib/selenium/webdriver/remote/bridge.rb +65 -35
- data/lib/selenium/webdriver/remote/capabilities.rb +3 -53
- data/lib/selenium/webdriver/remote/driver.rb +31 -14
- data/lib/selenium/webdriver/remote/http/common.rb +3 -3
- data/lib/selenium/webdriver/remote/http/curb.rb +1 -3
- data/lib/selenium/webdriver/remote/http/default.rb +8 -14
- data/lib/selenium/webdriver/remote/response.rb +2 -3
- data/lib/selenium/webdriver/remote/server_error.rb +1 -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 +10 -4
- data/lib/selenium/webdriver/safari.rb +1 -15
- data/lib/selenium/webdriver/support/color.rb +22 -22
- data/lib/selenium/webdriver/support/guards/guard.rb +0 -2
- data/lib/selenium/webdriver/support/guards/guard_condition.rb +1 -3
- data/lib/selenium/webdriver/support/guards.rb +1 -1
- data/lib/selenium/webdriver/support/relative_locator.rb +0 -1
- data/lib/selenium/webdriver/support/select.rb +3 -1
- data/lib/selenium/webdriver/version.rb +1 -1
- data/lib/selenium/webdriver.rb +6 -4
- data/selenium-webdriver.gemspec +14 -12
- metadata +73 -65
- data/lib/selenium/webdriver/remote/http/persistent.rb +0 -65
- data/lib/selenium/webdriver/support/cdp/domain.rb.erb +0 -63
- data/lib/selenium/webdriver/support/cdp_client_generator.rb +0 -108
@@ -1,63 +0,0 @@
|
|
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
|
-
# This file is automatically generated. Any changes will be lost!
|
21
|
-
module Selenium
|
22
|
-
module DevTools
|
23
|
-
module <%= version %>
|
24
|
-
class <%= domain[:domain] %>
|
25
|
-
<% if domain[:events] %>
|
26
|
-
EVENTS = {
|
27
|
-
<% domain[:events].each do |event| %>
|
28
|
-
<%= h.snake_case(event[:name]) %>: '<%= event[:name] %>',
|
29
|
-
<% end %>
|
30
|
-
}.freeze
|
31
|
-
<% end %>
|
32
|
-
|
33
|
-
def initialize(devtools)
|
34
|
-
@devtools = devtools
|
35
|
-
end
|
36
|
-
|
37
|
-
def on(event, &block)
|
38
|
-
event = EVENTS[event] if event.is_a?(Symbol)
|
39
|
-
@devtools.callbacks["<%= domain[:domain] %>.#{event}"] << block
|
40
|
-
end
|
41
|
-
|
42
|
-
<% domain[:commands].each do |command| %>
|
43
|
-
<% if command[:parameters] %>
|
44
|
-
def <%= h.snake_case(command[:name]) %>(<%= h.kwargs(command[:parameters]) %>)
|
45
|
-
<% else %>
|
46
|
-
def <%= h.snake_case(command[:name]) %>
|
47
|
-
<% end %>
|
48
|
-
<% if command[:parameters] %>
|
49
|
-
@devtools.send_cmd('<%= domain[:domain] %>.<%= command[:name] %>',
|
50
|
-
<% until command[:parameters].empty? %>
|
51
|
-
<% parameter = command[:parameters].shift %>
|
52
|
-
<%= parameter[:name] %>: <%= h.snake_case(parameter[:name]) %><%= command[:parameters].empty? ? ')' : ',' %>
|
53
|
-
<% end %>
|
54
|
-
<% else %>
|
55
|
-
@devtools.send_cmd('<%= domain[:domain] %>.<%= command[:name] %>')
|
56
|
-
<% end %>
|
57
|
-
end
|
58
|
-
|
59
|
-
<% end %>
|
60
|
-
end # <%= domain[:domain] %>
|
61
|
-
end # <%= version %>
|
62
|
-
end # DevTools
|
63
|
-
end # Selenium
|
@@ -1,108 +0,0 @@
|
|
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 'erb'
|
21
|
-
require 'fileutils'
|
22
|
-
require 'json'
|
23
|
-
|
24
|
-
module Selenium
|
25
|
-
module WebDriver
|
26
|
-
module Support
|
27
|
-
class CDPClientGenerator
|
28
|
-
# Input JSON files are generated from PDL tasks.
|
29
|
-
TEMPLATE_PATH = File.expand_path('cdp/domain.rb.erb', __dir__)
|
30
|
-
|
31
|
-
RESERVED_KEYWORDS = %w[end].freeze
|
32
|
-
|
33
|
-
def call(output_dir:, version:, browser_protocol_path: nil, js_protocol_path: nil, loader_path: nil, **)
|
34
|
-
@template = ERB.new(File.read(TEMPLATE_PATH))
|
35
|
-
@output_dir = output_dir
|
36
|
-
@loader_path = loader_path || "#{@output_dir}.rb"
|
37
|
-
@version = version
|
38
|
-
|
39
|
-
browser_protocol_path ||= File.expand_path('cdp/browser_protocol.json', __dir__)
|
40
|
-
js_protocol_path ||= File.expand_path('cdp/js_protocol.json', __dir__)
|
41
|
-
|
42
|
-
browser_protocol = JSON.parse(File.read(browser_protocol_path), symbolize_names: true)
|
43
|
-
js_protocol = JSON.parse(File.read(js_protocol_path), symbolize_names: true)
|
44
|
-
|
45
|
-
FileUtils.mkdir_p(@output_dir)
|
46
|
-
|
47
|
-
browser_protocol[:domains].each(&method(:process_domain))
|
48
|
-
js_protocol[:domains].each(&method(:process_domain))
|
49
|
-
require_file
|
50
|
-
end
|
51
|
-
|
52
|
-
def process_domain(domain)
|
53
|
-
result = @template.result_with_hash(domain: domain, version: @version.upcase, h: self)
|
54
|
-
filename = File.join(@output_dir, "#{snake_case(domain[:domain])}.rb")
|
55
|
-
File.write(filename, remove_empty_lines(result))
|
56
|
-
end
|
57
|
-
|
58
|
-
def snake_case(string)
|
59
|
-
name = string.gsub('JavaScript', 'Javascript')
|
60
|
-
.gsub(/([A-Z]+)([A-Z][a-z]{2,})/, '\1_\2')
|
61
|
-
.gsub(/([a-z\d])([A-Z])/, '\1_\2')
|
62
|
-
.downcase
|
63
|
-
# Certain CDP parameters conflict with Ruby keywords
|
64
|
-
# so we prefix the name with underscore.
|
65
|
-
name = "_#{name}" if RESERVED_KEYWORDS.include?(name)
|
66
|
-
|
67
|
-
name
|
68
|
-
end
|
69
|
-
|
70
|
-
def kwargs(parameters)
|
71
|
-
parameters = parameters.map do |parameter|
|
72
|
-
if parameter[:optional]
|
73
|
-
"#{snake_case(parameter[:name])}: nil"
|
74
|
-
else
|
75
|
-
"#{snake_case(parameter[:name])}:"
|
76
|
-
end
|
77
|
-
end
|
78
|
-
parameters.join(', ')
|
79
|
-
end
|
80
|
-
|
81
|
-
def remove_empty_lines(string)
|
82
|
-
string.split("\n").reject { |l| l =~ /^\s+$/ }.join("\n")
|
83
|
-
end
|
84
|
-
|
85
|
-
def require_file
|
86
|
-
# rubocop:disable Lint/InterpolationCheck
|
87
|
-
dynamic_location = '#{File.dirname(File.absolute_path(__FILE__))}'
|
88
|
-
# rubocop:enable Lint/InterpolationCheck
|
89
|
-
|
90
|
-
require_all = "Dir.glob(\"#{dynamic_location}/#{@version}/*\", &method(:require))"
|
91
|
-
File.open(@loader_path, 'w') { |file| file.write(require_all) }
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
if $PROGRAM_NAME == __FILE__
|
99
|
-
browser_protocol_path, js_protocol_path, output_dir, loader_path, version = *ARGV
|
100
|
-
|
101
|
-
Selenium::WebDriver::Support::CDPClientGenerator.new.call(
|
102
|
-
browser_protocol_path: browser_protocol_path,
|
103
|
-
js_protocol_path: js_protocol_path,
|
104
|
-
output_dir: output_dir,
|
105
|
-
loader_path: loader_path,
|
106
|
-
version: version
|
107
|
-
)
|
108
|
-
end
|