From 0ac1ec97544b246db46c2f518b8f6ffb4b2bb04f Mon Sep 17 00:00:00 2001 From: aguspe Date: Sat, 2 Dec 2023 19:51:32 +0100 Subject: [PATCH 01/41] Add all the RBS files to add full rbs support to all selenium rb classes and modules --- rb/Steepfile | 11 ++ rb/lib/selenium/webdriver/common/manager.rb | 2 +- rb/rbs_collection.lock.yaml | 58 ++++++++-- rb/sig/lib/selenium/devtools.rbs | 14 +++ .../devtools/support/cdp_client_generator.rbs | 36 ++++++ rb/sig/lib/selenium/server.rbs | 80 +++++++++++++ rb/sig/lib/selenium/webdriver/bidi.rbs | 21 ++++ .../webdriver/bidi/browsing_context.rbs | 27 +++++ .../webdriver/bidi/browsing_context_info.rbs | 25 +++++ .../webdriver/bidi/log/base_log_entry.rbs | 25 +++++ .../webdriver/bidi/log/console_log_entry.rbs | 21 ++++ .../selenium/webdriver/bidi/log/filter_by.rbs | 15 +++ .../webdriver/bidi/log/generic_log_entry.rbs | 13 +++ .../bidi/log/javascript_log_entry.rbs | 13 +++ .../selenium/webdriver/bidi/log_inspector.rbs | 33 ++++++ .../webdriver/bidi/navigate_result.rbs | 17 +++ .../lib/selenium/webdriver/bidi/session.rbs | 19 ++++ .../lib/selenium/webdriver/chrome/driver.rbs | 17 +++ .../lib/selenium/webdriver/chrome/options.rbs | 17 +++ .../lib/selenium/webdriver/chrome/profile.rbs | 8 ++ .../lib/selenium/webdriver/chrome/service.rbs | 17 +++ .../selenium/webdriver/chromium/driver.rbs | 13 +++ .../selenium/webdriver/chromium/options.rbs | 53 +++++++++ .../selenium/webdriver/chromium/profile.rbs | 45 ++++++++ rb/sig/lib/selenium/webdriver/common.rbs | 0 .../lib/selenium/webdriver/common/alert.rbs | 17 +++ .../webdriver/common/child_process.rbs | 51 +++++++++ .../driver_extensions/downloads_files.rbs | 9 ++ .../full_page_screenshot.rbs | 13 +++ .../common/driver_extensions/has_addons.rbs | 11 ++ .../has_apple_permissions.rbs | 11 ++ .../driver_extensions/has_authentication.rbs | 17 +++ .../common/driver_extensions/has_bidi.rbs | 11 ++ .../common/driver_extensions/has_cdp.rbs | 9 ++ .../common/driver_extensions/has_context.rbs | 11 ++ .../common/driver_extensions/has_debugger.rbs | 9 ++ .../common/driver_extensions/has_devtools.rbs | 11 ++ .../driver_extensions/has_file_downloads.rbs | 17 +++ .../driver_extensions/has_log_events.rbs | 31 ++++++ .../common/driver_extensions/has_logs.rbs | 11 ++ .../has_network_conditions.rbs | 13 +++ .../has_network_interception.rbs | 11 ++ .../driver_extensions/has_permissions.rbs | 11 ++ .../driver_extensions/has_pinned_scripts.rbs | 15 +++ .../driver_extensions/has_session_id.rbs | 9 ++ .../driver_extensions/has_web_storage.rbs | 11 ++ .../common/driver_extensions/prints_page.rbs | 11 ++ .../driver_extensions/uploads_files.rbs | 9 ++ .../webdriver/common/driver_finder.rbs | 7 ++ .../lib/selenium/webdriver/common/error.rbs | 105 ++++++++++++++++++ .../selenium/webdriver/common/file_reaper.rbs | 21 ++++ .../webdriver/common/html5/local_storage.rbs | 28 +++++ .../common/html5/session_storage.rbs | 27 +++++ .../common/html5/shared_web_storage.rbs | 21 ++++ .../common/interactions/interactions.rbs | 27 +++++ .../common/interactions/none_input.rbs | 11 ++ .../webdriver/common/interactions/pause.rbs | 17 +++ .../common/interactions/pointer_cancel.rbs | 15 +++ .../interactions/pointer_event_properties.rbs | 15 +++ .../common/interactions/pointer_move.rbs | 33 ++++++ .../common/interactions/pointer_press.rbs | 33 ++++++ .../webdriver/common/interactions/scroll.rbs | 27 +++++ .../common/interactions/wheel_actions.rbs | 68 ++++++++++++ rb/sig/lib/selenium/webdriver/common/keys.rbs | 13 +++ .../webdriver/common/local_driver.rbs | 9 ++ .../selenium/webdriver/common/log_entry.rbs | 25 +++++ rb/sig/lib/selenium/webdriver/common/logs.rbs | 13 +++ .../lib/selenium/webdriver/common/manager.rbs | 18 +-- .../lib/selenium/webdriver/common/options.rbs | 59 ++++++++++ .../selenium/webdriver/common/platform.rbs | 60 ++++++++++ .../selenium/webdriver/common/port_prober.rbs | 11 ++ .../webdriver/common/profile_helper.rbs | 25 +++++ .../lib/selenium/webdriver/common/proxy.rbs | 65 +++++++++++ .../webdriver/common/selenium_manager.rbs | 33 ++++++ .../lib/selenium/webdriver/common/service.rbs | 55 +++++++++ .../webdriver/common/service_manager.rbs | 67 +++++++++++ .../selenium/webdriver/common/socket_lock.rbs | 27 +++++ .../webdriver/common/socket_poller.rbs | 39 +++++++ .../virtual_authenticator/credential.rbs | 45 ++++++++ .../virtual_authenticator_options.rbs | 45 ++++++++ rb/sig/lib/selenium/webdriver/common/wait.rbs | 25 +++++ .../webdriver/common/websocket_connection.rbs | 68 ++++++++++++ .../lib/selenium/webdriver/common/zipper.rbs | 19 ++++ rb/sig/lib/selenium/webdriver/devtools.rbs | 27 +++++ .../webdriver/devtools/console_event.rbs | 21 ++++ .../webdriver/devtools/exception_event.rbs | 21 ++++ .../webdriver/devtools/mutation_event.rbs | 25 +++++ .../devtools/network_interceptor.rbs | 67 +++++++++++ .../webdriver/devtools/pinned_script.rbs | 25 +++++ .../selenium/webdriver/devtools/request.rbs | 35 ++++++ rb/sig/lib/selenium/webdriver/edge/driver.rbs | 17 +++ .../lib/selenium/webdriver/edge/options.rbs | 19 ++++ .../lib/selenium/webdriver/edge/profile.rbs | 8 ++ .../lib/selenium/webdriver/edge/service.rbs | 17 +++ .../lib/selenium/webdriver/firefox/driver.rbs | 21 ++++ .../selenium/webdriver/firefox/extension.rbs | 31 ++++++ .../selenium/webdriver/firefox/options.rbs | 45 ++++++++ .../selenium/webdriver/firefox/profile.rbs | 75 +++++++++++++ .../webdriver/firefox/profiles_ini.rbs | 24 ++++ .../selenium/webdriver/firefox/service.rbs | 13 +++ .../lib/selenium/webdriver/firefox/util.rbs | 12 ++ rb/sig/lib/selenium/webdriver/ie.rbs | 6 + rb/sig/lib/selenium/webdriver/ie/driver.rbs | 15 +++ rb/sig/lib/selenium/webdriver/ie/features.rbs | 11 ++ rb/sig/lib/selenium/webdriver/ie/options.rbs | 29 +++++ rb/sig/lib/selenium/webdriver/ie/service.rbs | 13 +++ .../webdriver/remote/bridge/commands.rbs | 9 ++ .../webdriver/remote/capabilities.rbs | 71 ++++++++++++ .../lib/selenium/webdriver/remote/driver.rbs | 25 +++++ .../selenium/webdriver/remote/features.rbs | 27 +++++ .../selenium/webdriver/remote/http/common.rbs | 31 ++++++ .../selenium/webdriver/remote/http/curb.rbs | 19 ++++ .../webdriver/remote/http/default.rbs | 53 +++++++++ .../webdriver/remote/server_error.rbs | 9 ++ .../lib/selenium/webdriver/safari/driver.rbs | 15 +++ .../lib/selenium/webdriver/safari/options.rbs | 18 +++ .../lib/selenium/webdriver/safari/service.rbs | 17 +++ rb/sig/lib/selenium/webdriver/support.rbs | 0 .../support/block_event_listener.rbs | 13 +++ .../lib/selenium/webdriver/support/color.rbs | 59 ++++++++++ .../selenium/webdriver/support/escaper.rbs | 9 ++ .../webdriver/support/event_firing_bridge.rbs | 47 ++++++++ .../lib/selenium/webdriver/support/guards.rbs | 41 +++++++ .../webdriver/support/guards/guard.rbs | 44 ++++++++ .../support/guards/guard_condition.rbs | 21 ++++ .../webdriver/support/relative_locator.rbs | 17 +++ .../lib/selenium/webdriver/support/select.rbs | 57 ++++++++++ rb/sig/lib/selenium/webdriver/version.rbs | 5 + rb/sig/lib/selenium_webdriver.rbs | 0 129 files changed, 3271 insertions(+), 18 deletions(-) create mode 100644 rb/sig/lib/selenium/devtools.rbs create mode 100644 rb/sig/lib/selenium/devtools/support/cdp_client_generator.rbs create mode 100644 rb/sig/lib/selenium/server.rbs create mode 100644 rb/sig/lib/selenium/webdriver/bidi.rbs create mode 100644 rb/sig/lib/selenium/webdriver/bidi/browsing_context.rbs create mode 100644 rb/sig/lib/selenium/webdriver/bidi/browsing_context_info.rbs create mode 100644 rb/sig/lib/selenium/webdriver/bidi/log/base_log_entry.rbs create mode 100644 rb/sig/lib/selenium/webdriver/bidi/log/console_log_entry.rbs create mode 100644 rb/sig/lib/selenium/webdriver/bidi/log/filter_by.rbs create mode 100644 rb/sig/lib/selenium/webdriver/bidi/log/generic_log_entry.rbs create mode 100644 rb/sig/lib/selenium/webdriver/bidi/log/javascript_log_entry.rbs create mode 100644 rb/sig/lib/selenium/webdriver/bidi/log_inspector.rbs create mode 100644 rb/sig/lib/selenium/webdriver/bidi/navigate_result.rbs create mode 100644 rb/sig/lib/selenium/webdriver/bidi/session.rbs create mode 100644 rb/sig/lib/selenium/webdriver/chrome/driver.rbs create mode 100644 rb/sig/lib/selenium/webdriver/chrome/options.rbs create mode 100644 rb/sig/lib/selenium/webdriver/chrome/profile.rbs create mode 100644 rb/sig/lib/selenium/webdriver/chrome/service.rbs create mode 100644 rb/sig/lib/selenium/webdriver/chromium/driver.rbs create mode 100644 rb/sig/lib/selenium/webdriver/chromium/options.rbs create mode 100644 rb/sig/lib/selenium/webdriver/chromium/profile.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/alert.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/child_process.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/driver_extensions/downloads_files.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/driver_extensions/full_page_screenshot.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/driver_extensions/has_addons.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/driver_extensions/has_apple_permissions.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/driver_extensions/has_authentication.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/driver_extensions/has_bidi.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/driver_extensions/has_cdp.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/driver_extensions/has_context.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/driver_extensions/has_debugger.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/driver_extensions/has_devtools.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/driver_extensions/has_file_downloads.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/driver_extensions/has_log_events.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/driver_extensions/has_logs.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/driver_extensions/has_network_conditions.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/driver_extensions/has_network_interception.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/driver_extensions/has_permissions.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/driver_extensions/has_pinned_scripts.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/driver_extensions/has_session_id.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/driver_extensions/has_web_storage.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/driver_extensions/prints_page.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/driver_extensions/uploads_files.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/driver_finder.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/error.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/file_reaper.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/html5/local_storage.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/html5/session_storage.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/html5/shared_web_storage.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/interactions/interactions.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/interactions/none_input.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/interactions/pause.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/interactions/pointer_cancel.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/interactions/pointer_event_properties.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/interactions/pointer_move.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/interactions/pointer_press.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/interactions/scroll.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/interactions/wheel_actions.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/keys.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/local_driver.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/log_entry.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/logs.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/options.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/platform.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/port_prober.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/profile_helper.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/proxy.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/selenium_manager.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/service.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/service_manager.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/socket_lock.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/socket_poller.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/virtual_authenticator/credential.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/virtual_authenticator/virtual_authenticator_options.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/wait.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/websocket_connection.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/zipper.rbs create mode 100644 rb/sig/lib/selenium/webdriver/devtools.rbs create mode 100644 rb/sig/lib/selenium/webdriver/devtools/console_event.rbs create mode 100644 rb/sig/lib/selenium/webdriver/devtools/exception_event.rbs create mode 100644 rb/sig/lib/selenium/webdriver/devtools/mutation_event.rbs create mode 100644 rb/sig/lib/selenium/webdriver/devtools/network_interceptor.rbs create mode 100644 rb/sig/lib/selenium/webdriver/devtools/pinned_script.rbs create mode 100644 rb/sig/lib/selenium/webdriver/devtools/request.rbs create mode 100644 rb/sig/lib/selenium/webdriver/edge/driver.rbs create mode 100644 rb/sig/lib/selenium/webdriver/edge/options.rbs create mode 100644 rb/sig/lib/selenium/webdriver/edge/profile.rbs create mode 100644 rb/sig/lib/selenium/webdriver/edge/service.rbs create mode 100644 rb/sig/lib/selenium/webdriver/firefox/driver.rbs create mode 100644 rb/sig/lib/selenium/webdriver/firefox/extension.rbs create mode 100644 rb/sig/lib/selenium/webdriver/firefox/options.rbs create mode 100644 rb/sig/lib/selenium/webdriver/firefox/profile.rbs create mode 100644 rb/sig/lib/selenium/webdriver/firefox/profiles_ini.rbs create mode 100644 rb/sig/lib/selenium/webdriver/firefox/service.rbs create mode 100644 rb/sig/lib/selenium/webdriver/firefox/util.rbs create mode 100644 rb/sig/lib/selenium/webdriver/ie.rbs create mode 100644 rb/sig/lib/selenium/webdriver/ie/driver.rbs create mode 100644 rb/sig/lib/selenium/webdriver/ie/features.rbs create mode 100644 rb/sig/lib/selenium/webdriver/ie/options.rbs create mode 100644 rb/sig/lib/selenium/webdriver/ie/service.rbs create mode 100644 rb/sig/lib/selenium/webdriver/remote/bridge/commands.rbs create mode 100644 rb/sig/lib/selenium/webdriver/remote/capabilities.rbs create mode 100644 rb/sig/lib/selenium/webdriver/remote/driver.rbs create mode 100644 rb/sig/lib/selenium/webdriver/remote/features.rbs create mode 100644 rb/sig/lib/selenium/webdriver/remote/http/common.rbs create mode 100644 rb/sig/lib/selenium/webdriver/remote/http/curb.rbs create mode 100644 rb/sig/lib/selenium/webdriver/remote/http/default.rbs create mode 100644 rb/sig/lib/selenium/webdriver/remote/server_error.rbs create mode 100644 rb/sig/lib/selenium/webdriver/safari/driver.rbs create mode 100644 rb/sig/lib/selenium/webdriver/safari/options.rbs create mode 100644 rb/sig/lib/selenium/webdriver/safari/service.rbs create mode 100644 rb/sig/lib/selenium/webdriver/support.rbs create mode 100644 rb/sig/lib/selenium/webdriver/support/block_event_listener.rbs create mode 100644 rb/sig/lib/selenium/webdriver/support/color.rbs create mode 100644 rb/sig/lib/selenium/webdriver/support/escaper.rbs create mode 100644 rb/sig/lib/selenium/webdriver/support/event_firing_bridge.rbs create mode 100644 rb/sig/lib/selenium/webdriver/support/guards.rbs create mode 100644 rb/sig/lib/selenium/webdriver/support/guards/guard.rbs create mode 100644 rb/sig/lib/selenium/webdriver/support/guards/guard_condition.rbs create mode 100644 rb/sig/lib/selenium/webdriver/support/relative_locator.rbs create mode 100644 rb/sig/lib/selenium/webdriver/support/select.rbs create mode 100644 rb/sig/lib/selenium/webdriver/version.rbs create mode 100644 rb/sig/lib/selenium_webdriver.rbs diff --git a/rb/Steepfile b/rb/Steepfile index df470e013c4fa..cd3f3312874c7 100644 --- a/rb/Steepfile +++ b/rb/Steepfile @@ -1,4 +1,15 @@ target :lib do signature 'sig' # Signature directory check 'lib' # Directory name + + library( + 'base64', + 'date', + 'erb', + 'forwardable', + 'ipaddr', + 'net-http', + 'openssl', + 'uri', + 'securerandom') # Standard libraries used end diff --git a/rb/lib/selenium/webdriver/common/manager.rb b/rb/lib/selenium/webdriver/common/manager.rb index a018b30cf07f5..6ba94fca8d829 100644 --- a/rb/lib/selenium/webdriver/common/manager.rb +++ b/rb/lib/selenium/webdriver/common/manager.rb @@ -56,7 +56,7 @@ def add_cookie(opts = {}) opts[:httpOnly] = http_only if http_only obj = opts.delete(:expires) - opts[:expiry] = seconds_from(obj).to_i if obj + opts[:expiry] = seconds_from(obj).to_int if obj @bridge.add_cookie opts end diff --git a/rb/rbs_collection.lock.yaml b/rb/rbs_collection.lock.yaml index e0f5305ca074a..f581d00b0d6eb 100644 --- a/rb/rbs_collection.lock.yaml +++ b/rb/rbs_collection.lock.yaml @@ -1,12 +1,14 @@ --- -sources: -- type: git - name: ruby/gem_rbs_collection - revision: 8149bc3fc0f720d935dc0592dc8886e03052f65f - remote: https://github.com/ruby/gem_rbs_collection.git - repo_dir: gems path: ".gem_rbs_collection" gems: +- name: addressable + version: '2.8' + source: + type: git + name: ruby/gem_rbs_collection + revision: 4b0d2f72e63b6c3e92dc54e19ce23dd24524f9a7 + remote: https://github.com/ruby/gem_rbs_collection.git + repo_dir: gems - name: ast version: '2.4' source: @@ -15,11 +17,11 @@ gems: revision: 8149bc3fc0f720d935dc0592dc8886e03052f65f remote: https://github.com/ruby/gem_rbs_collection.git repo_dir: gems -- name: base64 +- name: cgi version: '0' source: type: stdlib -- name: cgi +- name: fileutils version: '0' source: type: stdlib @@ -47,6 +49,14 @@ gems: revision: 8149bc3fc0f720d935dc0592dc8886e03052f65f remote: https://github.com/ruby/gem_rbs_collection.git repo_dir: gems +- name: parser + version: '3.2' + source: + type: git + name: ruby/gem_rbs_collection + revision: 4b0d2f72e63b6c3e92dc54e19ce23dd24524f9a7 + remote: https://github.com/ruby/gem_rbs_collection.git + repo_dir: gems - name: rack version: '2.2' source: @@ -63,6 +73,38 @@ gems: revision: 8149bc3fc0f720d935dc0592dc8886e03052f65f remote: https://github.com/ruby/gem_rbs_collection.git repo_dir: gems +- name: rake + version: '13.0' + source: + type: git + name: ruby/gem_rbs_collection + revision: 4b0d2f72e63b6c3e92dc54e19ce23dd24524f9a7 + remote: https://github.com/ruby/gem_rbs_collection.git + repo_dir: gems +- name: regexp_parser + version: '2.8' + source: + type: git + name: ruby/gem_rbs_collection + revision: 4b0d2f72e63b6c3e92dc54e19ce23dd24524f9a7 + remote: https://github.com/ruby/gem_rbs_collection.git + repo_dir: gems +- name: rubocop + version: '1.57' + source: + type: git + name: ruby/gem_rbs_collection + revision: 4b0d2f72e63b6c3e92dc54e19ce23dd24524f9a7 + remote: https://github.com/ruby/gem_rbs_collection.git + repo_dir: gems +- name: rubocop-ast + version: '1.30' + source: + type: git + name: ruby/gem_rbs_collection + revision: 4b0d2f72e63b6c3e92dc54e19ce23dd24524f9a7 + remote: https://github.com/ruby/gem_rbs_collection.git + repo_dir: gems - name: tempfile version: '0' source: diff --git a/rb/sig/lib/selenium/devtools.rbs b/rb/sig/lib/selenium/devtools.rbs new file mode 100644 index 0000000000000..0110a6ca515cf --- /dev/null +++ b/rb/sig/lib/selenium/devtools.rbs @@ -0,0 +1,14 @@ +module Selenium + module DevTools + attr_accessor self.version: untyped + + def self.load_version: () -> untyped + + private + + # Try to load up to 2 versions back + def self.load_older_version: () -> untyped + + def self.load_old_version: (untyped version) -> untyped + end +end diff --git a/rb/sig/lib/selenium/devtools/support/cdp_client_generator.rbs b/rb/sig/lib/selenium/devtools/support/cdp_client_generator.rbs new file mode 100644 index 0000000000000..dfe1efe214b42 --- /dev/null +++ b/rb/sig/lib/selenium/devtools/support/cdp_client_generator.rbs @@ -0,0 +1,36 @@ +module Selenium + module DevTools + module Support + class CDPClientGenerator + @domain_template: untyped + + @loader_template: untyped + + @output_dir: untyped + + @loader_path: untyped + + @version: untyped + + # Input JSON files are generated from PDL tasks. + DOMAIN_TEMPLATE_PATH: untyped + + LOADER_TEMPLATE_PATH: untyped + + RESERVED_KEYWORDS: ::Array["end"] + + def call: (output_dir: untyped, version: untyped, **untyped opts) -> untyped + + def process_domain: (untyped domain) -> untyped + + def snake_case: (untyped string) -> untyped + + def kwargs: (untyped parameters) -> untyped + + def remove_empty_lines: (untyped string) -> untyped + + def process_loader: (untyped domains) -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/server.rbs b/rb/sig/lib/selenium/server.rbs new file mode 100644 index 0000000000000..e97d08163389a --- /dev/null +++ b/rb/sig/lib/selenium/server.rbs @@ -0,0 +1,80 @@ +module Selenium + class Server + self.@latest: untyped + + self.@available_assets: untyped + + @jar: untyped + + @host: untyped + + @role: untyped + + @port: untyped + + @timeout: untyped + + @background: untyped + + @additional_args: untyped + + @log: untyped + + @log_file: untyped + + @process: untyped + + @socket: untyped + + class Error < StandardError + end + + CL_RESET: untyped + + def self.get: (?::Symbol required_version, ?::Hash[untyped, untyped] opts) -> untyped + + def self.download: (?::Symbol required_version) -> untyped + + def self.latest: () -> untyped + + def self.available_assets: () -> untyped + + def self.net_http_start: (untyped address) { () -> untyped } -> untyped + + def self.download_server: (untyped uri, untyped destination) -> untyped + + attr_accessor role: untyped + + attr_accessor host: untyped + + attr_accessor port: untyped + + attr_accessor timeout: untyped + + attr_accessor background: untyped + + attr_accessor log: untyped + + def initialize: (untyped jar, ?::Hash[untyped, untyped] opts) -> void + + def start: () -> untyped + + def stop: () -> untyped + + def webdriver_url: () -> ::String + + def <<: (untyped arg) -> untyped + + private + + def stop_process: () -> untyped + + def process: () -> untyped + + def poll_for_service: () -> (nil | untyped) + + def poll_for_shutdown: () -> (nil | untyped) + + def socket: () -> untyped + end +end diff --git a/rb/sig/lib/selenium/webdriver/bidi.rbs b/rb/sig/lib/selenium/webdriver/bidi.rbs new file mode 100644 index 0000000000000..e37040f4d9061 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/bidi.rbs @@ -0,0 +1,21 @@ +module Selenium + module WebDriver + class BiDi + @ws: untyped + + @session: untyped + + def initialize: (url: untyped) -> void + + def close: () -> untyped + + def callbacks: () -> untyped + + def session: () -> untyped + + def send_cmd: (untyped method, **untyped params) -> untyped + + def error_message: (untyped message) -> ::String + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/bidi/browsing_context.rbs b/rb/sig/lib/selenium/webdriver/bidi/browsing_context.rbs new file mode 100644 index 0000000000000..c03ce4e37a198 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/bidi/browsing_context.rbs @@ -0,0 +1,27 @@ +module Selenium + module WebDriver + class BiDi + class BrowsingContext + @bidi: untyped + + @id: untyped + + attr_accessor id: untyped + + READINESS_STATE: { none: "none", interactive: "interactive", complete: "complete" } + + def initialize: (driver: untyped, ?browsing_context_id: untyped?, ?type: untyped?, ?reference_context: untyped?) -> void + + def navigate: (url: untyped, ?readiness_state: untyped?) -> untyped + + def get_tree: (?max_depth: untyped?) -> untyped + + def close: () -> untyped + + private + + def create: (untyped type, untyped reference_context) -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/bidi/browsing_context_info.rbs b/rb/sig/lib/selenium/webdriver/bidi/browsing_context_info.rbs new file mode 100644 index 0000000000000..1e0d12140f7ad --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/bidi/browsing_context_info.rbs @@ -0,0 +1,25 @@ +module Selenium + module WebDriver + class BiDi + class BrowsingContextInfo + @id: untyped + + @url: untyped + + @children: untyped + + @parent_browsing_context: untyped + + attr_accessor id: untyped + + attr_accessor url: untyped + + attr_accessor children: untyped + + attr_accessor parent_browsing_context: untyped + + def initialize: (id: untyped, url: untyped, children: untyped, parent_context: untyped) -> void + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/bidi/log/base_log_entry.rbs b/rb/sig/lib/selenium/webdriver/bidi/log/base_log_entry.rbs new file mode 100644 index 0000000000000..b68966f0d8102 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/bidi/log/base_log_entry.rbs @@ -0,0 +1,25 @@ +module Selenium + module WebDriver + class BiDi + class BaseLogEntry + @level: untyped + + @text: untyped + + @timestamp: untyped + + @stack_trace: untyped + + attr_accessor level: untyped + + attr_accessor text: untyped + + attr_accessor timestamp: untyped + + attr_accessor stack_trace: untyped + + def initialize: (level: untyped, text: untyped, timestamp: untyped, stack_trace: untyped) -> void + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/bidi/log/console_log_entry.rbs b/rb/sig/lib/selenium/webdriver/bidi/log/console_log_entry.rbs new file mode 100644 index 0000000000000..b0b1ca11d80b4 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/bidi/log/console_log_entry.rbs @@ -0,0 +1,21 @@ +module Selenium + module WebDriver + class BiDi + class ConsoleLogEntry < GenericLogEntry + @method: untyped + + @realm: untyped + + @args: untyped + + attr_accessor method: untyped + + attr_accessor realm: untyped + + attr_accessor args: untyped + + def initialize: (method: untyped, realm: untyped, args: untyped, **untyped opts) -> void + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/bidi/log/filter_by.rbs b/rb/sig/lib/selenium/webdriver/bidi/log/filter_by.rbs new file mode 100644 index 0000000000000..3937dd37c60f2 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/bidi/log/filter_by.rbs @@ -0,0 +1,15 @@ +module Selenium + module WebDriver + class BiDi + class FilterBy + @level: untyped + + attr_accessor level: untyped + + def initialize: (untyped level) -> void + + def self.log_level: (?untyped? level) -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/bidi/log/generic_log_entry.rbs b/rb/sig/lib/selenium/webdriver/bidi/log/generic_log_entry.rbs new file mode 100644 index 0000000000000..71c98b0215e6b --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/bidi/log/generic_log_entry.rbs @@ -0,0 +1,13 @@ +module Selenium + module WebDriver + class BiDi + class GenericLogEntry < BaseLogEntry + @type: untyped + + attr_accessor type: untyped + + def initialize: (level: untyped, text: untyped, timestamp: untyped, type: untyped, stack_trace: untyped) -> void + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/bidi/log/javascript_log_entry.rbs b/rb/sig/lib/selenium/webdriver/bidi/log/javascript_log_entry.rbs new file mode 100644 index 0000000000000..fdb88b70b5a56 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/bidi/log/javascript_log_entry.rbs @@ -0,0 +1,13 @@ +module Selenium + module WebDriver + class BiDi + class JavascriptLogEntry < GenericLogEntry + @type: untyped + + attr_accessor type: untyped + + def initialize: (level: untyped, text: untyped, timestamp: untyped, type: untyped, stack_trace: untyped) -> void + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/bidi/log_inspector.rbs b/rb/sig/lib/selenium/webdriver/bidi/log_inspector.rbs new file mode 100644 index 0000000000000..16ed800a09be3 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/bidi/log_inspector.rbs @@ -0,0 +1,33 @@ +module Selenium + module WebDriver + class BiDi + class LogInspector + @bidi: untyped + + EVENTS: { entry_added: "entryAdded" } + + LOG_LEVEL: { DEBUG: "debug", ERROR: "error", INFO: "info", WARNING: "warning" } + + def initialize: (untyped driver, ?untyped? browsing_context_ids) -> void + + def on_console_entry: (?untyped? filter_by) { () -> untyped } -> untyped + + def on_javascript_log: (?untyped? filter_by) { () -> untyped } -> untyped + + def on_javascript_exception: () { () -> untyped } -> untyped + + def on_log: (?untyped? filter_by) { (untyped) -> untyped } -> (nil | untyped) + + private + + def on: (untyped event) { () -> untyped } -> untyped + + def check_valid_filter: (untyped filter_by) -> (nil | untyped) + + def console_log_events: (untyped params, untyped filter_by) { (untyped) -> untyped } -> (nil | untyped) + + def javascript_log_events: (untyped params, untyped filter_by) { (untyped) -> untyped } -> (nil | untyped) + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/bidi/navigate_result.rbs b/rb/sig/lib/selenium/webdriver/bidi/navigate_result.rbs new file mode 100644 index 0000000000000..54b4737e81c7c --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/bidi/navigate_result.rbs @@ -0,0 +1,17 @@ +module Selenium + module WebDriver + class BiDi + class NavigateResult + @url: untyped + + @navigation_id: untyped + + attr_accessor url: untyped + + attr_accessor navigation_id: untyped + + def initialize: (url: untyped, navigation_id: untyped) -> void + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/bidi/session.rbs b/rb/sig/lib/selenium/webdriver/bidi/session.rbs new file mode 100644 index 0000000000000..99b94c52afd5b --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/bidi/session.rbs @@ -0,0 +1,19 @@ +module Selenium + module WebDriver + class BiDi + class Session + @bidi: untyped + + Status: untyped + + def initialize: (untyped bidi) -> void + + def status: () -> untyped + + def subscribe: (untyped events, ?untyped? browsing_contexts) -> untyped + + def unsubscribe: (untyped events, ?untyped? browsing_contexts) -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/chrome/driver.rbs b/rb/sig/lib/selenium/webdriver/chrome/driver.rbs new file mode 100644 index 0000000000000..49d1c53af9030 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/chrome/driver.rbs @@ -0,0 +1,17 @@ +module Selenium + module WebDriver + module Chrome + class Driver < Chromium::Driver + include LocalDriver + + def initialize: (?options: untyped?, ?service: untyped?, ?url: untyped?, **untyped opts) -> void + + def browser: () -> :chrome + + private + + def devtools_address: () -> ::String + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/chrome/options.rbs b/rb/sig/lib/selenium/webdriver/chrome/options.rbs new file mode 100644 index 0000000000000..281d33ea09135 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/chrome/options.rbs @@ -0,0 +1,17 @@ +module Selenium + module WebDriver + module Chrome + class Options < Chromium::Options + KEY: "goog:chromeOptions" + + BROWSER: "chrome" + + private + + def enable_logging: (untyped browser_options) -> untyped + + def binary_path: () -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/chrome/profile.rbs b/rb/sig/lib/selenium/webdriver/chrome/profile.rbs new file mode 100644 index 0000000000000..d5b2e2cff8736 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/chrome/profile.rbs @@ -0,0 +1,8 @@ +module Selenium + module WebDriver + module Chrome + class Profile < Chromium::Profile + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/chrome/service.rbs b/rb/sig/lib/selenium/webdriver/chrome/service.rbs new file mode 100644 index 0000000000000..93850710820b6 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/chrome/service.rbs @@ -0,0 +1,17 @@ +module Selenium + module WebDriver + module Chrome + class Service < WebDriver::Service + @log: untyped + + DEFAULT_PORT: 9515 + + EXECUTABLE: "chromedriver" + + SHUTDOWN_SUPPORTED: true + + def log: () -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/chromium/driver.rbs b/rb/sig/lib/selenium/webdriver/chromium/driver.rbs new file mode 100644 index 0000000000000..3d4c34c7ed4b3 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/chromium/driver.rbs @@ -0,0 +1,13 @@ +module Selenium + module WebDriver + module Chromium + class Driver < WebDriver::Driver + EXTENSIONS: ::Array[untyped] + + def devtools_url: () -> untyped + + def devtools_version: () -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/chromium/options.rbs b/rb/sig/lib/selenium/webdriver/chromium/options.rbs new file mode 100644 index 0000000000000..6d7ca4947013f --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/chromium/options.rbs @@ -0,0 +1,53 @@ +module Selenium + module WebDriver + module Chromium + class Options < WebDriver::Options + @profile: untyped + + @options: untyped + + @logging_prefs: untyped + + @encoded_extensions: untyped + + @extensions: untyped + + attr_accessor profile: untyped + + attr_accessor logging_prefs: untyped + + # see: http://chromedriver.chromium.org/capabilities + CAPABILITIES: { args: "args", binary: "binary", local_state: "localState", prefs: "prefs", detach: "detach", debugger_address: "debuggerAddress", exclude_switches: "excludeSwitches", minidump_path: "minidumpPath", emulation: "mobileEmulation", perf_logging_prefs: "perfLoggingPrefs", window_types: "windowTypes", android_package: "androidPackage", android_activity: "androidActivity", android_device_serial: "androidDeviceSerial", android_use_running_app: "androidUseRunningApp" } + + # NOTE: special handling of 'extensions' to validate when set instead of when used + attr_reader extensions: untyped + + def initialize: (?profile: untyped?, **untyped opts) -> void + + def add_extension: (untyped path) -> untyped + + def extensions=: (untyped extensions) -> untyped + + def add_encoded_extension: (untyped encoded) -> untyped + + def add_argument: (untyped arg) -> untyped + + def add_preference: (untyped name, untyped value) -> untyped + + def add_emulation: (**untyped opts) -> untyped + + def enable_android: (?package: ::String, ?serial_number: untyped?, ?use_running_app: untyped?, ?activity: untyped?) -> untyped + + def process_browser_options: (untyped browser_options) -> (nil | untyped) + + def binary_path: () -> untyped + + def encode_extension: (untyped path) -> untyped + + def validate_extension: (untyped path) -> untyped + + def camelize?: (untyped key) -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/chromium/profile.rbs b/rb/sig/lib/selenium/webdriver/chromium/profile.rbs new file mode 100644 index 0000000000000..b76512c7fa251 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/chromium/profile.rbs @@ -0,0 +1,45 @@ +module Selenium + module WebDriver + module Chromium + class Profile + @model: untyped + + @extensions: untyped + + @encoded_extensions: untyped + + @directory: untyped + + @prefs: untyped + + include ProfileHelper + + def initialize: (?untyped? model) -> void + + def add_extension: (untyped path) -> untyped + + def add_encoded_extension: (untyped encoded) -> untyped + + def directory: () -> untyped + + def []=: (untyped key, untyped value) -> untyped + + def []: (untyped key) -> untyped + + def layout_on_disk: () -> untyped + + def as_json: (*untyped) -> untyped + + private + + def write_prefs_to: (untyped dir) -> untyped + + def prefs: () -> untyped + + def read_model_prefs: () -> (::Hash[untyped, untyped] | untyped) + + def prefs_file_for: (untyped dir) -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common.rbs b/rb/sig/lib/selenium/webdriver/common.rbs new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/rb/sig/lib/selenium/webdriver/common/alert.rbs b/rb/sig/lib/selenium/webdriver/common/alert.rbs new file mode 100644 index 0000000000000..8c39da43f026c --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/alert.rbs @@ -0,0 +1,17 @@ +module Selenium + module WebDriver + class Alert + @bridge: untyped + + def initialize: (untyped bridge) -> void + + def accept: () -> untyped + + def dismiss: () -> untyped + + def send_keys: (untyped keys) -> untyped + + def text: () -> untyped + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/child_process.rbs b/rb/sig/lib/selenium/webdriver/common/child_process.rbs new file mode 100644 index 0000000000000..5240914702b9b --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/child_process.rbs @@ -0,0 +1,51 @@ +module Selenium + module WebDriver + class ChildProcess + @command: untyped + + @detach: untyped + + @pid: untyped + + @status: untyped + + @io: untyped + + TimeoutError: untyped + + SIGTERM: "TERM" + + SIGKILL: "KILL" + + POLL_INTERVAL: ::Float + + attr_accessor detach: untyped + + attr_writer io: untyped + + def self.build: (*untyped command) -> untyped + + def initialize: (*untyped command) -> void + + def io: () -> untyped + + def start: () -> untyped + + def stop: (?::Integer timeout) -> untyped + + def alive?: () -> untyped + + def exited?: () -> (false | untyped) + + def poll_for_exit: (untyped timeout) -> untyped + + def wait: () -> (nil | untyped) + + private + + def terminate: (untyped pid) -> untyped + + def kill: (untyped pid) -> untyped + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/driver_extensions/downloads_files.rbs b/rb/sig/lib/selenium/webdriver/common/driver_extensions/downloads_files.rbs new file mode 100644 index 0000000000000..6490820f43a88 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/driver_extensions/downloads_files.rbs @@ -0,0 +1,9 @@ +module Selenium + module WebDriver + module DriverExtensions + module DownloadsFiles + def download_path=: (untyped path) -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/driver_extensions/full_page_screenshot.rbs b/rb/sig/lib/selenium/webdriver/common/driver_extensions/full_page_screenshot.rbs new file mode 100644 index 0000000000000..df392d0446f9d --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/driver_extensions/full_page_screenshot.rbs @@ -0,0 +1,13 @@ +module Selenium + module WebDriver + module DriverExtensions + module FullPageScreenshot + def save_full_page_screenshot: (untyped path) -> untyped + + private + + def full_screenshot: () -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_addons.rbs b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_addons.rbs new file mode 100644 index 0000000000000..667618c91b798 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_addons.rbs @@ -0,0 +1,11 @@ +module Selenium + module WebDriver + module DriverExtensions + module HasAddons + def install_addon: (untyped path, ?untyped? temporary) -> untyped + + def uninstall_addon: (untyped id) -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_apple_permissions.rbs b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_apple_permissions.rbs new file mode 100644 index 0000000000000..8d6bf51643e4c --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_apple_permissions.rbs @@ -0,0 +1,11 @@ +module Selenium + module WebDriver + module DriverExtensions + module HasApplePermissions + def permissions: () -> untyped + + def permissions=: (untyped permissions) -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_authentication.rbs b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_authentication.rbs new file mode 100644 index 0000000000000..82c3643feb59d --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_authentication.rbs @@ -0,0 +1,17 @@ +module Selenium + module WebDriver + module DriverExtensions + module HasAuthentication + @auth_handlers: untyped + + def register: (username: untyped, password: untyped, ?uri: untyped) -> untyped + + private + + def auth_handlers: () -> untyped + + def authenticate: (untyped request_id, untyped url) -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_bidi.rbs b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_bidi.rbs new file mode 100644 index 0000000000000..704b8e740c70a --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_bidi.rbs @@ -0,0 +1,11 @@ +module Selenium + module WebDriver + module DriverExtensions + module HasBiDi + @bidi: untyped + + def bidi: () -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_cdp.rbs b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_cdp.rbs new file mode 100644 index 0000000000000..ab2b148f55a91 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_cdp.rbs @@ -0,0 +1,9 @@ +module Selenium + module WebDriver + module DriverExtensions + module HasCDP + def execute_cdp: (untyped cmd, **untyped params) -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_context.rbs b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_context.rbs new file mode 100644 index 0000000000000..deb8d8b60be2e --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_context.rbs @@ -0,0 +1,11 @@ +module Selenium + module WebDriver + module DriverExtensions + module HasContext + def context=: (untyped value) -> untyped + + def context: () -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_debugger.rbs b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_debugger.rbs new file mode 100644 index 0000000000000..7539fa6849648 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_debugger.rbs @@ -0,0 +1,9 @@ +module Selenium + module WebDriver + module DriverExtensions + module HasDebugger + def attach_debugger: () -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_devtools.rbs b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_devtools.rbs new file mode 100644 index 0000000000000..d48a27d95ad2c --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_devtools.rbs @@ -0,0 +1,11 @@ +module Selenium + module WebDriver + module DriverExtensions + module HasDevTools + @devtools: untyped + + def devtools: () -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_file_downloads.rbs b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_file_downloads.rbs new file mode 100644 index 0000000000000..d4b191d59cb87 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_file_downloads.rbs @@ -0,0 +1,17 @@ +module Selenium + module WebDriver + module DriverExtensions + module HasFileDownloads + def downloadable_files: () -> untyped + + def download_file: (untyped file_name, untyped target_directory) -> untyped + + def delete_downloadable_files: () -> untyped + + private + + def verify_enabled: () -> (nil | untyped) + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_log_events.rbs b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_log_events.rbs new file mode 100644 index 0000000000000..6dce99c4d8121 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_log_events.rbs @@ -0,0 +1,31 @@ +module Selenium + module WebDriver + module DriverExtensions + module HasLogEvents + @log_listeners: untyped + + @mutation_listener: untyped + + include Atoms + + KINDS: ::Array[:console | :exception | :mutation] + + def on_log_event: (untyped kind) { () -> untyped } -> (nil | untyped) + + private + + def log_listeners: () -> untyped + + def log_console_events: () -> untyped + + def log_exception_events: () -> untyped + + def log_mutation_events: () -> untyped + + def log_mutation_event: (untyped params) -> (nil | untyped) + + def mutation_listener: () -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_logs.rbs b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_logs.rbs new file mode 100644 index 0000000000000..fd42be72f967a --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_logs.rbs @@ -0,0 +1,11 @@ +module Selenium + module WebDriver + module DriverExtensions + module HasLogs + @logs: untyped + + def logs: () -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_network_conditions.rbs b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_network_conditions.rbs new file mode 100644 index 0000000000000..bd77ff746b2f4 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_network_conditions.rbs @@ -0,0 +1,13 @@ +module Selenium + module WebDriver + module DriverExtensions + module HasNetworkConditions + def network_conditions: () -> untyped + + def network_conditions=: (untyped conditions) -> untyped + + def delete_network_conditions: () -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_network_interception.rbs b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_network_interception.rbs new file mode 100644 index 0000000000000..5b946e28b3cf4 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_network_interception.rbs @@ -0,0 +1,11 @@ +module Selenium + module WebDriver + module DriverExtensions + module HasNetworkInterception + @interceptor: untyped + + def intercept: () { () -> untyped } -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_permissions.rbs b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_permissions.rbs new file mode 100644 index 0000000000000..1bcb52ec121dd --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_permissions.rbs @@ -0,0 +1,11 @@ +module Selenium + module WebDriver + module DriverExtensions + module HasPermissions + def add_permission: (untyped name, untyped value) -> untyped + + def add_permissions: (untyped opt) -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_pinned_scripts.rbs b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_pinned_scripts.rbs new file mode 100644 index 0000000000000..4777f055ced0a --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_pinned_scripts.rbs @@ -0,0 +1,15 @@ +module Selenium + module WebDriver + module DriverExtensions + module HasPinnedScripts + @pinned_scripts: untyped + + def pinned_scripts: () -> untyped + + def pin_script: (untyped script) -> untyped + + def unpin_script: (untyped script) -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_session_id.rbs b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_session_id.rbs new file mode 100644 index 0000000000000..77a051910d151 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_session_id.rbs @@ -0,0 +1,9 @@ +module Selenium + module WebDriver + module DriverExtensions + module HasSessionId + def session_id: () -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_web_storage.rbs b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_web_storage.rbs new file mode 100644 index 0000000000000..fa3c0a0cf64b5 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_web_storage.rbs @@ -0,0 +1,11 @@ +module Selenium + module WebDriver + module DriverExtensions + module HasWebStorage + def local_storage: () -> untyped + + def session_storage: () -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/driver_extensions/prints_page.rbs b/rb/sig/lib/selenium/webdriver/common/driver_extensions/prints_page.rbs new file mode 100644 index 0000000000000..f2578dde05b16 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/driver_extensions/prints_page.rbs @@ -0,0 +1,11 @@ +module Selenium + module WebDriver + module DriverExtensions + module PrintsPage + def save_print_page: (untyped path, **untyped options) -> untyped + + def print_page: (**untyped options) -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/driver_extensions/uploads_files.rbs b/rb/sig/lib/selenium/webdriver/common/driver_extensions/uploads_files.rbs new file mode 100644 index 0000000000000..fe3a3f395763f --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/driver_extensions/uploads_files.rbs @@ -0,0 +1,9 @@ +module Selenium + module WebDriver + module DriverExtensions + module UploadsFiles + def file_detector=: (untyped detector) -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/driver_finder.rbs b/rb/sig/lib/selenium/webdriver/common/driver_finder.rbs new file mode 100644 index 0000000000000..d012a5ec38f3c --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/driver_finder.rbs @@ -0,0 +1,7 @@ +module Selenium + module WebDriver + class DriverFinder + def self.path: (untyped options, untyped klass) -> untyped + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/error.rbs b/rb/sig/lib/selenium/webdriver/common/error.rbs new file mode 100644 index 0000000000000..b989b389e6f74 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/error.rbs @@ -0,0 +1,105 @@ +module Selenium + module WebDriver + module Error + def self.for_error: (untyped error) -> untyped + + SUPPORT_MSG: "For documentation on this error, please visit:" + + ERROR_URL: "https://www.selenium.dev/documentation/webdriver/troubleshooting/errors" + + class WebDriverError < StandardError + end + + class NoSuchElementError < WebDriverError + def initialize: (?::String msg) -> void + end + + class NoSuchFrameError < WebDriverError + end + + class UnknownCommandError < WebDriverError + end + + class StaleElementReferenceError < WebDriverError + def initialize: (?::String msg) -> void + end + + class DetachedShadowRootError < WebDriverError + end + + class InvalidElementStateError < WebDriverError + end + + class UnknownError < WebDriverError + end + + class JavascriptError < WebDriverError + end + + class TimeoutError < WebDriverError + end + + class NoSuchWindowError < WebDriverError + end + + class NoSuchShadowRootError < WebDriverError + end + + class InvalidCookieDomainError < WebDriverError + end + + class UnableToSetCookieError < WebDriverError + end + + class NoSuchAlertError < WebDriverError + end + + class ScriptTimeoutError < WebDriverError + end + + class InvalidSelectorError < WebDriverError + def initialize: (?::String msg) -> void + end + + class SessionNotCreatedError < WebDriverError + end + + class MoveTargetOutOfBoundsError < WebDriverError + end + + class ElementNotInteractableError < WebDriverError + end + + class InsecureCertificateError < WebDriverError + end + + class InvalidArgumentError < WebDriverError + end + + class NoSuchCookieError < WebDriverError + end + + class UnableToCaptureScreenError < WebDriverError + end + + class InvalidSessionIdError < WebDriverError + end + + class UnexpectedAlertOpenError < WebDriverError + end + + class UnknownMethodError < WebDriverError + end + + class ElementClickInterceptedError < WebDriverError + end + + class UnsupportedOperationError < WebDriverError + end + + class NoSuchDriverError < WebDriverError + def initialize: (?::String msg) -> void + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/file_reaper.rbs b/rb/sig/lib/selenium/webdriver/common/file_reaper.rbs new file mode 100644 index 0000000000000..84d4d3191f161 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/file_reaper.rbs @@ -0,0 +1,21 @@ +module Selenium + module WebDriver + module FileReaper + self.@reap: untyped + + self.@tmp_files: untyped + + attr_writer self.reap: untyped + + def self.reap?: () -> untyped + + def self.tmp_files: () -> untyped + + def self.<<: (untyped file) -> untyped + + def self.reap: (untyped file) -> (nil | untyped) + + def self.reap!: () -> (true | false) + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/html5/local_storage.rbs b/rb/sig/lib/selenium/webdriver/common/html5/local_storage.rbs new file mode 100644 index 0000000000000..3e8095c118608 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/html5/local_storage.rbs @@ -0,0 +1,28 @@ +module Selenium + module WebDriver + module HTML5 + class LocalStorage + @bridge: untyped + + include SharedWebStorage + + # + # @api private + # + def initialize: (untyped bridge) -> void + + def []: (untyped key) -> untyped + + def []=: (untyped key, untyped value) -> untyped + + def delete: (untyped key) -> untyped + + def clear: () -> untyped + + def size: () -> untyped + + def keys: () -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/html5/session_storage.rbs b/rb/sig/lib/selenium/webdriver/common/html5/session_storage.rbs new file mode 100644 index 0000000000000..30773de5699d8 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/html5/session_storage.rbs @@ -0,0 +1,27 @@ +module Selenium + module WebDriver + module HTML5 + class SessionStorage + @bridge: untyped + + include Enumerable + + include SharedWebStorage + + def []: (untyped key) -> untyped + + def []=: (untyped key, untyped value) -> untyped + + def delete: (untyped key) -> untyped + + def clear: () -> untyped + + def size: () -> untyped + + def keys: () -> untyped + + def initialize: (untyped bridge) -> void + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/html5/shared_web_storage.rbs b/rb/sig/lib/selenium/webdriver/common/html5/shared_web_storage.rbs new file mode 100644 index 0000000000000..53d8eac284568 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/html5/shared_web_storage.rbs @@ -0,0 +1,21 @@ +module Selenium + module WebDriver + module HTML5 + module SharedWebStorage + include Enumerable + + def key?: (untyped key) -> untyped + + alias member? key? + + alias has_key? key? + + def fetch: (untyped key) ?{ (untyped) -> untyped } -> untyped + + def empty?: () -> untyped + + def each: () ?{ (untyped, untyped) -> untyped } -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/interactions.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/interactions.rbs new file mode 100644 index 0000000000000..66dfcde4cabcb --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/interactions/interactions.rbs @@ -0,0 +1,27 @@ +module Selenium + module WebDriver + module Interactions + KEY: :key + + POINTER: :pointer + + NONE: :none + + WHEEL: :wheel + + def self.key: (?untyped? name) -> untyped + + def self.pointer: (?::Symbol kind, ?name: untyped?) -> untyped + + def self.mouse: (?name: untyped?) -> untyped + + def self.pen: (?name: untyped?) -> untyped + + def self.touch: (?name: untyped?) -> untyped + + def self.none: (?untyped? name) -> untyped + + def self.wheel: (?untyped? name) -> untyped + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/none_input.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/none_input.rbs new file mode 100644 index 0000000000000..703445eb1504e --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/interactions/none_input.rbs @@ -0,0 +1,11 @@ +module Selenium + module WebDriver + module Interactions + class NoneInput < InputDevice + @type: untyped + + def initialize: (?untyped? name) -> void + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/pause.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/pause.rbs new file mode 100644 index 0000000000000..d18984d8fba09 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/interactions/pause.rbs @@ -0,0 +1,17 @@ +module Selenium + module WebDriver + module Interactions + class Pause < Interaction + @duration: untyped + + @type: untyped + + def initialize: (untyped source, ?untyped? duration) -> void + + def assert_source: (untyped source) -> (untyped | nil) + + def encode: () -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/pointer_cancel.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/pointer_cancel.rbs new file mode 100644 index 0000000000000..af938515e35aa --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/interactions/pointer_cancel.rbs @@ -0,0 +1,15 @@ +module Selenium + module WebDriver + module Interactions + class PointerCancel < Interaction + @type: untyped + + def initialize: (untyped source) -> void + + def assert_source: (untyped source) -> (untyped | nil) + + def encode: () -> { type: untyped } + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/pointer_event_properties.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/pointer_event_properties.rbs new file mode 100644 index 0000000000000..88efe4552b9df --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/interactions/pointer_event_properties.rbs @@ -0,0 +1,15 @@ +module Selenium + module WebDriver + module Interactions + module PointerEventProperties + VALID: { width: ::Hash[::String, { min: ::Float }], height: ::Hash[::String, { min: ::Float }], pressure: ::Hash[::String, { min: ::Float, max: ::Float }], tangential_pressure: ::Hash[::String, { min: ::Float, max: ::Float }], tilt_x: ::Hash[::String, { min: -90, max: 90 }], tilt_y: ::Hash[::String, { min: -90, max: 90 }], twist: ::Hash[::String, { min: 0, max: 359 }], altitude_angle: ::Hash[::String, { min: ::Float, max: untyped }], azimuth_angle: ::Hash[::String, { min: ::Float, max: untyped }] } + + def process_opts: () -> untyped + + private + + def assert_number: (untyped num, untyped min, ?untyped? max) -> (nil | untyped) + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/pointer_move.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/pointer_move.rbs new file mode 100644 index 0000000000000..bbc3b6bd39ea3 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/interactions/pointer_move.rbs @@ -0,0 +1,33 @@ +module Selenium + module WebDriver + module Interactions + class PointerMove < Interaction + @duration: untyped + + @x_offset: untyped + + @y_offset: untyped + + @origin: untyped + + @type: untyped + + @opts: untyped + + include PointerEventProperties + + VIEWPORT: :viewport + + POINTER: :pointer + + ORIGINS: ::Array[untyped] + + def initialize: (untyped source, untyped duration, untyped x, untyped y, **untyped opts) -> void + + def assert_source: (untyped source) -> (untyped | nil) + + def encode: () -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/pointer_press.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/pointer_press.rbs new file mode 100644 index 0000000000000..a9e183a7b3683 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/interactions/pointer_press.rbs @@ -0,0 +1,33 @@ +module Selenium + module WebDriver + module Interactions + class PointerPress < Interaction + @direction: untyped + + @button: untyped + + @type: untyped + + @opts: untyped + + include PointerEventProperties + + BUTTONS: { left: 0, touch: 0, pen_contact: 0, middle: 1, right: 2, pen_barrel: 2, x1: 3, back: 3, x2: 4, forward: 4 } + + DIRECTIONS: { down: :pointerDown, up: :pointerUp } + + def initialize: (untyped source, untyped direction, untyped button, **untyped opts) -> void + + def encode: () -> untyped + + private + + def assert_source: (untyped source) -> (untyped | nil) + + def assert_button: (untyped button) -> untyped + + def assert_direction: (untyped direction) -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/scroll.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/scroll.rbs new file mode 100644 index 0000000000000..bc32ccac9b1af --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/interactions/scroll.rbs @@ -0,0 +1,27 @@ +module Selenium + module WebDriver + module Interactions + class Scroll < Interaction + @type: untyped + + @duration: untyped + + @origin: untyped + + @x_offset: untyped + + @y_offset: untyped + + @delta_x: untyped + + @delta_y: untyped + + def initialize: (source: untyped, ?origin: ::Symbol, ?duration: ::Float, **untyped opts) -> void + + def assert_source: (untyped source) -> (untyped | nil) + + def encode: () -> ::Hash[::String, untyped] + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/wheel_actions.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/wheel_actions.rbs new file mode 100644 index 0000000000000..375d979cd030c --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/interactions/wheel_actions.rbs @@ -0,0 +1,68 @@ +module Selenium + module WebDriver + module WheelActions + @default_scroll_duration: untyped + + attr_writer default_scroll_duration: untyped + + def default_scroll_duration: () -> untyped + + # + # If the element is outside the viewport, scrolls the bottom of the element to the bottom of the viewport. + # + # @example Scroll to element + # el = driver.find_element(id: "some_id") + # driver.action.scroll_to(element).perform + # + # @param [Object] Which element to scroll into the viewport. + # @return [Selenium::WebDriver::WheelActions] A self reference. + def scroll_to: (untyped element, ?device: untyped?) -> untyped + + # + # Scrolls by provided amounts with the origin in the top left corner of the viewport. + # + # @example Scroll viewport by a specified amount + # el = driver.find_element(id: "some_id") + # driver.action.scroll_by(100, 200).perform + # + # @param [Integer] delta_x Distance along X axis to scroll using the wheel. A negative value scrolls left. + # @param [Integer] delta_y Distance along Y axis to scroll using the wheel. A negative value scrolls up. + # @return [Selenium::WebDriver::WheelActions] A self reference. + def scroll_by: (untyped delta_x, untyped delta_y, ?device: untyped?) -> untyped + + # + # Scrolls by provided amount based on a provided origin. + # + # The scroll origin is either the center of an element or the upper left of the viewport plus any offsets. + # If the origin is an element, and the element is not in the viewport, the bottom of the element will first + # be scrolled to the bottom of the viewport. + # + # @example Scroll from element by a specified amount + # el = driver.find_element(id: "some_id") + # origin = WheelActions::ScrollOrigin.element(el) + # driver.action.scroll_from(origin, 0, 200).perform + # + # @example Scroll from element by a specified amount with an offset + # el = driver.find_element(id: "some_id") + # origin = WheelActions::ScrollOrigin.element(el, 10, 10) + # driver.action.scroll_from(origin, 100, 200).perform + # + # @example Scroll viewport by a specified amount with an offset + # origin = WheelActions::ScrollOrigin.viewport(10, 10) + # driver.action.scroll_from(origin, 0, 200).perform + # + # @param [ScrollOrigin] scroll_origin Where scroll originates (viewport or element center) plus provided offsets. + # @param [Integer] delta_x Distance along X axis to scroll using the wheel. A negative value scrolls left. + # @param [Integer] delta_y Distance along Y axis to scroll using the wheel. A negative value scrolls up. + # @return [Selenium::WebDriver::WheelActions] A self reference. + # @raise [Error::MoveTargetOutOfBoundsError] If the origin with offset is outside the viewport. + def scroll_from: (untyped scroll_origin, untyped delta_x, untyped delta_y, ?device: untyped?) -> untyped + + private + + def scroll: (**untyped opts) -> self + + def wheel_input: (?untyped? name) -> untyped + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/keys.rbs b/rb/sig/lib/selenium/webdriver/common/keys.rbs new file mode 100644 index 0000000000000..b8d830e930e20 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/keys.rbs @@ -0,0 +1,13 @@ +module Selenium + module WebDriver + module Keys + KEYS: { null: ::String, cancel: ::String, help: ::String, backspace: ::String, tab: ::String, clear: ::String, return: ::String, enter: ::String, shift: ::String, left_shift: ::String, control: ::String, left_control: ::String, alt: ::String, left_alt: ::String, pause: ::String, escape: ::String, space: ::String, page_up: ::String, page_down: ::String, end: ::String, home: ::String, left: ::String, arrow_left: ::String, up: ::String, arrow_up: ::String, right: ::String, arrow_right: ::String, down: ::String, arrow_down: ::String, insert: ::String, delete: ::String, semicolon: ::String, equals: ::String, numpad0: ::String, numpad1: ::String, numpad2: ::String, numpad3: ::String, numpad4: ::String, numpad5: ::String, numpad6: ::String, numpad7: ::String, numpad8: ::String, numpad9: ::String, multiply: ::String, add: ::String, separator: ::String, subtract: ::String, decimal: ::String, divide: ::String, f1: ::String, f2: ::String, f3: ::String, f4: ::String, f5: ::String, f6: ::String, f7: ::String, f8: ::String, f9: ::String, f10: ::String, f11: ::String, f12: ::String, meta: ::String, command: ::String, left_meta: ::String, zenkaku_hankaku: ::String, right_shift: ::String, right_control: ::String, right_alt: ::String, right_meta: ::String, numpad_page_up: ::String, numpad_page_down: ::String, numpad_end: ::String, numpad_home: ::String, numpad_left: ::String, numpad_up: ::String, numpad_right: ::String, numpad_down: ::String, numpad_insert: ::String, numpad_delete: ::String } + + def self.[]: (untyped key) -> untyped + + def self.encode: (untyped keys) -> untyped + + def self.encode_key: (untyped key) -> untyped + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/local_driver.rbs b/rb/sig/lib/selenium/webdriver/common/local_driver.rbs new file mode 100644 index 0000000000000..402d0d412b784 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/local_driver.rbs @@ -0,0 +1,9 @@ +module Selenium + module WebDriver + module LocalDriver + def initialize_local_driver: (untyped options, untyped service, untyped url) -> ::Array[untyped] + + def process_options: (untyped options, untyped service) -> untyped + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/log_entry.rbs b/rb/sig/lib/selenium/webdriver/common/log_entry.rbs new file mode 100644 index 0000000000000..e661f54af08f0 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/log_entry.rbs @@ -0,0 +1,25 @@ +module Selenium + module WebDriver + class LogEntry + @level: untyped + + @timestamp: untyped + + @message: untyped + + attr_reader level: untyped + + attr_reader timestamp: untyped + + attr_reader message: untyped + + def initialize: (untyped level, untyped timestamp, untyped message) -> void + + def as_json: (*untyped) -> ::Hash[::String, untyped] + + def to_s: () -> ::String + + def time: () -> untyped + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/logs.rbs b/rb/sig/lib/selenium/webdriver/common/logs.rbs new file mode 100644 index 0000000000000..b5974bfd0299b --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/logs.rbs @@ -0,0 +1,13 @@ +module Selenium + module WebDriver + class Logs + @bridge: untyped + + def initialize: (untyped bridge) -> void + + def get: (untyped type) -> untyped + + def available_types: () -> untyped + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/manager.rbs b/rb/sig/lib/selenium/webdriver/common/manager.rbs index 2c040a329ada1..bf61f3e18c4b4 100644 --- a/rb/sig/lib/selenium/webdriver/common/manager.rbs +++ b/rb/sig/lib/selenium/webdriver/common/manager.rbs @@ -1,7 +1,7 @@ module Selenium module WebDriver class Manager - attr_reader bridge: untyped + attr_reader bridge: Remote::Bridge @timeouts: Timeouts @@ -9,15 +9,15 @@ module Selenium def initialize: (Remote::Bridge bridge) -> void - def add_cookie: (?Hash[Symbol, untyped] opts) -> untyped + def add_cookie: (?Hash[Symbol, untyped] opts) -> void - def cookie_named: (String name) -> Hash[untyped, untyped]? + def cookie_named: (String name) -> Hash[Symbol, untyped] def delete_cookie: (String name) -> String - def delete_all_cookies: () -> untyped + def delete_all_cookies: () -> void - def all_cookies: () -> Array[Hash[untyped, untyped]] + def all_cookies: () -> Array[Hash[Symbol, untyped]] def timeouts: () -> Timeouts @@ -25,15 +25,15 @@ module Selenium private - SECONDS_PER_DAY: ::Float + SECONDS_PER_DAY: Float def datetime_at: (Integer int) -> Date - def seconds_from: (Time | DateTime | Numeric obj) -> (Time | Date | Numeric) + def seconds_from: (Time | DateTime | Numeric obj) -> (Float | Numeric) - def strip_port: (String str) -> (Array[String] | nil) + def strip_port: (String str) -> String? - def convert_cookie: (untyped cookie) -> { name: untyped, value: untyped, path: untyped, domain: untyped, expires: untyped, same_site: untyped, http_only: untyped, secure: untyped } + def convert_cookie: (Hash[String, untyped] cookie) -> Hash[Symbol, untyped] end end end diff --git a/rb/sig/lib/selenium/webdriver/common/options.rbs b/rb/sig/lib/selenium/webdriver/common/options.rbs new file mode 100644 index 0000000000000..2ff3fe6a77fe7 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/options.rbs @@ -0,0 +1,59 @@ +module Selenium + module WebDriver + class Options + @options: untyped + + W3C_OPTIONS: ::Array[:browser_name | :browser_version | :platform_name | :accept_insecure_certs | :page_load_strategy | :proxy | :set_window_rect | :timeouts | :unhandled_prompt_behavior | :strict_file_interactability | :web_socket_url] + + GRID_OPTIONS: ::Array[:enable_downloads] + + attr_reader self.driver_path: untyped + + def self.chrome: (**untyped opts) -> untyped + + def self.firefox: (**untyped opts) -> untyped + + def self.ie: (**untyped opts) -> untyped + + alias self.internet_explorer self.ie + + def self.edge: (**untyped opts) -> untyped + + alias self.microsoftedge self.edge + + def self.safari: (**untyped opts) -> untyped + + def self.set_capabilities: () -> untyped + + attr_accessor options: untyped + + def initialize: (**untyped opts) -> void + + def add_option: (untyped name, ?untyped? value) -> untyped + + def ==: (untyped other) -> (false | untyped) + + alias eql? == + + def as_json: (*untyped) -> untyped + + private + + def w3c?: (untyped key) -> untyped + + def process_w3c_options: (untyped options) -> untyped + + def process_browser_options: (untyped _browser_options) -> nil + + def camelize?: (untyped _key) -> true + + def generate_as_json: (untyped value, ?camelize_keys: bool) -> untyped + + def process_json_hash: (untyped value, untyped camelize_keys) -> untyped + + def convert_json_key: (untyped key, ?camelize: bool) -> untyped + + def camel_case: (untyped str) -> untyped + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/platform.rbs b/rb/sig/lib/selenium/webdriver/common/platform.rbs new file mode 100644 index 0000000000000..96fc94d716a5b --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/platform.rbs @@ -0,0 +1,60 @@ +module Selenium + module WebDriver + # @api private + module Platform + @home: untyped + + @engine: untyped + + @os: untyped + + def self?.home: () -> untyped + + def self?.engine: () -> untyped + + def self?.os: () -> untyped + + def self?.ci: () -> (:travis | :jenkins | :appveyor | :github | nil) + + def self?.jruby?: () -> untyped + + def self?.truffleruby?: () -> untyped + + def self?.ruby_version: () -> untyped + + def self?.windows?: () -> untyped + + def self?.mac?: () -> untyped + + def self?.linux?: () -> untyped + + def self?.wsl?: () -> untyped + + def self?.cygwin?: () -> untyped + + def self?.null_device: () -> untyped + + def self?.wrap_in_quotes_if_necessary: (untyped str) -> (::String | untyped) + + def self?.cygwin_path: (untyped path, **untyped opts) -> untyped + + def self?.unix_path: (untyped path) -> untyped + + def self?.windows_path: (untyped path) -> untyped + + def self?.make_writable: (untyped file) -> untyped + + def self?.assert_file: (untyped path) -> (nil | untyped) + + def self?.assert_executable: (untyped path) -> (nil | untyped) + + def self?.exit_hook: () { () -> untyped } -> untyped + + def self?.localhost: () -> untyped + + def self?.ip: () -> untyped + + def self?.interfaces: () -> untyped + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/port_prober.rbs b/rb/sig/lib/selenium/webdriver/common/port_prober.rbs new file mode 100644 index 0000000000000..1d45cd15321d7 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/port_prober.rbs @@ -0,0 +1,11 @@ +module Selenium + module WebDriver + class PortProber + def self.above: (untyped port) -> untyped + + IGNORED_ERRORS: untyped + + def self.free?: (untyped port) -> untyped + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/profile_helper.rbs b/rb/sig/lib/selenium/webdriver/common/profile_helper.rbs new file mode 100644 index 0000000000000..0c742640c7bad --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/profile_helper.rbs @@ -0,0 +1,25 @@ +module Selenium + module WebDriver + module ProfileHelper + def self.included: (untyped base) -> untyped + + def self.decoded: (untyped json) -> untyped + + def encoded: () -> untyped + + def as_json: (*untyped) -> ::Hash[::String, untyped] + + def to_json: (*untyped) -> untyped + + private + + def create_tmp_copy: (untyped directory) -> untyped + + def verify_model: (untyped model) -> (nil | untyped) + + module ClassMethods + def from_json: (untyped json) -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/proxy.rbs b/rb/sig/lib/selenium/webdriver/common/proxy.rbs new file mode 100644 index 0000000000000..885ea9e55c9d0 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/proxy.rbs @@ -0,0 +1,65 @@ +module Selenium + module WebDriver + class Proxy + @ftp: untyped + + @http: untyped + + @no_proxy: untyped + + @ssl: untyped + + @pac: untyped + + @auto_detect: untyped + + @socks: untyped + + @socks_username: untyped + + @socks_password: untyped + + @socks_version: untyped + + @type: untyped + + TYPES: { direct: "DIRECT", manual: "MANUAL", pac: "PAC", auto_detect: "AUTODETECT", system: "SYSTEM" } + + ALLOWED: { type: "proxyType", ftp: "ftpProxy", http: "httpProxy", no_proxy: "noProxy", pac: "proxyAutoconfigUrl", ssl: "sslProxy", auto_detect: "autodetect", socks: "socksProxy", socks_username: "socksUsername", socks_password: "socksPassword", socks_version: "socksVersion" } + + def self.json_create: (untyped data) -> (nil | untyped) + + def initialize: (?::Hash[untyped, untyped] opts) -> void + + def ==: (untyped other) -> untyped + + alias eql? == + + def ftp=: (untyped value) -> untyped + + def http=: (untyped value) -> untyped + + def no_proxy=: (untyped value) -> untyped + + def ssl=: (untyped value) -> untyped + + def pac=: (untyped url) -> untyped + + def auto_detect=: (untyped bool) -> untyped + + def socks=: (untyped value) -> untyped + + def socks_username=: (untyped value) -> untyped + + def socks_password=: (untyped value) -> untyped + + def socks_version=: (untyped value) -> untyped + + def type=: (untyped type) -> untyped + + def as_json: (*untyped) -> untyped + + def to_json: (*untyped) -> untyped + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/selenium_manager.rbs b/rb/sig/lib/selenium/webdriver/common/selenium_manager.rbs new file mode 100644 index 0000000000000..f5aa63d7ae7d1 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/selenium_manager.rbs @@ -0,0 +1,33 @@ +module Selenium + module WebDriver + # + # Wrapper for getting information from the Selenium Manager binaries. + # This implementation is still in beta, and may change. + # @api private + # + class SeleniumManager + self.@bin_path: untyped + + self.@binary: untyped + + attr_writer self.bin_path: untyped + + def self.bin_path: () -> untyped + + # @param [Options] options browser options. + # @return [String] the path to the correct driver. + def self.driver_path: (untyped options) -> untyped + + private + + def self.generate_command: (untyped binary, untyped options) -> untyped + + # @return [String] the path to the correct selenium manager + def self.binary: () -> untyped + + def self.validate_location: (untyped location) -> untyped + + def self.run: (*untyped command) -> untyped + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/service.rbs b/rb/sig/lib/selenium/webdriver/common/service.rbs new file mode 100644 index 0000000000000..e1db0f1aeb330 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/service.rbs @@ -0,0 +1,55 @@ +module Selenium + module WebDriver + class Service + self.@driver_path: untyped + + @executable_path: untyped + + @host: untyped + + @port: untyped + + @log: untyped + + @args: untyped + + attr_reader self.driver_path: untyped + + def self.chrome: (**untyped opts) -> untyped + + def self.firefox: (**untyped opts) -> untyped + + def self.ie: (**untyped opts) -> untyped + + alias self.internet_explorer self.ie + + def self.edge: (**untyped opts) -> untyped + + alias self.microsoftedge self.edge + + alias self.msedge self.edge + + def self.safari: (**untyped opts) -> untyped + + def self.driver_path=: (untyped path) -> untyped + + attr_accessor host: untyped + + attr_accessor executable_path: untyped + + attr_accessor port: untyped + + attr_accessor log: untyped + + attr_accessor args: untyped + + alias extra_args args + + def initialize: (?path: untyped?, ?port: untyped?, ?log: untyped?, ?args: untyped?) -> void + + def launch: () -> untyped + + def shutdown_supported: () -> untyped + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/service_manager.rbs b/rb/sig/lib/selenium/webdriver/common/service_manager.rbs new file mode 100644 index 0000000000000..dc72e595f64d5 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/service_manager.rbs @@ -0,0 +1,67 @@ +module Selenium + module WebDriver + # + # Base class implementing default behavior of service_manager object, + # responsible for starting and stopping driver implementations. + # + # @api private + # + class ServiceManager + @executable_path: untyped + + @host: untyped + + @port: untyped + + @io: untyped + + @extra_args: untyped + + @shutdown_supported: untyped + + @uri: untyped + + @process: untyped + + @socket_lock: untyped + + START_TIMEOUT: 20 + + SOCKET_LOCK_TIMEOUT: 45 + + STOP_TIMEOUT: 20 + + def initialize: (untyped config) -> void + + def start: () -> untyped + + def stop: () -> untyped + + def uri: () -> untyped + + private + + def build_process: (*untyped command) -> untyped + + def connect_to_server: () { (untyped) -> untyped } -> untyped + + def find_free_port: () -> untyped + + def start_process: () -> untyped + + def stop_process: () -> (nil | untyped) + + def stop_server: () -> untyped + + def process_running?: () -> untyped + + def process_exited?: () -> untyped + + def connect_until_stable: () -> (nil | untyped) + + def cannot_connect_error_text: () -> ::String + + def socket_lock: () -> untyped + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/socket_lock.rbs b/rb/sig/lib/selenium/webdriver/common/socket_lock.rbs new file mode 100644 index 0000000000000..09c595c768c66 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/socket_lock.rbs @@ -0,0 +1,27 @@ +module Selenium + module WebDriver + class SocketLock + @port: untyped + + @server: untyped + + @timeout: untyped + + def initialize: (untyped port, untyped timeout) -> void + + def locked: () { () -> untyped } -> untyped + + private + + def lock: () -> (nil | untyped) + + def current_time: () -> untyped + + def release: () -> untyped + + def can_lock?: () -> untyped + + def did_lock?: () -> untyped + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/socket_poller.rbs b/rb/sig/lib/selenium/webdriver/common/socket_poller.rbs new file mode 100644 index 0000000000000..2bae99a206bf0 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/socket_poller.rbs @@ -0,0 +1,39 @@ +module Selenium + module WebDriver + class SocketPoller + @host: untyped + + @port: untyped + + @timeout: untyped + + @interval: untyped + + def initialize: (untyped host, untyped port, ?::Integer timeout, ?::Float interval) -> void + + def connected?: () -> untyped + + def closed?: () -> untyped + + private + + CONNECT_TIMEOUT: 5 + + NOT_CONNECTED_ERRORS: untyped + + CONNECTED_ERRORS: untyped + + # we use a plain TCPSocket here since JRuby has issues closing socket + # see https://github.com/jruby/jruby/issues/5709 + def listening?: () -> untyped + + def socket_writable?: (untyped sock) -> untyped + + def conn_completed?: (untyped sock) -> untyped + + def with_timeout: () { () -> untyped } -> (true | false) + + def current_time: () -> untyped + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/virtual_authenticator/credential.rbs b/rb/sig/lib/selenium/webdriver/common/virtual_authenticator/credential.rbs new file mode 100644 index 0000000000000..bb1a659f48fb1 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/virtual_authenticator/credential.rbs @@ -0,0 +1,45 @@ +module Selenium + module WebDriver + class Credential + @id: untyped + + @resident_credential: untyped + + @rp_id: untyped + + @user_handle: untyped + + @private_key: untyped + + @sign_count: untyped + + def self.resident: (**untyped opts) -> untyped + + def self.non_resident: (**untyped opts) -> untyped + + def self.encode: (untyped byte_array) -> untyped + + def self.decode: (untyped base64) -> untyped + + def self.from_json: (untyped opts) -> untyped + + attr_reader id: untyped + + attr_reader resident_credential: untyped + + attr_reader rp_id: untyped + + attr_reader user_handle: untyped + + attr_reader private_key: untyped + + attr_reader sign_count: untyped + + alias resident_credential? resident_credential + + def initialize: (id: untyped, resident_credential: untyped, rp_id: untyped, private_key: untyped, **untyped opts) -> void + + def as_json: (*untyped) -> untyped + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/virtual_authenticator/virtual_authenticator_options.rbs b/rb/sig/lib/selenium/webdriver/common/virtual_authenticator/virtual_authenticator_options.rbs new file mode 100644 index 0000000000000..652c9c22449e6 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/virtual_authenticator/virtual_authenticator_options.rbs @@ -0,0 +1,45 @@ +module Selenium + module WebDriver + class VirtualAuthenticatorOptions + @protocol: untyped + + @transport: untyped + + @resident_key: untyped + + @user_verification: untyped + + @user_consenting: untyped + + @user_verified: untyped + + PROTOCOL: { ctap2: "ctap2", u2f: "ctap1/u2f" } + + TRANSPORT: { ble: "ble", usb: "usb", nfc: "nfc", internal: "internal" } + + attr_accessor protocol: untyped + + attr_accessor transport: untyped + + attr_accessor resident_key: untyped + + attr_accessor user_verification: untyped + + attr_accessor user_consenting: untyped + + attr_accessor user_verified: untyped + + alias resident_key? resident_key + + alias user_verification? user_verification + + alias user_consenting? user_consenting + + alias user_verified? user_verified + + def initialize: (**untyped opts) -> void + + def as_json: (*untyped) -> ::Hash[::String, untyped] + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/wait.rbs b/rb/sig/lib/selenium/webdriver/common/wait.rbs new file mode 100644 index 0000000000000..eb97bf216d5f9 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/wait.rbs @@ -0,0 +1,25 @@ +module Selenium + module WebDriver + class Wait + @timeout: untyped + + @interval: untyped + + @message: untyped + + @ignored: untyped + + DEFAULT_TIMEOUT: 5 + + DEFAULT_INTERVAL: ::Float + + def initialize: (?::Hash[untyped, untyped] opts) -> void + + def until: () { () -> untyped } -> untyped + + private + + def current_time: () -> untyped + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/websocket_connection.rbs b/rb/sig/lib/selenium/webdriver/common/websocket_connection.rbs new file mode 100644 index 0000000000000..a7492babc9b40 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/websocket_connection.rbs @@ -0,0 +1,68 @@ +module Selenium + module WebDriver + class WebSocketConnection + @callback_threads: untyped + + @session_id: untyped + + @url: untyped + + @socket_thread: untyped + + @callbacks: untyped + + @messages: untyped + + @incoming_frame: untyped + + @wait: untyped + + @socket: untyped + + @ws: untyped + + @id: untyped + + CONNECTION_ERRORS: ::Array[untyped] + + RESPONSE_WAIT_TIMEOUT: 30 + + RESPONSE_WAIT_INTERVAL: ::Float + + MAX_LOG_MESSAGE_SIZE: 9999 + + def initialize: (url: untyped) -> void + + def close: () -> untyped + + def callbacks: () -> untyped + + def send_cmd: (**untyped payload) -> untyped + + private + + # We should be thread-safe to use the hash without synchronization + # because its keys are WebSocket message identifiers and they should be + # unique within a devtools session. + def messages: () -> untyped + + def process_handshake: () -> untyped + + def attach_socket_listener: () -> untyped + + def incoming_frame: () -> untyped + + def process_frame: (untyped frame) -> (::Hash[untyped, untyped] | untyped) + + def callback_thread: (untyped params) { (untyped) -> untyped } -> untyped + + def wait: () -> untyped + + def socket: () -> untyped + + def ws: () -> untyped + + def next_id: () -> untyped + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/zipper.rbs b/rb/sig/lib/selenium/webdriver/common/zipper.rbs new file mode 100644 index 0000000000000..0988f7bb50f52 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/zipper.rbs @@ -0,0 +1,19 @@ +module Selenium + module WebDriver + module Zipper + EXTENSIONS: ::Array[".zip" | ".xpi"] + + def self.unzip: (untyped path) -> untyped + + def self.zip: (untyped path) -> untyped + + def self.zip_file: (untyped path) -> untyped + + private + + def self.with_tmp_zip: () { () -> untyped } -> untyped + + def self.add_zip_entry: (untyped zip, untyped file, untyped entry_name) -> untyped + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/devtools.rbs b/rb/sig/lib/selenium/webdriver/devtools.rbs new file mode 100644 index 0000000000000..14f2b476d7370 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/devtools.rbs @@ -0,0 +1,27 @@ +module Selenium + module WebDriver + class DevTools + @ws: untyped + + @session_id: untyped + + def initialize: (url: untyped) -> void + + def close: () -> untyped + + def callbacks: () -> untyped + + def send_cmd: (untyped method, **untyped params) -> untyped + + def method_missing: (untyped method, *untyped _args) -> (nil | untyped) + + def respond_to_missing?: (untyped method, *untyped _args) -> untyped + + private + + def start_session: () -> untyped + + def error_message: (untyped error) -> untyped + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/devtools/console_event.rbs b/rb/sig/lib/selenium/webdriver/devtools/console_event.rbs new file mode 100644 index 0000000000000..60cbaa68a11c4 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/devtools/console_event.rbs @@ -0,0 +1,21 @@ +module Selenium + module WebDriver + class DevTools + class ConsoleEvent + @type: untyped + + @timestamp: untyped + + @args: untyped + + attr_accessor type: untyped + + attr_accessor timestamp: untyped + + attr_accessor args: untyped + + def initialize: (type: untyped, timestamp: untyped, args: untyped) -> void + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/devtools/exception_event.rbs b/rb/sig/lib/selenium/webdriver/devtools/exception_event.rbs new file mode 100644 index 0000000000000..a4eac54cc06c9 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/devtools/exception_event.rbs @@ -0,0 +1,21 @@ +module Selenium + module WebDriver + class DevTools + class ExceptionEvent + @description: untyped + + @timestamp: untyped + + @stacktrace: untyped + + attr_accessor description: untyped + + attr_accessor timestamp: untyped + + attr_accessor stacktrace: untyped + + def initialize: (description: untyped, timestamp: untyped, stacktrace: untyped) -> void + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/devtools/mutation_event.rbs b/rb/sig/lib/selenium/webdriver/devtools/mutation_event.rbs new file mode 100644 index 0000000000000..5045962130077 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/devtools/mutation_event.rbs @@ -0,0 +1,25 @@ +module Selenium + module WebDriver + class DevTools + class MutationEvent + @element: untyped + + @attribute_name: untyped + + @current_value: untyped + + @old_value: untyped + + attr_accessor element: untyped + + attr_accessor attribute_name: untyped + + attr_accessor current_value: untyped + + attr_accessor old_value: untyped + + def initialize: (element: untyped, attribute_name: untyped, current_value: untyped, old_value: untyped) -> void + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/devtools/network_interceptor.rbs b/rb/sig/lib/selenium/webdriver/devtools/network_interceptor.rbs new file mode 100644 index 0000000000000..3dfb6b2081188 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/devtools/network_interceptor.rbs @@ -0,0 +1,67 @@ +module Selenium + module WebDriver + class DevTools + class NetworkInterceptor + @devtools: untyped + + @lock: untyped + + @pending_response_requests: untyped + + @cancelled_requests: untyped + + # CDP fails to get body on certain responses (301) and raises: + # "Can only get response body on requests captured after headers received." + CANNOT_GET_BODY_ON_REDIRECT_ERROR_CODE: "-32000" + + # CDP fails to operate with intercepted requests. + # Typical reason is browser cancelling intercepted requests/responses. + INVALID_INTERCEPTION_ID_ERROR_CODE: "-32602" + + def initialize: (untyped devtools) -> void + + def intercept: () { () -> untyped } -> untyped + + private + + attr_accessor devtools: untyped + + attr_accessor lock: untyped + + # We should be thread-safe to use the hash without synchronization + # because its keys are interception job identifiers and they should be + # unique within a devtools session. + def pending_response_requests: () -> untyped + + # Ensure usage of cancelled_requests is thread-safe via synchronization! + def cancelled_requests: () -> untyped + + def track_cancelled_request: (untyped data) -> (nil | untyped) + + def request_paused: (untyped data) { () -> untyped } -> untyped + + # The presence of any of these fields indicate we're at the response stage. + # @see https://chromedevtools.github.io/devtools-protocol/tot/Fetch/#event-requestPaused + def response?: (untyped params) -> untyped + + def intercept_request: (untyped id, untyped params) { () -> untyped } -> untyped + + def intercept_response: (untyped id, untyped params) ?{ (untyped) -> untyped } -> untyped + + def continue_request: (untyped id) -> untyped + + alias continue_response continue_request + + def mutate_request: (untyped request) -> untyped + + def mutate_response: (untyped response) -> untyped + + def fetch_response_body: (untyped id) -> untyped + + def with_cancellable_request: (untyped network_id) { () -> untyped } -> untyped + + def cancelled?: (untyped network_id) -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/devtools/pinned_script.rbs b/rb/sig/lib/selenium/webdriver/devtools/pinned_script.rbs new file mode 100644 index 0000000000000..a5c99e3dc4bde --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/devtools/pinned_script.rbs @@ -0,0 +1,25 @@ +module Selenium + module WebDriver + class DevTools + class PinnedScript + @key: untyped + + @script: untyped + + attr_accessor key: untyped + + attr_accessor devtools_identifier: untyped + + attr_accessor script: untyped + + def initialize: (untyped script) -> void + + def callable: () -> ::String + + def to_json: (*untyped) -> ::String + + def remove: () -> ::String + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/devtools/request.rbs b/rb/sig/lib/selenium/webdriver/devtools/request.rbs new file mode 100644 index 0000000000000..e96456a5999ee --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/devtools/request.rbs @@ -0,0 +1,35 @@ +module Selenium + module WebDriver + class DevTools + class Request + @id: untyped + + @url: untyped + + @method: untyped + + @headers: untyped + + @post_data: untyped + + attr_accessor url: untyped + + attr_accessor method: untyped + + attr_accessor headers: untyped + + attr_accessor post_data: untyped + + attr_reader id: untyped + + def self.from: (untyped id, untyped params) -> untyped + + def initialize: (id: untyped, url: untyped, method: untyped, headers: untyped, post_data: untyped) -> void + + def ==: (untyped other) -> untyped + + def inspect: () -> ::String + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/edge/driver.rbs b/rb/sig/lib/selenium/webdriver/edge/driver.rbs new file mode 100644 index 0000000000000..26ed6fd59a2aa --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/edge/driver.rbs @@ -0,0 +1,17 @@ +module Selenium + module WebDriver + module Edge + class Driver < Chromium::Driver + include LocalDriver + + def initialize: (?options: untyped?, ?service: untyped?, ?url: untyped?, **untyped opts) -> void + + def browser: () -> :edge + + private + + def devtools_address: () -> ::String + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/edge/options.rbs b/rb/sig/lib/selenium/webdriver/edge/options.rbs new file mode 100644 index 0000000000000..b4939c9f17a24 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/edge/options.rbs @@ -0,0 +1,19 @@ +module Selenium + module WebDriver + module Edge + class Options < Chromium::Options + KEY: "ms:edgeOptions" + + BROWSER: "MicrosoftEdge" + + def webview2!: () -> untyped + + private + + def enable_logging: (untyped browser_options) -> untyped + + def binary_path: () -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/edge/profile.rbs b/rb/sig/lib/selenium/webdriver/edge/profile.rbs new file mode 100644 index 0000000000000..89a91fe55fa8b --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/edge/profile.rbs @@ -0,0 +1,8 @@ +module Selenium + module WebDriver + module Edge + class Profile < Chromium::Profile + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/edge/service.rbs b/rb/sig/lib/selenium/webdriver/edge/service.rbs new file mode 100644 index 0000000000000..d16910ee237be --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/edge/service.rbs @@ -0,0 +1,17 @@ +module Selenium + module WebDriver + module Edge + class Service < WebDriver::Service + @log: untyped + + DEFAULT_PORT: 9515 + + EXECUTABLE: "msedgedriver" + + SHUTDOWN_SUPPORTED: true + + def log: () -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/firefox/driver.rbs b/rb/sig/lib/selenium/webdriver/firefox/driver.rbs new file mode 100644 index 0000000000000..714c2de970ae3 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/firefox/driver.rbs @@ -0,0 +1,21 @@ +module Selenium + module WebDriver + module Firefox + class Driver < WebDriver::Driver + EXTENSIONS: ::Array[untyped] + + include LocalDriver + + def initialize: (?options: untyped?, ?service: untyped?, ?url: untyped?, **untyped opts) -> void + + def browser: () -> :firefox + + private + + def devtools_url: () -> untyped + + def devtools_version: () -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/firefox/extension.rbs b/rb/sig/lib/selenium/webdriver/firefox/extension.rbs new file mode 100644 index 0000000000000..3560de88730c6 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/firefox/extension.rbs @@ -0,0 +1,31 @@ +module Selenium + module WebDriver + module Firefox + class Extension + @path: untyped + + @should_reap_root: untyped + + NAMESPACE: "http://www.mozilla.org/2004/em-rdf#" + + def initialize: (untyped path) -> void + + def write_to: (untyped extensions_dir) -> untyped + + private + + def create_root: () -> untyped + + def read_id: (untyped directory) -> untyped + + def read_id_from_install_rdf: (untyped directory) -> (nil | untyped) + + def read_id_from_manifest_json: (untyped directory) -> (nil | untyped) + + def applications_gecko_id: (untyped manifest) -> untyped + + def name_and_version: (untyped manifest) -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/firefox/options.rbs b/rb/sig/lib/selenium/webdriver/firefox/options.rbs new file mode 100644 index 0000000000000..e56b258842a1c --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/firefox/options.rbs @@ -0,0 +1,45 @@ +module Selenium + module WebDriver + module Firefox + class Options < WebDriver::Options + @debugger_address: untyped + + @profile: untyped + + attr_accessor debugger_address: untyped + + KEY: "moz:firefoxOptions" + + # see: https://developer.mozilla.org/en-US/docs/Web/WebDriver/Capabilities/firefoxOptions + CAPABILITIES: { binary: "binary", args: "args", log: "log", prefs: "prefs", env: "env", android_package: "androidPackage", android_activity: "androidActivity", android_device_serial: "androidDeviceSerial", android_intent_arguments: "androidIntentArguments" } + + BROWSER: "firefox" + + # NOTE: special handling of 'profile' to validate when set instead of when used + attr_reader profile: untyped + + def initialize: (?log_level: untyped?, **untyped opts) -> void + + def add_argument: (untyped arg) -> untyped + + def add_preference: (untyped name, untyped value) -> untyped + + def profile=: (untyped profile) -> untyped + + def log_level: () -> untyped + + def log_level=: (untyped level) -> untyped + + def enable_android: (?package: ::String, ?serial_number: untyped?, ?activity: untyped?, ?intent_arguments: untyped?) -> untyped + + private + + def process_browser_options: (untyped browser_options) -> untyped + + def process_profile: (untyped profile) -> untyped + + def camelize?: (untyped key) -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/firefox/profile.rbs b/rb/sig/lib/selenium/webdriver/firefox/profile.rbs new file mode 100644 index 0000000000000..8948faa69a072 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/firefox/profile.rbs @@ -0,0 +1,75 @@ +module Selenium + module WebDriver + module Firefox + class Profile + self.@ini: untyped + + @model: untyped + + @additional_prefs: untyped + + @extensions: untyped + + @log_file: untyped + + include ProfileHelper + + VALID_PREFERENCE_TYPES: ::Array[untyped] + + DEFAULT_PREFERENCES: ::Hash[::String, false | "about:blank"] + + LOCK_FILES: ::Array[".parentlock" | "parent.lock" | "lock"] + + attr_reader name: untyped + + attr_reader log_file: untyped + + attr_writer secure_ssl: untyped + + attr_writer load_no_focus_lib: untyped + + def self.ini: () -> untyped + + def self.from_name: (untyped name) -> untyped + + def self.decoded: (untyped json) -> untyped + + def initialize: (?untyped? model) -> void + + def layout_on_disk: () -> untyped + + def []=: (untyped key, untyped value) -> untyped + + def port=: (untyped port) -> untyped + + def log_file=: (untyped file) -> untyped + + def add_extension: (untyped path, ?untyped name) -> untyped + + def proxy=: (untyped proxy) -> untyped + + alias as_json encoded + + private + + def set_manual_proxy_preference: (untyped key, untyped value) -> (nil | untyped) + + def install_extensions: (untyped directory) -> untyped + + def read_model_prefs: () -> (::Hash[untyped, untyped] | untyped) + + def delete_extensions_cache: (untyped directory) -> untyped + + def delete_lock_files: (untyped directory) -> untyped + + def extension_name_for: (untyped path) -> untyped + + def update_user_prefs_in: (untyped directory) -> untyped + + def read_user_prefs: (untyped path) -> untyped + + def write_prefs: (untyped prefs, untyped path) -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/firefox/profiles_ini.rbs b/rb/sig/lib/selenium/webdriver/firefox/profiles_ini.rbs new file mode 100644 index 0000000000000..a2a1712643c87 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/firefox/profiles_ini.rbs @@ -0,0 +1,24 @@ +module Selenium + module WebDriver + module Firefox + # @api private + class ProfilesIni + @ini_path: untyped + + @profile_paths: untyped + + def initialize: () -> void + + def []: (untyped name) -> untyped + + def refresh: () -> untyped + + private + + def parse: () -> untyped + + def path_for: (untyped name, untyped is_relative, untyped path) -> (nil | untyped) + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/firefox/service.rbs b/rb/sig/lib/selenium/webdriver/firefox/service.rbs new file mode 100644 index 0000000000000..85073c264be3c --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/firefox/service.rbs @@ -0,0 +1,13 @@ +module Selenium + module WebDriver + module Firefox + class Service < WebDriver::Service + DEFAULT_PORT: 4444 + + EXECUTABLE: "geckodriver" + + SHUTDOWN_SUPPORTED: false + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/firefox/util.rbs b/rb/sig/lib/selenium/webdriver/firefox/util.rbs new file mode 100644 index 0000000000000..42b3b6d458022 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/firefox/util.rbs @@ -0,0 +1,12 @@ +module Selenium + module WebDriver + module Firefox + # @api private + module Util + def self?.app_data_path: () -> untyped + + def self?.stringified?: (untyped str) -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/ie.rbs b/rb/sig/lib/selenium/webdriver/ie.rbs new file mode 100644 index 0000000000000..eb522c21b17be --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/ie.rbs @@ -0,0 +1,6 @@ +module Selenium + module WebDriver + module IE + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/ie/driver.rbs b/rb/sig/lib/selenium/webdriver/ie/driver.rbs new file mode 100644 index 0000000000000..9332cd4ab9ce7 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/ie/driver.rbs @@ -0,0 +1,15 @@ +module Selenium + module WebDriver + module IE + class Driver < WebDriver::Driver + EXTENSIONS: ::Array[untyped] + + include LocalDriver + + def initialize: (?options: untyped?, ?service: untyped?, ?url: untyped?, **untyped opts) -> void + + def browser: () -> :internet_explorer + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/ie/features.rbs b/rb/sig/lib/selenium/webdriver/ie/features.rbs new file mode 100644 index 0000000000000..26c4d5c41447f --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/ie/features.rbs @@ -0,0 +1,11 @@ +module Selenium + module WebDriver + module IE + module Features + def command_list: () -> untyped + + def commands: (untyped command) -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/ie/options.rbs b/rb/sig/lib/selenium/webdriver/ie/options.rbs new file mode 100644 index 0000000000000..e2f90e25e8e29 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/ie/options.rbs @@ -0,0 +1,29 @@ +module Selenium + module WebDriver + module IE + class Options < WebDriver::Options + @args: untyped + + KEY: "se:ieOptions" + + SCROLL_TOP: 0 + + SCROLL_BOTTOM: 1 + + CAPABILITIES: { browser_attach_timeout: "browserAttachTimeout", element_scroll_behavior: "elementScrollBehavior", full_page_screenshot: "ie.enableFullPageScreenshot", ensure_clean_session: "ie.ensureCleanSession", file_upload_dialog_timeout: "ie.fileUploadDialogTimeout", force_create_process_api: "ie.forceCreateProcessApi", force_shell_windows_api: "ie.forceShellWindowsApi", ignore_protected_mode_settings: "ignoreProtectedModeSettings", ignore_zoom_level: "ignoreZoomSetting", initial_browser_url: "initialBrowserUrl", native_events: "nativeEvents", persistent_hover: "enablePersistentHover", require_window_focus: "requireWindowFocus", use_per_process_proxy: "ie.usePerProcessProxy", use_legacy_file_upload_dialog_handling: "ie.useLegacyFileUploadDialogHandling", attach_to_edge_chrome: "ie.edgechromium", edge_executable_path: "ie.edgepath", ignore_process_match: "ie.ignoreprocessmatch" } + + BROWSER: "internet explorer" + + attr_reader args: untyped + + def initialize: (**untyped opts) -> void + + def add_argument: (untyped arg) -> untyped + + private + + def process_browser_options: (untyped browser_options) -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/ie/service.rbs b/rb/sig/lib/selenium/webdriver/ie/service.rbs new file mode 100644 index 0000000000000..d64651f359a52 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/ie/service.rbs @@ -0,0 +1,13 @@ +module Selenium + module WebDriver + module IE + class Service < WebDriver::Service + DEFAULT_PORT: 5555 + + EXECUTABLE: "IEDriverServer" + + SHUTDOWN_SUPPORTED: true + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/remote/bridge/commands.rbs b/rb/sig/lib/selenium/webdriver/remote/bridge/commands.rbs new file mode 100644 index 0000000000000..17e97e86802bd --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/remote/bridge/commands.rbs @@ -0,0 +1,9 @@ +module Selenium + module WebDriver + module Remote + class Bridge + COMMANDS: { status: ::Array[:get | "status"], new_session: ::Array[:post | "session"], delete_session: ::Array[:delete | "session/:session_id"], get: ::Array[:post | "session/:session_id/url"], get_current_url: ::Array[:get | "session/:session_id/url"], back: ::Array[:post | "session/:session_id/back"], forward: ::Array[:post | "session/:session_id/forward"], refresh: ::Array[:post | "session/:session_id/refresh"], get_title: ::Array[:get | "session/:session_id/title"], get_window_handle: ::Array[:get | "session/:session_id/window"], new_window: ::Array[:post | "session/:session_id/window/new"], close_window: ::Array[:delete | "session/:session_id/window"], switch_to_window: ::Array[:post | "session/:session_id/window"], get_window_handles: ::Array[:get | "session/:session_id/window/handles"], fullscreen_window: ::Array[:post | "session/:session_id/window/fullscreen"], minimize_window: ::Array[:post | "session/:session_id/window/minimize"], maximize_window: ::Array[:post | "session/:session_id/window/maximize"], set_window_rect: ::Array[:post | "session/:session_id/window/rect"], get_window_rect: ::Array[:get | "session/:session_id/window/rect"], switch_to_frame: ::Array[:post | "session/:session_id/frame"], switch_to_parent_frame: ::Array[:post | "session/:session_id/frame/parent"], find_element: ::Array[:post | "session/:session_id/element"], find_elements: ::Array[:post | "session/:session_id/elements"], find_child_element: ::Array[:post | "session/:session_id/element/:id/element"], find_child_elements: ::Array[:post | "session/:session_id/element/:id/elements"], find_shadow_child_element: ::Array[:post | "session/:session_id/shadow/:id/element"], find_shadow_child_elements: ::Array[:post | "session/:session_id/shadow/:id/elements"], get_active_element: ::Array[:get | "session/:session_id/element/active"], get_element_shadow_root: ::Array[:get | "session/:session_id/element/:id/shadow"], is_element_selected: ::Array[:get | "session/:session_id/element/:id/selected"], get_element_attribute: ::Array[:get | "session/:session_id/element/:id/attribute/:name"], get_element_property: ::Array[:get | "session/:session_id/element/:id/property/:name"], get_element_css_value: ::Array[:get | "session/:session_id/element/:id/css/:property_name"], get_element_aria_role: ::Array[:get | "session/:session_id/element/:id/computedrole"], get_element_aria_label: ::Array[:get | "session/:session_id/element/:id/computedlabel"], get_element_text: ::Array[:get | "session/:session_id/element/:id/text"], get_element_tag_name: ::Array[:get | "session/:session_id/element/:id/name"], get_element_rect: ::Array[:get | "session/:session_id/element/:id/rect"], is_element_enabled: ::Array[:get | "session/:session_id/element/:id/enabled"], get_page_source: ::Array[:get | "session/:session_id/source"], execute_script: ::Array[:post | "session/:session_id/execute/sync"], execute_async_script: ::Array[:post | "session/:session_id/execute/async"], get_all_cookies: ::Array[:get | "session/:session_id/cookie"], get_cookie: ::Array[:get | "session/:session_id/cookie/:name"], add_cookie: ::Array[:post | "session/:session_id/cookie"], delete_cookie: ::Array[:delete | "session/:session_id/cookie/:name"], delete_all_cookies: ::Array[:delete | "session/:session_id/cookie"], get_timeouts: ::Array[:get | "session/:session_id/timeouts"], set_timeout: ::Array[:post | "session/:session_id/timeouts"], actions: ::Array[:post | "session/:session_id/actions"], release_actions: ::Array[:delete | "session/:session_id/actions"], print_page: ::Array[:post | "session/:session_id/print"], element_click: ::Array[:post | "session/:session_id/element/:id/click"], element_clear: ::Array[:post | "session/:session_id/element/:id/clear"], element_send_keys: ::Array[:post | "session/:session_id/element/:id/value"], dismiss_alert: ::Array[:post | "session/:session_id/alert/dismiss"], accept_alert: ::Array[:post | "session/:session_id/alert/accept"], get_alert_text: ::Array[:get | "session/:session_id/alert/text"], send_alert_text: ::Array[:post | "session/:session_id/alert/text"], take_screenshot: ::Array[:get | "session/:session_id/screenshot"], take_element_screenshot: ::Array[:get | "session/:session_id/element/:id/screenshot"], add_virtual_authenticator: ::Array[:post | "session/:session_id/webauthn/authenticator"], remove_virtual_authenticator: ::Array[:delete | "session/:session_id/webauthn/authenticator/:authenticatorId"], add_credential: ::Array[:post | "session/:session_id/webauthn/authenticator/:authenticatorId/credential"], get_credentials: ::Array[:get | "session/:session_id/webauthn/authenticator/:authenticatorId/credentials"], remove_credential: ::Array[:delete | "session/:session_id/webauthn/authenticator/:authenticatorId/credentials/:credentialId"], remove_all_credentials: ::Array[:delete | "session/:session_id/webauthn/authenticator/:authenticatorId/credentials"], set_user_verified: ::Array[:post | "session/:session_id/webauthn/authenticator/:authenticatorId/uv"] } + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/remote/capabilities.rbs b/rb/sig/lib/selenium/webdriver/remote/capabilities.rbs new file mode 100644 index 0000000000000..35b9b0c80994a --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/remote/capabilities.rbs @@ -0,0 +1,71 @@ +module Selenium + module WebDriver + module Remote + class Capabilities + @capabilities: untyped + + KNOWN: ::Array[:browser_name | :browser_version | :platform_name | :accept_insecure_certs | :page_load_strategy | :proxy | :set_window_rect | :timeouts | :unhandled_prompt_behavior | :strict_file_interactability | :web_socket_url | :remote_session_id] + + def self.always_match: (untyped capabilities) -> untyped + + def self.first_match: (*untyped capabilities) -> untyped + + def self.json_create: (untyped data) -> untyped + + def self.camel_case: (untyped str_or_sym) -> untyped + + private + + def self.process_timeouts: (untyped caps, untyped timeouts) -> (nil | untyped) + + public + + def initialize: (?::Hash[untyped, untyped] opts) -> void + + def []=: (untyped key, untyped value) -> untyped + + def []: (untyped key) -> untyped + + def merge!: (untyped other) -> untyped + + def proxy: () -> untyped + + def proxy=: (untyped proxy) -> untyped + + def timeouts: () -> untyped + + def timeouts=: (untyped timeouts) -> untyped + + def implicit_timeout: () -> untyped + + def implicit_timeout=: (untyped timeout) -> untyped + + def page_load_timeout: () -> untyped + + def page_load_timeout=: (untyped timeout) -> untyped + + def script_timeout: () -> untyped + + def script_timeout=: (untyped timeout) -> untyped + + def as_json: (*untyped) -> untyped + + def to_json: (*untyped) -> untyped + + def ==: (untyped other) -> (false | untyped) + + alias eql? == + + attr_reader capabilities: untyped + + private + + def process_capabilities: (untyped key, untyped value, untyped hash) -> untyped + + def convert_key: (untyped key) -> untyped + + def convert_value: (untyped key, untyped value) -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/remote/driver.rbs b/rb/sig/lib/selenium/webdriver/remote/driver.rbs new file mode 100644 index 0000000000000..09a7f48693a3e --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/remote/driver.rbs @@ -0,0 +1,25 @@ +module Selenium + module WebDriver + module Remote + class Driver < WebDriver::Driver + include DriverExtensions::UploadsFiles + + include DriverExtensions::HasSessionId + + include DriverExtensions::HasFileDownloads + + def initialize: (?capabilities: untyped?, ?options: untyped?, ?service: untyped?, ?url: untyped?, **untyped opts) -> void + + private + + def devtools_url: () -> untyped + + def devtools_version: () -> untyped + + def process_options: (untyped options, untyped capabilities) -> untyped + + def generate_capabilities: (untyped capabilities) -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/remote/features.rbs b/rb/sig/lib/selenium/webdriver/remote/features.rbs new file mode 100644 index 0000000000000..48e7c9b835fe2 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/remote/features.rbs @@ -0,0 +1,27 @@ +module Selenium + module WebDriver + module Remote + module Features + @command_list: untyped + + REMOTE_COMMANDS: { upload_file: ::Array[:post | "session/:session_id/se/file"], get_downloadable_files: ::Array[:get | "session/:session_id/se/files"], download_file: ::Array[:post | "session/:session_id/se/files"], delete_downloadable_files: ::Array[:delete | "session/:session_id/se/files"] } + + def add_commands: (untyped commands) -> untyped + + def command_list: () -> untyped + + def commands: (untyped command) -> untyped + + def upload: (untyped local_file) -> untyped + + def upload_if_necessary: (untyped keys) -> untyped + + def downloadable_files: () -> untyped + + def download_file: (untyped name) -> untyped + + def delete_downloadable_files: () -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/remote/http/common.rbs b/rb/sig/lib/selenium/webdriver/remote/http/common.rbs new file mode 100644 index 0000000000000..282c4592aa044 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/remote/http/common.rbs @@ -0,0 +1,31 @@ +module Selenium + module WebDriver + module Remote + module Http + class Common + MAX_REDIRECTS: 20 + + CONTENT_TYPE: "application/json" + + DEFAULT_HEADERS: ::Hash[::String, untyped | ::String] + + attr_writer server_url: untyped + + def quit_errors: () -> ::Array[untyped] + + def close: () -> nil + + def call: (untyped verb, untyped url, untyped command_hash) -> untyped + + private + + def server_url: () -> untyped + + def request: (*untyped) -> untyped + + def create_response: (untyped code, untyped body, untyped content_type) -> untyped + end + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/remote/http/curb.rbs b/rb/sig/lib/selenium/webdriver/remote/http/curb.rbs new file mode 100644 index 0000000000000..03e3e6e025b53 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/remote/http/curb.rbs @@ -0,0 +1,19 @@ +module Selenium + module WebDriver + module Remote + module Http + class Curb < Common + @client: untyped + + def quit_errors: () -> untyped + + private + + def request: (untyped verb, untyped url, untyped headers, untyped payload) -> untyped + + def client: () -> untyped + end + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/remote/http/default.rbs b/rb/sig/lib/selenium/webdriver/remote/http/default.rbs new file mode 100644 index 0000000000000..0507fb559c886 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/remote/http/default.rbs @@ -0,0 +1,53 @@ +module Selenium + module WebDriver + module Remote + module Http + # @api private + class Default < Common + @open_timeout: untyped + + @read_timeout: untyped + + @http: untyped + + @proxy: untyped + + attr_writer proxy: untyped + + attr_accessor open_timeout: untyped + + attr_accessor read_timeout: untyped + + # Initializes object. + # Warning: Setting {#open_timeout} to non-nil values will cause a separate thread to spawn. + # Debuggers that freeze the process will not be able to evaluate any operations if that happens. + # @param [Numeric] open_timeout - Open timeout to apply to HTTP client. + # @param [Numeric] read_timeout - Read timeout (seconds) to apply to HTTP client. + def initialize: (?open_timeout: untyped?, ?read_timeout: untyped?) -> void + + def close: () -> untyped + + private + + def http: () -> untyped + + def start: (untyped http) -> untyped + + MAX_RETRIES: 3 + + def request: (untyped verb, untyped url, untyped headers, untyped payload, ?::Integer redirects) -> untyped + + def new_request_for: (untyped verb, untyped url, untyped headers, untyped payload) -> untyped + + def response_for: (untyped request) -> untyped + + def new_http_client: () -> untyped + + def proxy: () -> untyped + + def use_proxy?: () -> (false | untyped) + end + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/remote/server_error.rbs b/rb/sig/lib/selenium/webdriver/remote/server_error.rbs new file mode 100644 index 0000000000000..a0287c25a786e --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/remote/server_error.rbs @@ -0,0 +1,9 @@ +module Selenium + module WebDriver + module Error + class ServerError < StandardError + def initialize: (untyped response) -> void + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/safari/driver.rbs b/rb/sig/lib/selenium/webdriver/safari/driver.rbs new file mode 100644 index 0000000000000..ffa1b4a9bfc1e --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/safari/driver.rbs @@ -0,0 +1,15 @@ +module Selenium + module WebDriver + module Safari + class Driver < WebDriver::Driver + EXTENSIONS: ::Array[untyped] + + include LocalDriver + + def initialize: (?options: untyped?, ?service: untyped?, ?url: untyped?, **untyped opts) -> void + + def browser: () -> :safari + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/safari/options.rbs b/rb/sig/lib/selenium/webdriver/safari/options.rbs new file mode 100644 index 0000000000000..7c0d88040c9bc --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/safari/options.rbs @@ -0,0 +1,18 @@ +module Selenium + module WebDriver + module Safari + class Options < WebDriver::Options + attr_accessor options: untyped + + # @see https://developer.apple.com/documentation/webkit/about_webdriver_for_safari + CAPABILITIES: { automatic_inspection: "safari:automaticInspection", automatic_profiling: "safari:automaticProfiling" } + + BROWSER: untyped + + def add_option: (untyped name, ?untyped? value) -> untyped + + def as_json: (*untyped) -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/safari/service.rbs b/rb/sig/lib/selenium/webdriver/safari/service.rbs new file mode 100644 index 0000000000000..fb4e8acc5e03a --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/safari/service.rbs @@ -0,0 +1,17 @@ +module Selenium + module WebDriver + module Safari + class Service < WebDriver::Service + DEFAULT_PORT: 7050 + + EXECUTABLE: "safaridriver" + + SHUTDOWN_SUPPORTED: false + + def initialize: (?path: untyped?, ?port: untyped?, ?log: untyped?, ?args: untyped?) -> void + + def log=: (*untyped) -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/support.rbs b/rb/sig/lib/selenium/webdriver/support.rbs new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/rb/sig/lib/selenium/webdriver/support/block_event_listener.rbs b/rb/sig/lib/selenium/webdriver/support/block_event_listener.rbs new file mode 100644 index 0000000000000..8ea1651817e23 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/support/block_event_listener.rbs @@ -0,0 +1,13 @@ +module Selenium + module WebDriver + module Support + class BlockEventListener + @callback: untyped + + def initialize: (untyped callback) -> void + + def method_missing: (untyped meth, *untyped args) -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/support/color.rbs b/rb/sig/lib/selenium/webdriver/support/color.rbs new file mode 100644 index 0000000000000..4d20cee7054e4 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/support/color.rbs @@ -0,0 +1,59 @@ +module Selenium + module WebDriver + module Support + class Color + @red: untyped + + @green: untyped + + @blue: untyped + + @alpha: untyped + + RGB_PATTERN: ::Regexp + + RGB_PCT_PATTERN: ::Regexp + + RGBA_PATTERN: ::Regexp + + RGBA_PCT_PATTERN: ::Regexp + + HEX_PATTERN: ::Regexp + + HEX3_PATTERN: ::Regexp + + HSL_PATTERN: ::Regexp + + HSLA_PATTERN: ::Regexp + + attr_reader red: untyped + + attr_reader green: untyped + + attr_reader blue: untyped + + attr_reader alpha: untyped + + def self.from_string: (untyped str) -> untyped + + def self.from_hsl: (untyped h, untyped s, untyped l, untyped a) -> untyped + + def self.hue_to_rgb: (untyped lum1, untyped lum2, untyped hue) -> untyped + + def initialize: (untyped red, untyped green, untyped blue, ?::Integer alpha) -> void + + def ==: (untyped other) -> (true | false | untyped) + + alias eql? == + + def hash: () -> untyped + + def rgb: () -> ::String + + def rgba: () -> ::String + + def hex: () -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/support/escaper.rbs b/rb/sig/lib/selenium/webdriver/support/escaper.rbs new file mode 100644 index 0000000000000..8eaaf635109a5 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/support/escaper.rbs @@ -0,0 +1,9 @@ +module Selenium + module WebDriver + module Support + module Escaper + def self.escape: (untyped str) -> ::String + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/support/event_firing_bridge.rbs b/rb/sig/lib/selenium/webdriver/support/event_firing_bridge.rbs new file mode 100644 index 0000000000000..43cb36c868df1 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/support/event_firing_bridge.rbs @@ -0,0 +1,47 @@ +module Selenium + module WebDriver + module Support + class EventFiringBridge + @delegate: untyped + + @listener: untyped + + @driver: untyped + + def initialize: (untyped delegate, untyped listener) -> void + + def get: (untyped url) -> untyped + + def go_forward: () -> untyped + + def go_back: () -> untyped + + def click_element: (untyped ref) -> untyped + + def clear_element: (untyped ref) -> untyped + + def send_keys_to_element: (untyped ref, untyped keys) -> untyped + + def find_element_by: (untyped how, untyped what, ?untyped? parent) -> untyped + + def find_elements_by: (untyped how, untyped what, ?untyped? parent) -> untyped + + def execute_script: (untyped script, *untyped args) -> untyped + + def quit: () -> untyped + + def close: () -> untyped + + private + + def create_element: (untyped ref) -> untyped + + def driver: () -> untyped + + def dispatch: (untyped name, *untyped args) { () -> untyped } -> untyped + + def method_missing: (untyped meth, *untyped args) { () -> untyped } -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/support/guards.rbs b/rb/sig/lib/selenium/webdriver/support/guards.rbs new file mode 100644 index 0000000000000..189ededf30be3 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/support/guards.rbs @@ -0,0 +1,41 @@ +module Selenium + module WebDriver + module Support + class Guards + @example: untyped + + @bug_tracker: untyped + + @guard_conditions: untyped + + @guards: untyped + + @messages: untyped + + GUARD_TYPES: ::Array[:except | :only | :exclude | :exclusive | :flaky] + + attr_reader messages: untyped + + attr_accessor bug_tracker: untyped + + def initialize: (untyped example, ?bug_tracker: ::String, ?conditions: untyped?) -> void + + def add_condition: (untyped name, ?untyped? condition) { () -> untyped } -> untyped + + def add_message: (untyped name, untyped message) -> untyped + + def disposition: () -> (::Array[:skip | untyped] | ::Array[:skip | untyped] | ::Array[:pending | untyped] | nil) + + def satisfied?: (untyped guard) -> untyped + + private + + def collect_example_guards: () -> untyped + + def skipping_guard: () -> untyped + + def pending_guard: () -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/support/guards/guard.rbs b/rb/sig/lib/selenium/webdriver/support/guards/guard.rbs new file mode 100644 index 0000000000000..957d44d1155a9 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/support/guards/guard.rbs @@ -0,0 +1,44 @@ +module Selenium + module WebDriver + module Support + class Guards + class Guard + @guarded: untyped + + @tracker: untyped + + @messages: untyped + + @type: untyped + + @reason: untyped + + attr_reader guarded: untyped + + attr_reader type: untyped + + attr_reader messages: untyped + + attr_reader reason: untyped + + def initialize: (untyped guarded, untyped type, ?untyped? guards) -> void + + def message: () -> untyped + + # Bug is present on all configurations specified + def except?: () -> untyped + + # Bug is present on all configurations not specified + def only?: () -> untyped + + # Bug is present on all configurations specified, but test can not be run because it breaks other tests, + # or it is flaky and unreliable + def exclude?: () -> untyped + + # Test only applies to configurations specified + def exclusive?: () -> untyped + end + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/support/guards/guard_condition.rbs b/rb/sig/lib/selenium/webdriver/support/guards/guard_condition.rbs new file mode 100644 index 0000000000000..f7f0d50690a24 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/support/guards/guard_condition.rbs @@ -0,0 +1,21 @@ +module Selenium + module WebDriver + module Support + class Guards + class GuardCondition + @name: untyped + + @execution: untyped + + attr_accessor name: untyped + + attr_accessor execution: untyped + + def initialize: (untyped name, ?untyped? condition) ?{ () -> untyped } -> void + + def satisfied?: (untyped guard) -> untyped + end + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/support/relative_locator.rbs b/rb/sig/lib/selenium/webdriver/support/relative_locator.rbs new file mode 100644 index 0000000000000..99973b9ba12ee --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/support/relative_locator.rbs @@ -0,0 +1,17 @@ +module Selenium + module WebDriver + module Support + class RelativeLocator + @filters: untyped + + @root: untyped + + KEYS: ::Array["above" | "below" | "left" | "right" | "near" | "distance"] + + def initialize: (untyped locator) -> void + + def as_json: () -> { relative: { root: untyped, filters: untyped } } + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/support/select.rbs b/rb/sig/lib/selenium/webdriver/support/select.rbs new file mode 100644 index 0000000000000..eb93a8eb5eda0 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/support/select.rbs @@ -0,0 +1,57 @@ +module Selenium + module WebDriver + module Support + class Select + @element: untyped + + @multi: untyped + + def initialize: (untyped element) -> void + + def multiple?: () -> untyped + + def options: () -> untyped + + def selected_options: () -> untyped + + def first_selected_option: () -> untyped + + def select_by: (untyped how, untyped what) -> untyped + + def deselect_by: (untyped how, untyped what) -> untyped + + def select_all: () -> untyped + + def deselect_all: () -> untyped + + private + + def select_by_text: (untyped text) -> untyped + + def select_by_index: (untyped index) -> untyped + + def select_by_value: (untyped value) -> untyped + + def deselect_by_text: (untyped text) -> untyped + + def deselect_by_value: (untyped value) -> untyped + + def deselect_by_index: (untyped index) -> untyped + + def select_option: (untyped option) -> untyped + + def deselect_option: (untyped option) -> (untyped | nil) + + def select_options: (untyped opts) -> untyped + + def deselect_options: (untyped opts) -> untyped + + def find_by_text: (untyped text) -> untyped + + def find_by_index: (untyped index) -> untyped + + def find_by_value: (untyped value) -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/version.rbs b/rb/sig/lib/selenium/webdriver/version.rbs new file mode 100644 index 0000000000000..e865429d316b6 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/version.rbs @@ -0,0 +1,5 @@ +module Selenium + module WebDriver + VERSION: "4.16.0.nightly" + end +end diff --git a/rb/sig/lib/selenium_webdriver.rbs b/rb/sig/lib/selenium_webdriver.rbs new file mode 100644 index 0000000000000..e69de29bb2d1d From a3607d456b46d338830c932208bd67a6249f7788 Mon Sep 17 00:00:00 2001 From: aguspe Date: Mon, 11 Dec 2023 18:44:31 +0100 Subject: [PATCH 02/41] Add interface support and fix RBS issues --- rb/sig/lib/selenium/webdriver/common/driver.rbs | 4 ++-- .../selenium/webdriver/common/html5/session_storage.rbs | 2 +- .../webdriver/common/html5/shared_web_storage.rbs | 2 +- .../common/interactions/pointer_event_properties.rbs | 4 ++-- rb/sig/lib/selenium/webdriver/common/logger.rbs | 4 ++-- rb/sig/lib/selenium/webdriver/remote/bridge.rbs | 4 ++++ rb/sig/lib/selenium/webdriver/remote/bridge/commands.rbs | 2 +- rb/sig/lib/selenium/webdriver/remote/features.rbs | 8 +++++--- rb/sig/lib/selenium/webdriver/remote/response.rbs | 4 ++-- rb/sig/lib/selenium/webdriver/safari/features.rbs | 4 ++++ 10 files changed, 24 insertions(+), 14 deletions(-) diff --git a/rb/sig/lib/selenium/webdriver/common/driver.rbs b/rb/sig/lib/selenium/webdriver/common/driver.rbs index 8fd17389f9ba8..65b7cc016a8e3 100644 --- a/rb/sig/lib/selenium/webdriver/common/driver.rbs +++ b/rb/sig/lib/selenium/webdriver/common/driver.rbs @@ -59,7 +59,7 @@ module Selenium private - attr_reader bridge: Remote::Bridge + attr_reader bridge: Support::EventFiringBridge | Remote::Bridge def create_bridge: (caps: untyped caps, url: String url, ?http_client: untyped? http_client) -> untyped @@ -67,7 +67,7 @@ module Selenium def screenshot: () -> untyped - def add_extensions: (Symbol browser) -> untyped + def add_extensions: (String browser) -> void end end end diff --git a/rb/sig/lib/selenium/webdriver/common/html5/session_storage.rbs b/rb/sig/lib/selenium/webdriver/common/html5/session_storage.rbs index 30773de5699d8..4c05020d0b60a 100644 --- a/rb/sig/lib/selenium/webdriver/common/html5/session_storage.rbs +++ b/rb/sig/lib/selenium/webdriver/common/html5/session_storage.rbs @@ -4,7 +4,7 @@ module Selenium class SessionStorage @bridge: untyped - include Enumerable + include Enumerable[untyped] include SharedWebStorage diff --git a/rb/sig/lib/selenium/webdriver/common/html5/shared_web_storage.rbs b/rb/sig/lib/selenium/webdriver/common/html5/shared_web_storage.rbs index 53d8eac284568..036c1ceee7c81 100644 --- a/rb/sig/lib/selenium/webdriver/common/html5/shared_web_storage.rbs +++ b/rb/sig/lib/selenium/webdriver/common/html5/shared_web_storage.rbs @@ -2,7 +2,7 @@ module Selenium module WebDriver module HTML5 module SharedWebStorage - include Enumerable + include Enumerable[untyped] def key?: (untyped key) -> untyped diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/pointer_event_properties.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/pointer_event_properties.rbs index 88efe4552b9df..4d60b65b18976 100644 --- a/rb/sig/lib/selenium/webdriver/common/interactions/pointer_event_properties.rbs +++ b/rb/sig/lib/selenium/webdriver/common/interactions/pointer_event_properties.rbs @@ -2,13 +2,13 @@ module Selenium module WebDriver module Interactions module PointerEventProperties - VALID: { width: ::Hash[::String, { min: ::Float }], height: ::Hash[::String, { min: ::Float }], pressure: ::Hash[::String, { min: ::Float, max: ::Float }], tangential_pressure: ::Hash[::String, { min: ::Float, max: ::Float }], tilt_x: ::Hash[::String, { min: -90, max: 90 }], tilt_y: ::Hash[::String, { min: -90, max: 90 }], twist: ::Hash[::String, { min: 0, max: 359 }], altitude_angle: ::Hash[::String, { min: ::Float, max: untyped }], azimuth_angle: ::Hash[::String, { min: ::Float, max: untyped }] } + VALID: untyped def process_opts: () -> untyped private - def assert_number: (untyped num, untyped min, ?untyped? max) -> (nil | untyped) + def assert_number: (untyped, untyped, ?untyped) -> untyped end end end diff --git a/rb/sig/lib/selenium/webdriver/common/logger.rbs b/rb/sig/lib/selenium/webdriver/common/logger.rbs index 76373351eeccc..9c100514dbf55 100644 --- a/rb/sig/lib/selenium/webdriver/common/logger.rbs +++ b/rb/sig/lib/selenium/webdriver/common/logger.rbs @@ -25,9 +25,9 @@ module Selenium def info: (String message, ?id: Symbol | Array[Symbol] id) ?{ () -> void } -> void - def error: (String message, ?id: Symbol | Array[Symbol] id) { () -> void } -> void + def error: (String message, ?id: Symbol | Array[Symbol] id) ?{ () -> void } -> void - def warn: (String message, ?id: Symbol | Array[Symbol] id) { () -> void } -> void + def warn: (String message, ?id: Symbol | Array[Symbol] id) ?{ () -> void } -> void def deprecate: (String old, ?String? new, ?id: Symbol | Array[Symbol] id, ?reference: ::String reference) { () -> void } -> (void) diff --git a/rb/sig/lib/selenium/webdriver/remote/bridge.rbs b/rb/sig/lib/selenium/webdriver/remote/bridge.rbs index 936c06ca4b54e..92d9c15bfeaa4 100644 --- a/rb/sig/lib/selenium/webdriver/remote/bridge.rbs +++ b/rb/sig/lib/selenium/webdriver/remote/bridge.rbs @@ -247,6 +247,10 @@ module Selenium UNICODE_CODE_POINT: 30 def escape_css: (untyped string) -> untyped + + interface _BridgeInterface + def execute: (Symbol command, ?untyped opts, ?untyped command_hash) -> untyped + end end end end diff --git a/rb/sig/lib/selenium/webdriver/remote/bridge/commands.rbs b/rb/sig/lib/selenium/webdriver/remote/bridge/commands.rbs index 17e97e86802bd..35ea169749162 100644 --- a/rb/sig/lib/selenium/webdriver/remote/bridge/commands.rbs +++ b/rb/sig/lib/selenium/webdriver/remote/bridge/commands.rbs @@ -2,7 +2,7 @@ module Selenium module WebDriver module Remote class Bridge - COMMANDS: { status: ::Array[:get | "status"], new_session: ::Array[:post | "session"], delete_session: ::Array[:delete | "session/:session_id"], get: ::Array[:post | "session/:session_id/url"], get_current_url: ::Array[:get | "session/:session_id/url"], back: ::Array[:post | "session/:session_id/back"], forward: ::Array[:post | "session/:session_id/forward"], refresh: ::Array[:post | "session/:session_id/refresh"], get_title: ::Array[:get | "session/:session_id/title"], get_window_handle: ::Array[:get | "session/:session_id/window"], new_window: ::Array[:post | "session/:session_id/window/new"], close_window: ::Array[:delete | "session/:session_id/window"], switch_to_window: ::Array[:post | "session/:session_id/window"], get_window_handles: ::Array[:get | "session/:session_id/window/handles"], fullscreen_window: ::Array[:post | "session/:session_id/window/fullscreen"], minimize_window: ::Array[:post | "session/:session_id/window/minimize"], maximize_window: ::Array[:post | "session/:session_id/window/maximize"], set_window_rect: ::Array[:post | "session/:session_id/window/rect"], get_window_rect: ::Array[:get | "session/:session_id/window/rect"], switch_to_frame: ::Array[:post | "session/:session_id/frame"], switch_to_parent_frame: ::Array[:post | "session/:session_id/frame/parent"], find_element: ::Array[:post | "session/:session_id/element"], find_elements: ::Array[:post | "session/:session_id/elements"], find_child_element: ::Array[:post | "session/:session_id/element/:id/element"], find_child_elements: ::Array[:post | "session/:session_id/element/:id/elements"], find_shadow_child_element: ::Array[:post | "session/:session_id/shadow/:id/element"], find_shadow_child_elements: ::Array[:post | "session/:session_id/shadow/:id/elements"], get_active_element: ::Array[:get | "session/:session_id/element/active"], get_element_shadow_root: ::Array[:get | "session/:session_id/element/:id/shadow"], is_element_selected: ::Array[:get | "session/:session_id/element/:id/selected"], get_element_attribute: ::Array[:get | "session/:session_id/element/:id/attribute/:name"], get_element_property: ::Array[:get | "session/:session_id/element/:id/property/:name"], get_element_css_value: ::Array[:get | "session/:session_id/element/:id/css/:property_name"], get_element_aria_role: ::Array[:get | "session/:session_id/element/:id/computedrole"], get_element_aria_label: ::Array[:get | "session/:session_id/element/:id/computedlabel"], get_element_text: ::Array[:get | "session/:session_id/element/:id/text"], get_element_tag_name: ::Array[:get | "session/:session_id/element/:id/name"], get_element_rect: ::Array[:get | "session/:session_id/element/:id/rect"], is_element_enabled: ::Array[:get | "session/:session_id/element/:id/enabled"], get_page_source: ::Array[:get | "session/:session_id/source"], execute_script: ::Array[:post | "session/:session_id/execute/sync"], execute_async_script: ::Array[:post | "session/:session_id/execute/async"], get_all_cookies: ::Array[:get | "session/:session_id/cookie"], get_cookie: ::Array[:get | "session/:session_id/cookie/:name"], add_cookie: ::Array[:post | "session/:session_id/cookie"], delete_cookie: ::Array[:delete | "session/:session_id/cookie/:name"], delete_all_cookies: ::Array[:delete | "session/:session_id/cookie"], get_timeouts: ::Array[:get | "session/:session_id/timeouts"], set_timeout: ::Array[:post | "session/:session_id/timeouts"], actions: ::Array[:post | "session/:session_id/actions"], release_actions: ::Array[:delete | "session/:session_id/actions"], print_page: ::Array[:post | "session/:session_id/print"], element_click: ::Array[:post | "session/:session_id/element/:id/click"], element_clear: ::Array[:post | "session/:session_id/element/:id/clear"], element_send_keys: ::Array[:post | "session/:session_id/element/:id/value"], dismiss_alert: ::Array[:post | "session/:session_id/alert/dismiss"], accept_alert: ::Array[:post | "session/:session_id/alert/accept"], get_alert_text: ::Array[:get | "session/:session_id/alert/text"], send_alert_text: ::Array[:post | "session/:session_id/alert/text"], take_screenshot: ::Array[:get | "session/:session_id/screenshot"], take_element_screenshot: ::Array[:get | "session/:session_id/element/:id/screenshot"], add_virtual_authenticator: ::Array[:post | "session/:session_id/webauthn/authenticator"], remove_virtual_authenticator: ::Array[:delete | "session/:session_id/webauthn/authenticator/:authenticatorId"], add_credential: ::Array[:post | "session/:session_id/webauthn/authenticator/:authenticatorId/credential"], get_credentials: ::Array[:get | "session/:session_id/webauthn/authenticator/:authenticatorId/credentials"], remove_credential: ::Array[:delete | "session/:session_id/webauthn/authenticator/:authenticatorId/credentials/:credentialId"], remove_all_credentials: ::Array[:delete | "session/:session_id/webauthn/authenticator/:authenticatorId/credentials"], set_user_verified: ::Array[:post | "session/:session_id/webauthn/authenticator/:authenticatorId/uv"] } + COMMANDS: Hash[Symbol, Array[Symbol | String]] end end end diff --git a/rb/sig/lib/selenium/webdriver/remote/features.rbs b/rb/sig/lib/selenium/webdriver/remote/features.rbs index 48e7c9b835fe2..f073af729255e 100644 --- a/rb/sig/lib/selenium/webdriver/remote/features.rbs +++ b/rb/sig/lib/selenium/webdriver/remote/features.rbs @@ -2,15 +2,17 @@ module Selenium module WebDriver module Remote module Features + include Bridge::_BridgeInterface + @command_list: untyped - REMOTE_COMMANDS: { upload_file: ::Array[:post | "session/:session_id/se/file"], get_downloadable_files: ::Array[:get | "session/:session_id/se/files"], download_file: ::Array[:post | "session/:session_id/se/files"], delete_downloadable_files: ::Array[:delete | "session/:session_id/se/files"] } + REMOTE_COMMANDS: Hash[Symbol, Array[Symbol | String]] def add_commands: (untyped commands) -> untyped - def command_list: () -> untyped + def command_list: () -> Hash[Symbol, Array[Symbol | String]] - def commands: (untyped command) -> untyped + def commands: (Symbol command) -> Array[Symbol | String]? def upload: (untyped local_file) -> untyped diff --git a/rb/sig/lib/selenium/webdriver/remote/response.rbs b/rb/sig/lib/selenium/webdriver/remote/response.rbs index 92a6c08abcedb..ff18ed5caac38 100644 --- a/rb/sig/lib/selenium/webdriver/remote/response.rbs +++ b/rb/sig/lib/selenium/webdriver/remote/response.rbs @@ -22,9 +22,9 @@ module Selenium def add_backtrace: (untyped ex, untyped server_trace) -> (nil | untyped) - def backtrace_from_remote: (untyped server_trace) -> Array[untyped] + def backtrace_from_remote: (untyped server_trace) -> untyped - def process_error: () -> (nil | ::Array[untyped]) + def process_error: () -> (nil | untyped) end end end diff --git a/rb/sig/lib/selenium/webdriver/safari/features.rbs b/rb/sig/lib/selenium/webdriver/safari/features.rbs index e4dc1c06ed25e..642dcd8d8f75a 100644 --- a/rb/sig/lib/selenium/webdriver/safari/features.rbs +++ b/rb/sig/lib/selenium/webdriver/safari/features.rbs @@ -2,8 +2,12 @@ module Selenium module WebDriver module Safari module Features + include Remote::Bridge::_BridgeInterface + SAFARI_COMMANDS: Hash[Symbol, Array[Symbol | String]] + def command_list: -> untyped + def commands: (untyped command) -> untyped def permissions: () -> untyped From 2bf77ffcbf457475e7f2916e57c73065f6ecf76e Mon Sep 17 00:00:00 2001 From: aguspe Date: Thu, 18 Jan 2024 21:23:55 +0100 Subject: [PATCH 03/41] Fix RBS errors related to type, amount of errors 270 --- rb/sig/lib/selenium/webdriver/chrome/features.rbs | 2 ++ rb/sig/lib/selenium/webdriver/common/driver.rbs | 4 +++- rb/sig/lib/selenium/webdriver/common/element.rbs | 2 +- rb/sig/lib/selenium/webdriver/common/logger.rbs | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/rb/sig/lib/selenium/webdriver/chrome/features.rbs b/rb/sig/lib/selenium/webdriver/chrome/features.rbs index 71803ec58b589..da96fa5177673 100644 --- a/rb/sig/lib/selenium/webdriver/chrome/features.rbs +++ b/rb/sig/lib/selenium/webdriver/chrome/features.rbs @@ -6,6 +6,8 @@ module Selenium CHROME_COMMANDS: Hash[Symbol, Array[Symbol | String]] + def command_list: -> untyped + def commands: (Symbol command) -> Array[Symbol | String] end end diff --git a/rb/sig/lib/selenium/webdriver/common/driver.rbs b/rb/sig/lib/selenium/webdriver/common/driver.rbs index 65b7cc016a8e3..ab9fa2d02dfc5 100644 --- a/rb/sig/lib/selenium/webdriver/common/driver.rbs +++ b/rb/sig/lib/selenium/webdriver/common/driver.rbs @@ -5,9 +5,11 @@ module Selenium include TakesScreenshot + @navigate: untyped + def self.for: (Symbol browser, ?::Hash[Symbol, untyped] opts) -> Driver - def initialize: (?bridge: Remote::Bridge? bridge, ?listener: Support::AbstractEventListener? listener, **untyped opts) -> void + def initialize: (?bridge: Support::EventFiringBridge? bridge, ?listener: Support::AbstractEventListener? listener, **untyped opts) -> void def inspect: () -> String diff --git a/rb/sig/lib/selenium/webdriver/common/element.rbs b/rb/sig/lib/selenium/webdriver/common/element.rbs index 1867302ae2c5c..f34e79545e8dd 100644 --- a/rb/sig/lib/selenium/webdriver/common/element.rbs +++ b/rb/sig/lib/selenium/webdriver/common/element.rbs @@ -7,7 +7,7 @@ module Selenium include TakesScreenshot - def initialize: (Remote::Bridge bridge, String id) -> void + def initialize: (Support::EventFiringBridge bridge, String id) -> void def inspect: () -> untyped diff --git a/rb/sig/lib/selenium/webdriver/common/logger.rbs b/rb/sig/lib/selenium/webdriver/common/logger.rbs index 9c100514dbf55..26108510d4b96 100644 --- a/rb/sig/lib/selenium/webdriver/common/logger.rbs +++ b/rb/sig/lib/selenium/webdriver/common/logger.rbs @@ -21,7 +21,7 @@ module Selenium def allow: (*Symbol ids) -> Array[Symbol] - def debug: (String message, ?id: Symbol | Array[Symbol] id) ?{ () -> void } -> void + def debug: (?String ?message, ?id: Symbol | Array[Symbol] id) ?{ () -> void } -> void def info: (String message, ?id: Symbol | Array[Symbol] id) ?{ () -> void } -> void From 227f8c1c3fd345077f56a6f936b500f6e1c19caf Mon Sep 17 00:00:00 2001 From: aguspe Date: Tue, 23 Jan 2024 17:10:53 +0100 Subject: [PATCH 04/41] Add missing RBS file coverage, reducing errors to 269 --- .../lib/selenium/support/nightly_version_generator.rbs | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 rb/sig/lib/selenium/support/nightly_version_generator.rbs diff --git a/rb/sig/lib/selenium/support/nightly_version_generator.rbs b/rb/sig/lib/selenium/support/nightly_version_generator.rbs new file mode 100644 index 0000000000000..4d784559d3e95 --- /dev/null +++ b/rb/sig/lib/selenium/support/nightly_version_generator.rbs @@ -0,0 +1,9 @@ +module Selenium + module Support + class NightlyVersionGenerator + REGEXP: ::Regexp + + def self.call: (untyped version_file, untyped version_suffix) -> untyped + end + end +end From 751ea216fcaae39a2d6b8012feccda2dd79dc806 Mon Sep 17 00:00:00 2001 From: aguspe Date: Mon, 5 Feb 2024 22:20:36 +0100 Subject: [PATCH 05/41] Reduce errors to 268 --- rb/sig/lib/selenium/webdriver.rbs | 2 +- rb/sig/lib/selenium/webdriver/common/action_builder.rbs | 2 +- rb/sig/lib/selenium/webdriver/common/driver.rbs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rb/sig/lib/selenium/webdriver.rbs b/rb/sig/lib/selenium/webdriver.rbs index 63e1f3bc11f91..147911acb6a0a 100644 --- a/rb/sig/lib/selenium/webdriver.rbs +++ b/rb/sig/lib/selenium/webdriver.rbs @@ -27,7 +27,7 @@ module Selenium def self.root: () -> String - def self.for: (*String args) -> WebDriver::Driver + def self.for: (*untyped args) -> untyped def self.logger: (**String | Symbol opts) -> WebDriver::Logger end diff --git a/rb/sig/lib/selenium/webdriver/common/action_builder.rbs b/rb/sig/lib/selenium/webdriver/common/action_builder.rbs index fecf0e2a94201..89d560dc23d81 100644 --- a/rb/sig/lib/selenium/webdriver/common/action_builder.rbs +++ b/rb/sig/lib/selenium/webdriver/common/action_builder.rbs @@ -21,7 +21,7 @@ module Selenium def add_pointer_input: (Symbol kind, String name) -> Interactions::PointerInput - def add_key_input: (String name) -> Interactions::KeyInput + def add_key_input: (String name) -> Interactions::InputDevice def add_wheel_input: (String name) -> Interactions::WheelInput diff --git a/rb/sig/lib/selenium/webdriver/common/driver.rbs b/rb/sig/lib/selenium/webdriver/common/driver.rbs index ab9fa2d02dfc5..4df5f29f8b3f0 100644 --- a/rb/sig/lib/selenium/webdriver/common/driver.rbs +++ b/rb/sig/lib/selenium/webdriver/common/driver.rbs @@ -7,7 +7,7 @@ module Selenium @navigate: untyped - def self.for: (Symbol browser, ?::Hash[Symbol, untyped] opts) -> Driver + def self.for: (Symbol browser, ?Hash[Symbol, untyped] opts) -> untyped def initialize: (?bridge: Support::EventFiringBridge? bridge, ?listener: Support::AbstractEventListener? listener, **untyped opts) -> void From 06b8c47ffcd190462fdf18d8c623ec9337c24eb1 Mon Sep 17 00:00:00 2001 From: aguspe Date: Tue, 6 Feb 2024 21:07:26 +0100 Subject: [PATCH 06/41] Reduce errors to 250 --- rb/sig/lib/selenium/webdriver/common/driver.rbs | 2 +- .../selenium/webdriver/common/interactions/pointer_actions.rbs | 2 +- rb/sig/lib/selenium/webdriver/common/logger.rbs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rb/sig/lib/selenium/webdriver/common/driver.rbs b/rb/sig/lib/selenium/webdriver/common/driver.rbs index 4df5f29f8b3f0..a5d54a11de000 100644 --- a/rb/sig/lib/selenium/webdriver/common/driver.rbs +++ b/rb/sig/lib/selenium/webdriver/common/driver.rbs @@ -61,7 +61,7 @@ module Selenium private - attr_reader bridge: Support::EventFiringBridge | Remote::Bridge + attr_reader bridge: untyped def create_bridge: (caps: untyped caps, url: String url, ?http_client: untyped? http_client) -> untyped diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/pointer_actions.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/pointer_actions.rbs index e5d64f4e1e073..70bfd1a5a163f 100644 --- a/rb/sig/lib/selenium/webdriver/common/interactions/pointer_actions.rbs +++ b/rb/sig/lib/selenium/webdriver/common/interactions/pointer_actions.rbs @@ -35,7 +35,7 @@ module Selenium def button_action: (Symbol button, Symbol action, ?device: Symbol | String?, **Symbol | String opts) -> self - def pointer_input: (?Symbol | String? name) -> Interactions::InputDevice + def pointer_input: (?Symbol | String? name) -> Interactions::PointerInput end end end diff --git a/rb/sig/lib/selenium/webdriver/common/logger.rbs b/rb/sig/lib/selenium/webdriver/common/logger.rbs index e895190dd2702..64c4ba5f3d2dc 100644 --- a/rb/sig/lib/selenium/webdriver/common/logger.rbs +++ b/rb/sig/lib/selenium/webdriver/common/logger.rbs @@ -21,7 +21,7 @@ module Selenium def allow: (*Symbol | Array[Symbol] ids) -> Array[Symbol] - def debug: (?String ?message, ?id: Symbol | Array[Symbol] id) ?{ () -> void } -> void + def debug: (?String message, ?id: Symbol | Array[Symbol] id) ?{ () -> void } -> void def info: (String message, ?id: Symbol | Array[Symbol] id) ?{ () -> void } -> void From 22385068bdbe48e8febe4f34317bc8118dc3d814 Mon Sep 17 00:00:00 2001 From: aguspe Date: Wed, 7 Feb 2024 21:04:14 +0100 Subject: [PATCH 07/41] Reduce errors to 246 --- rb/sig/lib/selenium/webdriver/common/action_builder.rbs | 4 ++-- rb/sig/lib/selenium/webdriver/common/element.rbs | 2 +- .../selenium/webdriver/common/interactions/input_device.rbs | 2 +- rb/sig/lib/selenium/webdriver/common/takes_screenshot.rbs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/rb/sig/lib/selenium/webdriver/common/action_builder.rbs b/rb/sig/lib/selenium/webdriver/common/action_builder.rbs index 89d560dc23d81..63d99ef524bdc 100644 --- a/rb/sig/lib/selenium/webdriver/common/action_builder.rbs +++ b/rb/sig/lib/selenium/webdriver/common/action_builder.rbs @@ -19,11 +19,11 @@ module Selenium def initialize: (Remote::Bridge bridge, ?devices: Array[Interactions::InputDevice], ?async: bool, ?duration: ::Integer) -> void - def add_pointer_input: (Symbol kind, String name) -> Interactions::PointerInput + def add_pointer_input: (Symbol kind, String name) -> Interactions::InputDevice def add_key_input: (String name) -> Interactions::InputDevice - def add_wheel_input: (String name) -> Interactions::WheelInput + def add_wheel_input: (String name) -> Interactions::InputDevice def device: (?name: String?, ?type: String?) -> Selenium::WebDriver::Interactions::InputDevice? diff --git a/rb/sig/lib/selenium/webdriver/common/element.rbs b/rb/sig/lib/selenium/webdriver/common/element.rbs index f34e79545e8dd..1867302ae2c5c 100644 --- a/rb/sig/lib/selenium/webdriver/common/element.rbs +++ b/rb/sig/lib/selenium/webdriver/common/element.rbs @@ -7,7 +7,7 @@ module Selenium include TakesScreenshot - def initialize: (Support::EventFiringBridge bridge, String id) -> void + def initialize: (Remote::Bridge bridge, String id) -> void def inspect: () -> untyped diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/input_device.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/input_device.rbs index 153405f4f6edb..98d2ba3c072e0 100644 --- a/rb/sig/lib/selenium/webdriver/common/interactions/input_device.rbs +++ b/rb/sig/lib/selenium/webdriver/common/interactions/input_device.rbs @@ -18,7 +18,7 @@ module Selenium def clear_actions: () -> [] - def create_pause: (Integer duration) -> Array[Interaction] + def create_pause: (Float duration) -> Array[Interaction] def encode: () -> ({ type: String, id: String, actions: Array[untyped] } | nil) end diff --git a/rb/sig/lib/selenium/webdriver/common/takes_screenshot.rbs b/rb/sig/lib/selenium/webdriver/common/takes_screenshot.rbs index 3623848c69596..f9604b93337e4 100644 --- a/rb/sig/lib/selenium/webdriver/common/takes_screenshot.rbs +++ b/rb/sig/lib/selenium/webdriver/common/takes_screenshot.rbs @@ -3,7 +3,7 @@ module Selenium module TakesScreenshot def save_screenshot: (String png_path, ?full_page: bool full_page) -> untyped - def screenshot_as: (Symbol format, ?full_page: bool full_page) -> String + def screenshot_as: (Symbol format, ?full_page: bool full_page) -> (::Integer | ::Float | ::String | nil) end end end From 299b76a2a80c065686f284d222d2db6ad7dfcf48 Mon Sep 17 00:00:00 2001 From: aguspe Date: Sat, 10 Feb 2024 19:48:02 +0100 Subject: [PATCH 08/41] Reduce errors to 240 --- rb/Steepfile | 5 +++++ rb/lib/selenium/webdriver.rb | 2 +- rb/lib/selenium/webdriver/common/socket_poller.rb | 2 +- rb/lib/selenium/webdriver/remote/capabilities.rb | 2 +- rb/lib/selenium/webdriver/remote/http/default.rb | 2 +- rb/sig/lib/selenium/webdriver/common/driver.rbs | 2 +- rb/sig/lib/selenium/webdriver/common/element.rbs | 2 +- rb/sig/lib/selenium/webdriver/common/socket_poller.rbs | 2 +- 8 files changed, 12 insertions(+), 7 deletions(-) diff --git a/rb/Steepfile b/rb/Steepfile index cd3f3312874c7..d377e55385f5a 100644 --- a/rb/Steepfile +++ b/rb/Steepfile @@ -1,6 +1,11 @@ target :lib do signature 'sig' # Signature directory check 'lib' # Directory name + ignore( + 'lib/selenium/webdriver/common/platform.rb', # Ignore line 166 due to UDP RBS issue + 'lib/selenium/webdriver/remote/http/curb.rb' # Ignore due to webmock gem not having RBS signatures + ) + library( 'base64', diff --git a/rb/lib/selenium/webdriver.rb b/rb/lib/selenium/webdriver.rb index 290b3344ebaac..5b82fc1a0554d 100644 --- a/rb/lib/selenium/webdriver.rb +++ b/rb/lib/selenium/webdriver.rb @@ -49,7 +49,7 @@ module WebDriver # @api private def self.root - @root ||= File.expand_path('..', __dir__) + @root ||= File.expand_path('..', __dir__.to_s) end # diff --git a/rb/lib/selenium/webdriver/common/socket_poller.rb b/rb/lib/selenium/webdriver/common/socket_poller.rb index 3dd80a9c9eee6..a638454a026ba 100644 --- a/rb/lib/selenium/webdriver/common/socket_poller.rb +++ b/rb/lib/selenium/webdriver/common/socket_poller.rb @@ -78,7 +78,7 @@ def listening? def listening? addr = Socket.getaddrinfo(@host, @port, Socket::AF_INET, Socket::SOCK_STREAM) sock = Socket.new(Socket::AF_INET, Socket::SOCK_STREAM, 0) - sockaddr = Socket.pack_sockaddr_in(@port, addr[0][3]) + sockaddr = Socket.pack_sockaddr_in(@port, addr[0][3].to_s) begin sock.connect_nonblock sockaddr diff --git a/rb/lib/selenium/webdriver/remote/capabilities.rb b/rb/lib/selenium/webdriver/remote/capabilities.rb index 4bcac5e12c4bd..ce6b59d461bc6 100644 --- a/rb/lib/selenium/webdriver/remote/capabilities.rb +++ b/rb/lib/selenium/webdriver/remote/capabilities.rb @@ -99,7 +99,7 @@ def json_create(data) end def camel_case(str_or_sym) - str_or_sym.to_s.gsub(/_([a-z])/) { Regexp.last_match(1).upcase } + str_or_sym.to_s.gsub(/_([a-z])/) { Regexp.last_match(1)&.upcase } end private diff --git a/rb/lib/selenium/webdriver/remote/http/default.rb b/rb/lib/selenium/webdriver/remote/http/default.rb index 2677eefc2de15..554a02f61d713 100644 --- a/rb/lib/selenium/webdriver/remote/http/default.rb +++ b/rb/lib/selenium/webdriver/remote/http/default.rb @@ -97,7 +97,7 @@ def request(verb, url, headers, payload, redirects = 0) WebDriver.logger.debug("Redirect to #{response['Location']}; times: #{redirects}") raise Error::WebDriverError, 'too many redirects' if redirects >= MAX_REDIRECTS - request(:get, URI.parse(response['Location']), DEFAULT_HEADERS.dup, nil, redirects + 1) + request(:get, URI.parse(response['Location'].to_s), DEFAULT_HEADERS.dup, nil, redirects + 1) else WebDriver.logger.debug(" <<< #{response.instance_variable_get(:@header).inspect}", id: :header) create_response response.code, response.body, response.content_type diff --git a/rb/sig/lib/selenium/webdriver/common/driver.rbs b/rb/sig/lib/selenium/webdriver/common/driver.rbs index a5d54a11de000..4445bbeddb1f8 100644 --- a/rb/sig/lib/selenium/webdriver/common/driver.rbs +++ b/rb/sig/lib/selenium/webdriver/common/driver.rbs @@ -7,7 +7,7 @@ module Selenium @navigate: untyped - def self.for: (Symbol browser, ?Hash[Symbol, untyped] opts) -> untyped + def self.for: (*Symbol | Hash[Symbol, untyped]) -> untyped def initialize: (?bridge: Support::EventFiringBridge? bridge, ?listener: Support::AbstractEventListener? listener, **untyped opts) -> void diff --git a/rb/sig/lib/selenium/webdriver/common/element.rbs b/rb/sig/lib/selenium/webdriver/common/element.rbs index 1867302ae2c5c..f34e79545e8dd 100644 --- a/rb/sig/lib/selenium/webdriver/common/element.rbs +++ b/rb/sig/lib/selenium/webdriver/common/element.rbs @@ -7,7 +7,7 @@ module Selenium include TakesScreenshot - def initialize: (Remote::Bridge bridge, String id) -> void + def initialize: (Support::EventFiringBridge bridge, String id) -> void def inspect: () -> untyped diff --git a/rb/sig/lib/selenium/webdriver/common/socket_poller.rbs b/rb/sig/lib/selenium/webdriver/common/socket_poller.rbs index 2bae99a206bf0..815c1819ee403 100644 --- a/rb/sig/lib/selenium/webdriver/common/socket_poller.rbs +++ b/rb/sig/lib/selenium/webdriver/common/socket_poller.rbs @@ -17,7 +17,7 @@ module Selenium private - CONNECT_TIMEOUT: 5 + CONNECT_TIMEOUT: Integer NOT_CONNECTED_ERRORS: untyped From 25b1620f50b686f99585e064501e08d8e5079c80 Mon Sep 17 00:00:00 2001 From: aguspe Date: Sat, 10 Feb 2024 21:20:26 +0100 Subject: [PATCH 09/41] Reduce errors to 224 --- .../webdriver/common/action_builder.rbs | 2 +- .../common/interactions/pointer_actions.rbs | 38 ++++++++++++------- .../common/interactions/pointer_input.rbs | 2 +- .../lib/selenium/webdriver/support/color.rbs | 4 +- 4 files changed, 28 insertions(+), 18 deletions(-) diff --git a/rb/sig/lib/selenium/webdriver/common/action_builder.rbs b/rb/sig/lib/selenium/webdriver/common/action_builder.rbs index 63d99ef524bdc..b52dc09cb95db 100644 --- a/rb/sig/lib/selenium/webdriver/common/action_builder.rbs +++ b/rb/sig/lib/selenium/webdriver/common/action_builder.rbs @@ -25,7 +25,7 @@ module Selenium def add_wheel_input: (String name) -> Interactions::InputDevice - def device: (?name: String?, ?type: String?) -> Selenium::WebDriver::Interactions::InputDevice? + def device: (?name: String?, ?type: String?) -> Interactions::InputDevice? def pointer_inputs: () -> Array[Interactions::InputDevice] diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/pointer_actions.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/pointer_actions.rbs index 70bfd1a5a163f..5ace4bd2a4ad9 100644 --- a/rb/sig/lib/selenium/webdriver/common/interactions/pointer_actions.rbs +++ b/rb/sig/lib/selenium/webdriver/common/interactions/pointer_actions.rbs @@ -1,41 +1,51 @@ module Selenium module WebDriver module PointerActions + include _ActionBuilder + @default_move_duration: untyped attr_writer default_move_duration: Integer def default_move_duration: () -> Integer - def pointer_down: (?Symbol button, ?device: String | Symbol?, **Symbol | String opts) -> self + def pointer_down: (?Symbol button, ?device: String | Symbol?, **Symbol | String opts) -> PointerActions - def pointer_up: (?Symbol button, ?device: String | Symbol?, **Symbol | String opts) -> self + def pointer_up: (?Symbol button, ?device: String | Symbol?, **Symbol | String opts) -> PointerActions - def move_to: (Element element, ?Integer? right_by, ?Integer? down_by, **Symbol | String opts) -> self + def move_to: (Element element, ?Integer? right_by, ?Integer? down_by, **Symbol | String | nil opts) -> PointerActions - def move_by: (Integer right_by, Integer down_by, ?device: Symbol | String?, ?duration: Integer, **Symbol | String opts) -> self + def move_by: (Integer right_by, Integer down_by, ?device: Symbol | String?, ?duration: Integer, **Symbol | String opts) -> PointerActions - def move_to_location: (Integer x, Integer y, ?device: Symbol | String?, ?duration: Integer, **Symbol | String opts) -> self + def move_to_location: (Integer x, Integer y, ?device: Symbol | String?, ?duration: Integer, **Symbol | String opts) -> PointerActions - def click_and_hold: (?Element ?element, ?button: Symbol?, ?device: Symbol | String?) -> self + def click_and_hold: (?Element ?element, ?button: Symbol?, ?device: Symbol | String?) -> PointerActions - def release: (?button: Symbol?, ?device: Symbol | String?) -> self + def release: (?button: Symbol?, ?device: Symbol | String?) -> PointerActions - def click: (?Element ?element, ?button: Symbol?, ?device: Symbol | String?) -> self + def click: (?Element ?element, ?button: Symbol?, ?device: Symbol | String?) -> PointerActions - def double_click: (?Element? element, ?device: Symbol | String?) -> self + def double_click: (?Element? element, ?device: Symbol | String?) -> PointerActions - def context_click: (?Element? element, ?device: Symbol | String?) -> self + def context_click: (?Element? element, ?device: Symbol | String?) -> PointerActions - def drag_and_drop: (Element source, Element target, ?device: Symbol | String?) -> self + def drag_and_drop: (Element source, Element target, ?device: Symbol | String?) -> PointerActions - def drag_and_drop_by: (Element source, Integer right_by, Integer down_by, ?device: Symbol | String?) -> self + def drag_and_drop_by: (Element source, Integer right_by, Integer down_by, ?device: Symbol | String?) -> PointerActions private - def button_action: (Symbol button, Symbol action, ?device: Symbol | String?, **Symbol | String opts) -> self + def button_action: (Symbol button, Symbol action, ?device: Symbol | String?, **Symbol | String opts) -> PointerActions - def pointer_input: (?Symbol | String? name) -> Interactions::PointerInput + def pointer_input: (?Symbol | String? name) -> untyped end end end + +interface _ActionBuilder + def tick: (untyped) -> (nil | Array[Selenium::WebDriver::Interactions::InputDevice]) + + def device: (untyped) -> Selenium::WebDriver::Interactions::InputDevice + + def add_pointer_input: (Symbol kind, String name) -> ::Selenium::WebDriver::Interactions::PointerInput +end diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/pointer_input.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/pointer_input.rbs index fe94f36fec3c8..1f8eefe9bd898 100644 --- a/rb/sig/lib/selenium/webdriver/common/interactions/pointer_input.rbs +++ b/rb/sig/lib/selenium/webdriver/common/interactions/pointer_input.rbs @@ -16,7 +16,7 @@ module Selenium def assert_kind: (untyped pointer) -> untyped - def create_pointer_move: (?duration: ::Integer, ?x: ::Integer, ?y: ::Integer, ?origin: untyped?, **untyped opts) -> untyped + def create_pointer_move: (?duration: Symbol | String | Integer, ?x: Integer, ?y: Integer, ?origin: untyped?, **untyped opts) -> untyped def create_pointer_down: (untyped button, **untyped opts) -> untyped diff --git a/rb/sig/lib/selenium/webdriver/support/color.rbs b/rb/sig/lib/selenium/webdriver/support/color.rbs index 4d20cee7054e4..501b0518c45fd 100644 --- a/rb/sig/lib/selenium/webdriver/support/color.rbs +++ b/rb/sig/lib/selenium/webdriver/support/color.rbs @@ -40,9 +40,9 @@ module Selenium def self.hue_to_rgb: (untyped lum1, untyped lum2, untyped hue) -> untyped - def initialize: (untyped red, untyped green, untyped blue, ?::Integer alpha) -> void + def initialize: (untyped red, untyped green, untyped blue, ?Float alpha) -> void - def ==: (untyped other) -> (true | false | untyped) + def ==: (untyped other) -> (bool | untyped) alias eql? == From 1e6bbd605ea3aff9ebff5d57b30edfb82f5e1302 Mon Sep 17 00:00:00 2001 From: aguspe Date: Sat, 10 Feb 2024 21:31:56 +0100 Subject: [PATCH 10/41] Reduce errors to 211 --- rb/lib/selenium/webdriver/firefox/profile.rb | 4 ++-- rb/lib/selenium/webdriver/firefox/profiles_ini.rb | 6 +++--- rb/sig/lib/selenium/webdriver/common/element.rbs | 2 +- rb/sig/lib/selenium/webdriver/firefox/features.rbs | 8 ++++++++ 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/rb/lib/selenium/webdriver/firefox/profile.rb b/rb/lib/selenium/webdriver/firefox/profile.rb index 85c50bce02dd4..875c64c678634 100644 --- a/rb/lib/selenium/webdriver/firefox/profile.rb +++ b/rb/lib/selenium/webdriver/firefox/profile.rb @@ -206,8 +206,8 @@ def read_user_prefs(path) File.read(path).split("\n").each do |line| next unless line =~ /user_pref\("([^"]+)"\s*,\s*(.+?)\);/ - key = Regexp.last_match(1).strip - value = Regexp.last_match(2).strip + key = Regexp.last_match(1)&.strip + value = Regexp.last_match(2)&.strip # wrap the value in an array to make it a valid JSON string. prefs[key] = JSON.parse("[#{value}]").first diff --git a/rb/lib/selenium/webdriver/firefox/profiles_ini.rb b/rb/lib/selenium/webdriver/firefox/profiles_ini.rb index f9eeee3f34ea7..e9e955cd606d4 100644 --- a/rb/lib/selenium/webdriver/firefox/profiles_ini.rb +++ b/rb/lib/selenium/webdriver/firefox/profiles_ini.rb @@ -52,11 +52,11 @@ def parse when /^\[Profile/ name, path = nil if path_for(name, is_relative, path) when /^Name=(.+)$/ - name = Regexp.last_match(1).strip + name = Regexp.last_match(1)&.strip when /^IsRelative=(.+)$/ - is_relative = Regexp.last_match(1).strip == '1' + is_relative = Regexp.last_match(1)&.strip == '1' when /^Path=(.+)$/ - path = Regexp.last_match(1).strip + path = Regexp.last_match(1)&.strip p = path_for(name, is_relative, path) @profile_paths[name] = p if p end diff --git a/rb/sig/lib/selenium/webdriver/common/element.rbs b/rb/sig/lib/selenium/webdriver/common/element.rbs index f34e79545e8dd..4e6ba70b20896 100644 --- a/rb/sig/lib/selenium/webdriver/common/element.rbs +++ b/rb/sig/lib/selenium/webdriver/common/element.rbs @@ -21,7 +21,7 @@ module Selenium def tag_name: () -> untyped - def attribute: (String name) -> String? + def attribute: (String | Symbol name) -> String? def dom_attribute: (String name) -> String? diff --git a/rb/sig/lib/selenium/webdriver/firefox/features.rbs b/rb/sig/lib/selenium/webdriver/firefox/features.rbs index 8957c9215b0ab..97015d569e464 100644 --- a/rb/sig/lib/selenium/webdriver/firefox/features.rbs +++ b/rb/sig/lib/selenium/webdriver/firefox/features.rbs @@ -2,8 +2,12 @@ module Selenium module WebDriver module Firefox module Features + include _Bridge + COMMANDS: Hash[Symbol, Array[Symbol | String]] FIREFOX_COMMANDS: Hash[Symbol, Array[Symbol | String]] + def command_list: -> untyped + def commands: (untyped command) -> untyped def install_addon: (untyped path, untyped temporary) -> untyped @@ -19,3 +23,7 @@ module Selenium end end end + +interface _Bridge + def execute: (untyped command, ?::Hash[untyped, untyped] opts, ?untyped? command_hash) -> untyped +end From 6dfcac90513bbd186e37454f5173d7c988119848 Mon Sep 17 00:00:00 2001 From: aguspe Date: Sun, 11 Feb 2024 01:25:08 +0100 Subject: [PATCH 11/41] Reduce errors to 199 --- .../common/driver_extensions/has_log_events.rbs | 16 ++++++++++++++++ rb/sig/lib/selenium/webdriver/common/element.rbs | 2 +- rb/sig/lib/selenium/webdriver/common/logger.rbs | 2 +- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_log_events.rbs b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_log_events.rbs index 6dce99c4d8121..02b3a6e71eeea 100644 --- a/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_log_events.rbs +++ b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_log_events.rbs @@ -2,6 +2,10 @@ module Selenium module WebDriver module DriverExtensions module HasLogEvents + include _ExecuteScript + include _FindElements + include _DevTools + @log_listeners: untyped @mutation_listener: untyped @@ -29,3 +33,15 @@ module Selenium end end end + +interface _DevTools + def devtools: () -> untyped +end + +interface _ExecuteScript + def execute_script: (untyped) -> untyped +end + +interface _FindElements + def find_elements: (untyped) -> untyped +end diff --git a/rb/sig/lib/selenium/webdriver/common/element.rbs b/rb/sig/lib/selenium/webdriver/common/element.rbs index 4e6ba70b20896..4b89eac5b26ec 100644 --- a/rb/sig/lib/selenium/webdriver/common/element.rbs +++ b/rb/sig/lib/selenium/webdriver/common/element.rbs @@ -7,7 +7,7 @@ module Selenium include TakesScreenshot - def initialize: (Support::EventFiringBridge bridge, String id) -> void + def initialize: (Remote::Bridge bridge, String id) -> void def inspect: () -> untyped diff --git a/rb/sig/lib/selenium/webdriver/common/logger.rbs b/rb/sig/lib/selenium/webdriver/common/logger.rbs index 64c4ba5f3d2dc..40d17d66ad377 100644 --- a/rb/sig/lib/selenium/webdriver/common/logger.rbs +++ b/rb/sig/lib/selenium/webdriver/common/logger.rbs @@ -21,7 +21,7 @@ module Selenium def allow: (*Symbol | Array[Symbol] ids) -> Array[Symbol] - def debug: (?String message, ?id: Symbol | Array[Symbol] id) ?{ () -> void } -> void + def debug: (String message, ?id: Symbol | Array[Symbol] id) ?{ () -> void } -> void def info: (String message, ?id: Symbol | Array[Symbol] id) ?{ () -> void } -> void From 5542a6066765539763f32dc8ae5facbc1a2e9e1a Mon Sep 17 00:00:00 2001 From: aguspe Date: Mon, 12 Feb 2024 19:05:25 +0100 Subject: [PATCH 12/41] Reduce errors to 178 --- rb/lib/selenium/webdriver/firefox/profile.rb | 1 + rb/sig/lib/selenium/webdriver/common/element.rbs | 2 +- rb/sig/lib/selenium/webdriver/common/proxy.rbs | 12 ++++++++++++ rb/sig/lib/selenium/webdriver/firefox/profile.rbs | 2 ++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/rb/lib/selenium/webdriver/firefox/profile.rb b/rb/lib/selenium/webdriver/firefox/profile.rb index 875c64c678634..9415763a2b716 100644 --- a/rb/lib/selenium/webdriver/firefox/profile.rb +++ b/rb/lib/selenium/webdriver/firefox/profile.rb @@ -24,6 +24,7 @@ class Profile include ProfileHelper VALID_PREFERENCE_TYPES = [TrueClass, FalseClass, Integer, Float, String].freeze + WEBDRIVER_PREFS = [] DEFAULT_PREFERENCES = { 'browser.newtabpage.enabled' => false, diff --git a/rb/sig/lib/selenium/webdriver/common/element.rbs b/rb/sig/lib/selenium/webdriver/common/element.rbs index 4b89eac5b26ec..84f27e732d833 100644 --- a/rb/sig/lib/selenium/webdriver/common/element.rbs +++ b/rb/sig/lib/selenium/webdriver/common/element.rbs @@ -7,7 +7,7 @@ module Selenium include TakesScreenshot - def initialize: (Remote::Bridge bridge, String id) -> void + def initialize: (Remote::Bridge | Support::EventFiringBridge bridge, String id) -> void def inspect: () -> untyped diff --git a/rb/sig/lib/selenium/webdriver/common/proxy.rbs b/rb/sig/lib/selenium/webdriver/common/proxy.rbs index 885ea9e55c9d0..a2b1327687817 100644 --- a/rb/sig/lib/selenium/webdriver/common/proxy.rbs +++ b/rb/sig/lib/selenium/webdriver/common/proxy.rbs @@ -1,6 +1,8 @@ module Selenium module WebDriver class Proxy + include _ProxyMethods + @ftp: untyped @http: untyped @@ -63,3 +65,13 @@ module Selenium end end end + +interface _ProxyMethods + def type: -> untyped + def ftp: -> untyped + def pac: -> untyped + def http: -> untyped + def ssl: -> untyped + def socks: -> untyped + def no_proxy: -> untyped +end diff --git a/rb/sig/lib/selenium/webdriver/firefox/profile.rbs b/rb/sig/lib/selenium/webdriver/firefox/profile.rbs index 8948faa69a072..119f88bc34249 100644 --- a/rb/sig/lib/selenium/webdriver/firefox/profile.rbs +++ b/rb/sig/lib/selenium/webdriver/firefox/profile.rbs @@ -2,6 +2,8 @@ module Selenium module WebDriver module Firefox class Profile + WEBDRIVER_PREFS: untyped + self.@ini: untyped @model: untyped From d08cea84fa4c2ad5376a22b057b2a33464f02c33 Mon Sep 17 00:00:00 2001 From: aguspe Date: Tue, 13 Feb 2024 23:36:34 +0100 Subject: [PATCH 13/41] 160 issues on 53 files --- rb/lib/selenium/webdriver/common/options.rb | 2 +- rb/lib/selenium/webdriver/common/service.rb | 2 +- rb/lib/selenium/webdriver/common/takes_screenshot.rb | 2 +- .../webdriver/support/guards/guard_condition.rb | 2 +- .../webdriver/common/driver_extensions/has_bidi.rbs | 6 ++++++ .../driver_extensions/has_network_interception.rbs | 6 ++++++ rb/sig/lib/selenium/webdriver/common/options.rbs | 6 ++++++ rb/sig/lib/selenium/webdriver/common/platform.rbs | 2 ++ rb/sig/lib/selenium/webdriver/common/proxy.rbs | 4 ++++ rb/sig/lib/selenium/webdriver/common/service.rbs | 4 ++++ .../lib/selenium/webdriver/common/takes_screenshot.rbs | 10 +++++++++- rb/sig/lib/selenium/webdriver/edge/features.rbs | 4 ++++ rb/sig/lib/selenium/webdriver/ie/features.rbs | 2 ++ rb/sig/lib/selenium/webdriver/safari/features.rbs | 2 ++ 14 files changed, 49 insertions(+), 5 deletions(-) diff --git a/rb/lib/selenium/webdriver/common/options.rb b/rb/lib/selenium/webdriver/common/options.rb index cfe900fe36a31..4170a7c9e7ce1 100644 --- a/rb/lib/selenium/webdriver/common/options.rb +++ b/rb/lib/selenium/webdriver/common/options.rb @@ -177,7 +177,7 @@ def convert_json_key(key, camelize: true) end def camel_case(str) - str.gsub(/_([a-z])/) { Regexp.last_match(1).upcase } + str.gsub(/_([a-z])/) { Regexp.last_match(1)&.upcase } end end # Options end # WebDriver diff --git a/rb/lib/selenium/webdriver/common/service.rb b/rb/lib/selenium/webdriver/common/service.rb index 442f90849369a..e1266a7350ea4 100644 --- a/rb/lib/selenium/webdriver/common/service.rb +++ b/rb/lib/selenium/webdriver/common/service.rb @@ -88,7 +88,7 @@ def initialize(path: nil, port: nil, log: nil, args: nil) def launch @executable_path ||= begin - default_options = WebDriver.const_get("#{self.class.name.split('::')[2]}::Options").new + default_options = WebDriver.const_get("#{self.class.name&.split('::')&.[](2)}::Options").new DriverFinder.path(default_options, self.class) end ServiceManager.new(self).tap(&:start) diff --git a/rb/lib/selenium/webdriver/common/takes_screenshot.rb b/rb/lib/selenium/webdriver/common/takes_screenshot.rb index 965445ac26a2c..41d27d7d5e450 100644 --- a/rb/lib/selenium/webdriver/common/takes_screenshot.rb +++ b/rb/lib/selenium/webdriver/common/takes_screenshot.rb @@ -57,7 +57,7 @@ def screenshot_as(format, full_page: false) when :base64 full_page ? full_screenshot : screenshot when :png - screenshot_as(:base64, full_page: full_page).unpack1('m') + screenshot_as(:base64, full_page: full_page)&.unpack1('m') else raise Error::UnsupportedOperationError, "unsupported format: #{format.inspect}" end diff --git a/rb/lib/selenium/webdriver/support/guards/guard_condition.rb b/rb/lib/selenium/webdriver/support/guards/guard_condition.rb index 0efb2f2442863..35e1620496da8 100644 --- a/rb/lib/selenium/webdriver/support/guards/guard_condition.rb +++ b/rb/lib/selenium/webdriver/support/guards/guard_condition.rb @@ -34,7 +34,7 @@ def initialize(name, condition = nil, &blk) @execution = if blk proc(&blk) else - proc { |guarded| guarded.include?(condition) } + proc { |guarded| guarded&.include?(condition) } end end diff --git a/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_bidi.rbs b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_bidi.rbs index 704b8e740c70a..080c3805899ff 100644 --- a/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_bidi.rbs +++ b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_bidi.rbs @@ -2,6 +2,8 @@ module Selenium module WebDriver module DriverExtensions module HasBiDi + include _Driver + @bidi: untyped def bidi: () -> untyped @@ -9,3 +11,7 @@ module Selenium end end end + +interface _Driver + def capabilities: () -> untyped +end diff --git a/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_network_interception.rbs b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_network_interception.rbs index 5b946e28b3cf4..67d980ba8800d 100644 --- a/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_network_interception.rbs +++ b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_network_interception.rbs @@ -2,6 +2,8 @@ module Selenium module WebDriver module DriverExtensions module HasNetworkInterception + include _HasDevTools + @interceptor: untyped def intercept: () { () -> untyped } -> untyped @@ -9,3 +11,7 @@ module Selenium end end end + +interface _HasDevTools + def devtools: () -> Selenium::WebDriver::DevTools +end diff --git a/rb/sig/lib/selenium/webdriver/common/options.rbs b/rb/sig/lib/selenium/webdriver/common/options.rbs index 2ff3fe6a77fe7..9e0cdda1610f4 100644 --- a/rb/sig/lib/selenium/webdriver/common/options.rbs +++ b/rb/sig/lib/selenium/webdriver/common/options.rbs @@ -7,6 +7,12 @@ module Selenium GRID_OPTIONS: ::Array[:enable_downloads] + BROWSER: untyped + + KEY: untyped + + CAPABILITIES: untyped + attr_reader self.driver_path: untyped def self.chrome: (**untyped opts) -> untyped diff --git a/rb/sig/lib/selenium/webdriver/common/platform.rbs b/rb/sig/lib/selenium/webdriver/common/platform.rbs index 96fc94d716a5b..d3b6040f47e77 100644 --- a/rb/sig/lib/selenium/webdriver/common/platform.rbs +++ b/rb/sig/lib/selenium/webdriver/common/platform.rbs @@ -55,6 +55,8 @@ module Selenium def self?.ip: () -> untyped def self?.interfaces: () -> untyped + + def unix?: -> untyped end end end diff --git a/rb/sig/lib/selenium/webdriver/common/proxy.rbs b/rb/sig/lib/selenium/webdriver/common/proxy.rbs index a2b1327687817..4f22c5fd8541a 100644 --- a/rb/sig/lib/selenium/webdriver/common/proxy.rbs +++ b/rb/sig/lib/selenium/webdriver/common/proxy.rbs @@ -67,6 +67,7 @@ module Selenium end interface _ProxyMethods + def auto_detect: -> untyped def type: -> untyped def ftp: -> untyped def pac: -> untyped @@ -74,4 +75,7 @@ interface _ProxyMethods def ssl: -> untyped def socks: -> untyped def no_proxy: -> untyped + def socksPassword: -> untyped + def socksUsername: -> untyped + def socksVersion: -> untyped end diff --git a/rb/sig/lib/selenium/webdriver/common/service.rbs b/rb/sig/lib/selenium/webdriver/common/service.rbs index e1db0f1aeb330..a6abee02e79d2 100644 --- a/rb/sig/lib/selenium/webdriver/common/service.rbs +++ b/rb/sig/lib/selenium/webdriver/common/service.rbs @@ -1,6 +1,10 @@ module Selenium module WebDriver class Service + SHUTDOWN_SUPPORTED: untyped + + DEFAULT_PORT: untyped + self.@driver_path: untyped @executable_path: untyped diff --git a/rb/sig/lib/selenium/webdriver/common/takes_screenshot.rbs b/rb/sig/lib/selenium/webdriver/common/takes_screenshot.rbs index f9604b93337e4..e17c153212cf2 100644 --- a/rb/sig/lib/selenium/webdriver/common/takes_screenshot.rbs +++ b/rb/sig/lib/selenium/webdriver/common/takes_screenshot.rbs @@ -1,9 +1,17 @@ module Selenium module WebDriver module TakesScreenshot + include _FullPageScreenshot + def save_screenshot: (String png_path, ?full_page: bool full_page) -> untyped - def screenshot_as: (Symbol format, ?full_page: bool full_page) -> (::Integer | ::Float | ::String | nil) + def screenshot_as: (Symbol format, ?full_page: bool full_page) -> (Integer | Float | String | nil) end end end + +interface _FullPageScreenshot + def full_screenshot: () -> untyped + + def screenshot: () -> untyped +end diff --git a/rb/sig/lib/selenium/webdriver/edge/features.rbs b/rb/sig/lib/selenium/webdriver/edge/features.rbs index be01c16cf4ea7..accea1a33ad58 100644 --- a/rb/sig/lib/selenium/webdriver/edge/features.rbs +++ b/rb/sig/lib/selenium/webdriver/edge/features.rbs @@ -6,6 +6,10 @@ module Selenium EDGE_COMMANDS: Hash[Symbol, Array[Symbol | String]] + COMMANDS: untyped + + def command_list: -> untyped + def commands: (untyped command) -> untyped end end diff --git a/rb/sig/lib/selenium/webdriver/ie/features.rbs b/rb/sig/lib/selenium/webdriver/ie/features.rbs index 26c4d5c41447f..301366c839b20 100644 --- a/rb/sig/lib/selenium/webdriver/ie/features.rbs +++ b/rb/sig/lib/selenium/webdriver/ie/features.rbs @@ -2,6 +2,8 @@ module Selenium module WebDriver module IE module Features + COMMANDS: untyped + def command_list: () -> untyped def commands: (untyped command) -> untyped diff --git a/rb/sig/lib/selenium/webdriver/safari/features.rbs b/rb/sig/lib/selenium/webdriver/safari/features.rbs index 642dcd8d8f75a..8596a2f84f329 100644 --- a/rb/sig/lib/selenium/webdriver/safari/features.rbs +++ b/rb/sig/lib/selenium/webdriver/safari/features.rbs @@ -6,6 +6,8 @@ module Selenium SAFARI_COMMANDS: Hash[Symbol, Array[Symbol | String]] + COMMANDS: untyped + def command_list: -> untyped def commands: (untyped command) -> untyped From be5dce38827fcf487d43ec1f310557d60b8e180e Mon Sep 17 00:00:00 2001 From: aguspe Date: Thu, 15 Feb 2024 19:05:54 +0100 Subject: [PATCH 14/41] 125 problems from 48 files left --- .../support/guards/guard_condition.rb | 2 +- .../selenium/interfaces/_ActionBuilder.rbs | 7 ++++++ rb/sig/lib/selenium/interfaces/_Bridge.rbs | 3 +++ rb/sig/lib/selenium/interfaces/_DevTools.rbs | 11 +++++++++ rb/sig/lib/selenium/interfaces/_Driver.rbs | 9 ++++++++ .../interfaces/_FullPageScreenshot.rbs | 5 ++++ rb/sig/lib/selenium/interfaces/_Options.rbs | 3 +++ rb/sig/lib/selenium/interfaces/_Platform.rbs | 3 +++ rb/sig/lib/selenium/interfaces/_Proxy.rbs | 23 +++++++++++++++++++ .../selenium/interfaces/_TakesScreenshot.rbs | 3 +++ .../selenium/webdriver/chromium/driver.rbs | 2 ++ .../selenium/webdriver/chromium/features.rbs | 2 ++ .../selenium/webdriver/chromium/options.rbs | 2 ++ .../full_page_screenshot.rbs | 2 ++ .../driver_extensions/has_authentication.rbs | 2 ++ .../common/driver_extensions/has_bidi.rbs | 4 ---- .../common/driver_extensions/has_devtools.rbs | 2 ++ .../driver_extensions/has_log_events.rbs | 12 ---------- .../has_network_interception.rbs | 6 +---- .../driver_extensions/has_pinned_scripts.rbs | 2 ++ .../common/interactions/pointer_actions.rbs | 8 ------- .../common/interactions/wheel_actions.rbs | 3 +++ .../lib/selenium/webdriver/common/proxy.rbs | 16 +------------ .../webdriver/common/selenium_manager.rbs | 2 ++ .../webdriver/common/takes_screenshot.rbs | 6 ----- .../selenium/webdriver/firefox/features.rbs | 4 ---- .../lib/selenium/webdriver/remote/bridge.rbs | 4 ---- .../selenium/webdriver/remote/features.rbs | 2 +- .../selenium/webdriver/safari/features.rbs | 2 +- 29 files changed, 91 insertions(+), 61 deletions(-) create mode 100644 rb/sig/lib/selenium/interfaces/_ActionBuilder.rbs create mode 100644 rb/sig/lib/selenium/interfaces/_Bridge.rbs create mode 100644 rb/sig/lib/selenium/interfaces/_DevTools.rbs create mode 100644 rb/sig/lib/selenium/interfaces/_Driver.rbs create mode 100644 rb/sig/lib/selenium/interfaces/_FullPageScreenshot.rbs create mode 100644 rb/sig/lib/selenium/interfaces/_Options.rbs create mode 100644 rb/sig/lib/selenium/interfaces/_Platform.rbs create mode 100644 rb/sig/lib/selenium/interfaces/_Proxy.rbs create mode 100644 rb/sig/lib/selenium/interfaces/_TakesScreenshot.rbs diff --git a/rb/lib/selenium/webdriver/support/guards/guard_condition.rb b/rb/lib/selenium/webdriver/support/guards/guard_condition.rb index 35e1620496da8..0efb2f2442863 100644 --- a/rb/lib/selenium/webdriver/support/guards/guard_condition.rb +++ b/rb/lib/selenium/webdriver/support/guards/guard_condition.rb @@ -34,7 +34,7 @@ def initialize(name, condition = nil, &blk) @execution = if blk proc(&blk) else - proc { |guarded| guarded&.include?(condition) } + proc { |guarded| guarded.include?(condition) } end end diff --git a/rb/sig/lib/selenium/interfaces/_ActionBuilder.rbs b/rb/sig/lib/selenium/interfaces/_ActionBuilder.rbs new file mode 100644 index 0000000000000..e626ea14cc48b --- /dev/null +++ b/rb/sig/lib/selenium/interfaces/_ActionBuilder.rbs @@ -0,0 +1,7 @@ +interface _ActionBuilder + def tick: (untyped) -> (nil | Array[Selenium::WebDriver::Interactions::InputDevice]) + + def device: (untyped) -> Selenium::WebDriver::Interactions::InputDevice + + def add_pointer_input: (Symbol kind, String name) -> ::Selenium::WebDriver::Interactions::PointerInput +end diff --git a/rb/sig/lib/selenium/interfaces/_Bridge.rbs b/rb/sig/lib/selenium/interfaces/_Bridge.rbs new file mode 100644 index 0000000000000..66665e14eccb3 --- /dev/null +++ b/rb/sig/lib/selenium/interfaces/_Bridge.rbs @@ -0,0 +1,3 @@ +interface _Bridge + def execute: (untyped command, ?::Hash[untyped, untyped] opts, ?untyped? command_hash) -> untyped +end diff --git a/rb/sig/lib/selenium/interfaces/_DevTools.rbs b/rb/sig/lib/selenium/interfaces/_DevTools.rbs new file mode 100644 index 0000000000000..a181083ef99a6 --- /dev/null +++ b/rb/sig/lib/selenium/interfaces/_DevTools.rbs @@ -0,0 +1,11 @@ +interface _DevTools + def devtools: () -> untyped +end + +interface _ExecuteScript + def execute_script: (untyped) -> untyped +end + +interface _FindElements + def find_elements: (untyped) -> untyped +end diff --git a/rb/sig/lib/selenium/interfaces/_Driver.rbs b/rb/sig/lib/selenium/interfaces/_Driver.rbs new file mode 100644 index 0000000000000..ae2370e5e6888 --- /dev/null +++ b/rb/sig/lib/selenium/interfaces/_Driver.rbs @@ -0,0 +1,9 @@ +interface _Driver + def capabilities: () -> untyped + + def devtools_url: () -> untyped + + def devtools_version: () -> untyped + + def devtools_address: () -> untyped +end diff --git a/rb/sig/lib/selenium/interfaces/_FullPageScreenshot.rbs b/rb/sig/lib/selenium/interfaces/_FullPageScreenshot.rbs new file mode 100644 index 0000000000000..d9c4bb4692077 --- /dev/null +++ b/rb/sig/lib/selenium/interfaces/_FullPageScreenshot.rbs @@ -0,0 +1,5 @@ +interface _FullPageScreenshot + def full_screenshot: () -> untyped + + def screenshot: () -> untyped +end diff --git a/rb/sig/lib/selenium/interfaces/_Options.rbs b/rb/sig/lib/selenium/interfaces/_Options.rbs new file mode 100644 index 0000000000000..e45aeda945f48 --- /dev/null +++ b/rb/sig/lib/selenium/interfaces/_Options.rbs @@ -0,0 +1,3 @@ +interface _Options + def enable_login: -> untyped +end diff --git a/rb/sig/lib/selenium/interfaces/_Platform.rbs b/rb/sig/lib/selenium/interfaces/_Platform.rbs new file mode 100644 index 0000000000000..e9e1d7b15c59a --- /dev/null +++ b/rb/sig/lib/selenium/interfaces/_Platform.rbs @@ -0,0 +1,3 @@ +interface _Platform + def unix?: -> bool +end diff --git a/rb/sig/lib/selenium/interfaces/_Proxy.rbs b/rb/sig/lib/selenium/interfaces/_Proxy.rbs new file mode 100644 index 0000000000000..c4c8923a04014 --- /dev/null +++ b/rb/sig/lib/selenium/interfaces/_Proxy.rbs @@ -0,0 +1,23 @@ +interface _Proxy + def auto_detect: -> untyped + + def type: -> untyped + + def ftp: -> untyped + + def pac: -> untyped + + def http: -> untyped + + def ssl: -> untyped + + def socks: -> untyped + + def no_proxy: -> untyped + + def socks_password: -> untyped + + def socks_username: -> untyped + + def socks_version: -> untyped +end diff --git a/rb/sig/lib/selenium/interfaces/_TakesScreenshot.rbs b/rb/sig/lib/selenium/interfaces/_TakesScreenshot.rbs new file mode 100644 index 0000000000000..11bec497d6b13 --- /dev/null +++ b/rb/sig/lib/selenium/interfaces/_TakesScreenshot.rbs @@ -0,0 +1,3 @@ +interface _TakeScreenshot + def save_screenshot: (String png_path, ?full_page: bool full_page) -> untyped +end diff --git a/rb/sig/lib/selenium/webdriver/chromium/driver.rbs b/rb/sig/lib/selenium/webdriver/chromium/driver.rbs index 3d4c34c7ed4b3..5c76345c7225e 100644 --- a/rb/sig/lib/selenium/webdriver/chromium/driver.rbs +++ b/rb/sig/lib/selenium/webdriver/chromium/driver.rbs @@ -2,6 +2,8 @@ module Selenium module WebDriver module Chromium class Driver < WebDriver::Driver + include _Driver + EXTENSIONS: ::Array[untyped] def devtools_url: () -> untyped diff --git a/rb/sig/lib/selenium/webdriver/chromium/features.rbs b/rb/sig/lib/selenium/webdriver/chromium/features.rbs index 1442a25f92b97..fe1a6e3b13b55 100644 --- a/rb/sig/lib/selenium/webdriver/chromium/features.rbs +++ b/rb/sig/lib/selenium/webdriver/chromium/features.rbs @@ -2,6 +2,8 @@ module Selenium module WebDriver module Chromium module Features + include _Bridge + CHROMIUM_COMMANDS: Hash[Symbol, Array[Symbol | String]] def commands: (Symbol command) -> Array[Symbol | String] diff --git a/rb/sig/lib/selenium/webdriver/chromium/options.rbs b/rb/sig/lib/selenium/webdriver/chromium/options.rbs index 6d7ca4947013f..9aa9ebb1407ba 100644 --- a/rb/sig/lib/selenium/webdriver/chromium/options.rbs +++ b/rb/sig/lib/selenium/webdriver/chromium/options.rbs @@ -2,6 +2,8 @@ module Selenium module WebDriver module Chromium class Options < WebDriver::Options + include _Options + @profile: untyped @options: untyped diff --git a/rb/sig/lib/selenium/webdriver/common/driver_extensions/full_page_screenshot.rbs b/rb/sig/lib/selenium/webdriver/common/driver_extensions/full_page_screenshot.rbs index df392d0446f9d..afb3d4c5c5037 100644 --- a/rb/sig/lib/selenium/webdriver/common/driver_extensions/full_page_screenshot.rbs +++ b/rb/sig/lib/selenium/webdriver/common/driver_extensions/full_page_screenshot.rbs @@ -2,6 +2,8 @@ module Selenium module WebDriver module DriverExtensions module FullPageScreenshot + include _TakeScreenshot + def save_full_page_screenshot: (untyped path) -> untyped private diff --git a/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_authentication.rbs b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_authentication.rbs index 82c3643feb59d..2a61f10486165 100644 --- a/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_authentication.rbs +++ b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_authentication.rbs @@ -2,6 +2,8 @@ module Selenium module WebDriver module DriverExtensions module HasAuthentication + include _DevTools + @auth_handlers: untyped def register: (username: untyped, password: untyped, ?uri: untyped) -> untyped diff --git a/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_bidi.rbs b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_bidi.rbs index 080c3805899ff..0fed760bfb9d4 100644 --- a/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_bidi.rbs +++ b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_bidi.rbs @@ -11,7 +11,3 @@ module Selenium end end end - -interface _Driver - def capabilities: () -> untyped -end diff --git a/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_devtools.rbs b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_devtools.rbs index d48a27d95ad2c..01c7994c57707 100644 --- a/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_devtools.rbs +++ b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_devtools.rbs @@ -2,6 +2,8 @@ module Selenium module WebDriver module DriverExtensions module HasDevTools + include _Driver + @devtools: untyped def devtools: () -> untyped diff --git a/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_log_events.rbs b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_log_events.rbs index 02b3a6e71eeea..90ce390f49d95 100644 --- a/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_log_events.rbs +++ b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_log_events.rbs @@ -33,15 +33,3 @@ module Selenium end end end - -interface _DevTools - def devtools: () -> untyped -end - -interface _ExecuteScript - def execute_script: (untyped) -> untyped -end - -interface _FindElements - def find_elements: (untyped) -> untyped -end diff --git a/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_network_interception.rbs b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_network_interception.rbs index 67d980ba8800d..ed03f3d6bd504 100644 --- a/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_network_interception.rbs +++ b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_network_interception.rbs @@ -2,7 +2,7 @@ module Selenium module WebDriver module DriverExtensions module HasNetworkInterception - include _HasDevTools + include _DevTools @interceptor: untyped @@ -11,7 +11,3 @@ module Selenium end end end - -interface _HasDevTools - def devtools: () -> Selenium::WebDriver::DevTools -end diff --git a/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_pinned_scripts.rbs b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_pinned_scripts.rbs index 4777f055ced0a..e8fd66b9a8fd0 100644 --- a/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_pinned_scripts.rbs +++ b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_pinned_scripts.rbs @@ -2,6 +2,8 @@ module Selenium module WebDriver module DriverExtensions module HasPinnedScripts + include _DevTools + @pinned_scripts: untyped def pinned_scripts: () -> untyped diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/pointer_actions.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/pointer_actions.rbs index 5ace4bd2a4ad9..902222930637b 100644 --- a/rb/sig/lib/selenium/webdriver/common/interactions/pointer_actions.rbs +++ b/rb/sig/lib/selenium/webdriver/common/interactions/pointer_actions.rbs @@ -41,11 +41,3 @@ module Selenium end end end - -interface _ActionBuilder - def tick: (untyped) -> (nil | Array[Selenium::WebDriver::Interactions::InputDevice]) - - def device: (untyped) -> Selenium::WebDriver::Interactions::InputDevice - - def add_pointer_input: (Symbol kind, String name) -> ::Selenium::WebDriver::Interactions::PointerInput -end diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/wheel_actions.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/wheel_actions.rbs index 375d979cd030c..b4d0dd2ca6183 100644 --- a/rb/sig/lib/selenium/webdriver/common/interactions/wheel_actions.rbs +++ b/rb/sig/lib/selenium/webdriver/common/interactions/wheel_actions.rbs @@ -1,6 +1,9 @@ module Selenium module WebDriver module WheelActions + include _ActionBuilder + include _Driver + @default_scroll_duration: untyped attr_writer default_scroll_duration: untyped diff --git a/rb/sig/lib/selenium/webdriver/common/proxy.rbs b/rb/sig/lib/selenium/webdriver/common/proxy.rbs index 4f22c5fd8541a..d0caaba987009 100644 --- a/rb/sig/lib/selenium/webdriver/common/proxy.rbs +++ b/rb/sig/lib/selenium/webdriver/common/proxy.rbs @@ -1,7 +1,7 @@ module Selenium module WebDriver class Proxy - include _ProxyMethods + include _Proxy @ftp: untyped @@ -65,17 +65,3 @@ module Selenium end end end - -interface _ProxyMethods - def auto_detect: -> untyped - def type: -> untyped - def ftp: -> untyped - def pac: -> untyped - def http: -> untyped - def ssl: -> untyped - def socks: -> untyped - def no_proxy: -> untyped - def socksPassword: -> untyped - def socksUsername: -> untyped - def socksVersion: -> untyped -end diff --git a/rb/sig/lib/selenium/webdriver/common/selenium_manager.rbs b/rb/sig/lib/selenium/webdriver/common/selenium_manager.rbs index f5aa63d7ae7d1..f4fd4bf2650f7 100644 --- a/rb/sig/lib/selenium/webdriver/common/selenium_manager.rbs +++ b/rb/sig/lib/selenium/webdriver/common/selenium_manager.rbs @@ -6,6 +6,8 @@ module Selenium # @api private # class SeleniumManager + include _Platform + self.@bin_path: untyped self.@binary: untyped diff --git a/rb/sig/lib/selenium/webdriver/common/takes_screenshot.rbs b/rb/sig/lib/selenium/webdriver/common/takes_screenshot.rbs index e17c153212cf2..d9838e3b17eae 100644 --- a/rb/sig/lib/selenium/webdriver/common/takes_screenshot.rbs +++ b/rb/sig/lib/selenium/webdriver/common/takes_screenshot.rbs @@ -9,9 +9,3 @@ module Selenium end end end - -interface _FullPageScreenshot - def full_screenshot: () -> untyped - - def screenshot: () -> untyped -end diff --git a/rb/sig/lib/selenium/webdriver/firefox/features.rbs b/rb/sig/lib/selenium/webdriver/firefox/features.rbs index 97015d569e464..c8d12b93d50c1 100644 --- a/rb/sig/lib/selenium/webdriver/firefox/features.rbs +++ b/rb/sig/lib/selenium/webdriver/firefox/features.rbs @@ -23,7 +23,3 @@ module Selenium end end end - -interface _Bridge - def execute: (untyped command, ?::Hash[untyped, untyped] opts, ?untyped? command_hash) -> untyped -end diff --git a/rb/sig/lib/selenium/webdriver/remote/bridge.rbs b/rb/sig/lib/selenium/webdriver/remote/bridge.rbs index 92d9c15bfeaa4..936c06ca4b54e 100644 --- a/rb/sig/lib/selenium/webdriver/remote/bridge.rbs +++ b/rb/sig/lib/selenium/webdriver/remote/bridge.rbs @@ -247,10 +247,6 @@ module Selenium UNICODE_CODE_POINT: 30 def escape_css: (untyped string) -> untyped - - interface _BridgeInterface - def execute: (Symbol command, ?untyped opts, ?untyped command_hash) -> untyped - end end end end diff --git a/rb/sig/lib/selenium/webdriver/remote/features.rbs b/rb/sig/lib/selenium/webdriver/remote/features.rbs index f073af729255e..88034663b568b 100644 --- a/rb/sig/lib/selenium/webdriver/remote/features.rbs +++ b/rb/sig/lib/selenium/webdriver/remote/features.rbs @@ -2,7 +2,7 @@ module Selenium module WebDriver module Remote module Features - include Bridge::_BridgeInterface + include _Bridge @command_list: untyped diff --git a/rb/sig/lib/selenium/webdriver/safari/features.rbs b/rb/sig/lib/selenium/webdriver/safari/features.rbs index 8596a2f84f329..30e3d2d269de6 100644 --- a/rb/sig/lib/selenium/webdriver/safari/features.rbs +++ b/rb/sig/lib/selenium/webdriver/safari/features.rbs @@ -2,7 +2,7 @@ module Selenium module WebDriver module Safari module Features - include Remote::Bridge::_BridgeInterface + include _Bridge SAFARI_COMMANDS: Hash[Symbol, Array[Symbol | String]] From 849506c9b3b33daf4834628d53cb17ef922baec9 Mon Sep 17 00:00:00 2001 From: aguspe Date: Fri, 16 Feb 2024 18:02:11 +0100 Subject: [PATCH 15/41] 119 problems in 47 files --- .../interfaces/{_ActionBuilder.rbs => action_builder.rbs} | 0 rb/sig/lib/selenium/interfaces/{_Bridge.rbs => bridge.rbs} | 0 .../lib/selenium/interfaces/{_DevTools.rbs => devtools.rbs} | 0 rb/sig/lib/selenium/interfaces/{_Driver.rbs => driver.rbs} | 4 ++++ .../{_FullPageScreenshot.rbs => full_page_screenshot.rbs} | 0 rb/sig/lib/selenium/interfaces/local_storage.rbs | 3 +++ rb/sig/lib/selenium/interfaces/{_Options.rbs => options.rbs} | 0 .../lib/selenium/interfaces/{_Platform.rbs => platform.rbs} | 2 +- rb/sig/lib/selenium/interfaces/{_Proxy.rbs => proxy.rbs} | 0 .../interfaces/{_TakesScreenshot.rbs => take_screenshot.rbs} | 0 .../selenium/webdriver/common/html5/shared_web_storage.rbs | 1 + rb/sig/lib/selenium/webdriver/common/profile_helper.rbs | 1 + rb/sig/lib/selenium/webdriver/common/search_context.rbs | 2 ++ 13 files changed, 12 insertions(+), 1 deletion(-) rename rb/sig/lib/selenium/interfaces/{_ActionBuilder.rbs => action_builder.rbs} (100%) rename rb/sig/lib/selenium/interfaces/{_Bridge.rbs => bridge.rbs} (100%) rename rb/sig/lib/selenium/interfaces/{_DevTools.rbs => devtools.rbs} (100%) rename rb/sig/lib/selenium/interfaces/{_Driver.rbs => driver.rbs} (75%) rename rb/sig/lib/selenium/interfaces/{_FullPageScreenshot.rbs => full_page_screenshot.rbs} (100%) create mode 100644 rb/sig/lib/selenium/interfaces/local_storage.rbs rename rb/sig/lib/selenium/interfaces/{_Options.rbs => options.rbs} (100%) rename rb/sig/lib/selenium/interfaces/{_Platform.rbs => platform.rbs} (50%) rename rb/sig/lib/selenium/interfaces/{_Proxy.rbs => proxy.rbs} (100%) rename rb/sig/lib/selenium/interfaces/{_TakesScreenshot.rbs => take_screenshot.rbs} (100%) diff --git a/rb/sig/lib/selenium/interfaces/_ActionBuilder.rbs b/rb/sig/lib/selenium/interfaces/action_builder.rbs similarity index 100% rename from rb/sig/lib/selenium/interfaces/_ActionBuilder.rbs rename to rb/sig/lib/selenium/interfaces/action_builder.rbs diff --git a/rb/sig/lib/selenium/interfaces/_Bridge.rbs b/rb/sig/lib/selenium/interfaces/bridge.rbs similarity index 100% rename from rb/sig/lib/selenium/interfaces/_Bridge.rbs rename to rb/sig/lib/selenium/interfaces/bridge.rbs diff --git a/rb/sig/lib/selenium/interfaces/_DevTools.rbs b/rb/sig/lib/selenium/interfaces/devtools.rbs similarity index 100% rename from rb/sig/lib/selenium/interfaces/_DevTools.rbs rename to rb/sig/lib/selenium/interfaces/devtools.rbs diff --git a/rb/sig/lib/selenium/interfaces/_Driver.rbs b/rb/sig/lib/selenium/interfaces/driver.rbs similarity index 75% rename from rb/sig/lib/selenium/interfaces/_Driver.rbs rename to rb/sig/lib/selenium/interfaces/driver.rbs index ae2370e5e6888..23cad0c9ee890 100644 --- a/rb/sig/lib/selenium/interfaces/_Driver.rbs +++ b/rb/sig/lib/selenium/interfaces/driver.rbs @@ -6,4 +6,8 @@ interface _Driver def devtools_version: () -> untyped def devtools_address: () -> untyped + + def ref: () -> untyped + + def bridge: () -> untyped end diff --git a/rb/sig/lib/selenium/interfaces/_FullPageScreenshot.rbs b/rb/sig/lib/selenium/interfaces/full_page_screenshot.rbs similarity index 100% rename from rb/sig/lib/selenium/interfaces/_FullPageScreenshot.rbs rename to rb/sig/lib/selenium/interfaces/full_page_screenshot.rbs diff --git a/rb/sig/lib/selenium/interfaces/local_storage.rbs b/rb/sig/lib/selenium/interfaces/local_storage.rbs new file mode 100644 index 0000000000000..fc68ce0eda140 --- /dev/null +++ b/rb/sig/lib/selenium/interfaces/local_storage.rbs @@ -0,0 +1,3 @@ +interface _LocalStorage + def keys: () -> untyped +end diff --git a/rb/sig/lib/selenium/interfaces/_Options.rbs b/rb/sig/lib/selenium/interfaces/options.rbs similarity index 100% rename from rb/sig/lib/selenium/interfaces/_Options.rbs rename to rb/sig/lib/selenium/interfaces/options.rbs diff --git a/rb/sig/lib/selenium/interfaces/_Platform.rbs b/rb/sig/lib/selenium/interfaces/platform.rbs similarity index 50% rename from rb/sig/lib/selenium/interfaces/_Platform.rbs rename to rb/sig/lib/selenium/interfaces/platform.rbs index e9e1d7b15c59a..2c12f56d6c2bd 100644 --- a/rb/sig/lib/selenium/interfaces/_Platform.rbs +++ b/rb/sig/lib/selenium/interfaces/platform.rbs @@ -1,3 +1,3 @@ interface _Platform - def unix?: -> bool + def unix?: () -> bool end diff --git a/rb/sig/lib/selenium/interfaces/_Proxy.rbs b/rb/sig/lib/selenium/interfaces/proxy.rbs similarity index 100% rename from rb/sig/lib/selenium/interfaces/_Proxy.rbs rename to rb/sig/lib/selenium/interfaces/proxy.rbs diff --git a/rb/sig/lib/selenium/interfaces/_TakesScreenshot.rbs b/rb/sig/lib/selenium/interfaces/take_screenshot.rbs similarity index 100% rename from rb/sig/lib/selenium/interfaces/_TakesScreenshot.rbs rename to rb/sig/lib/selenium/interfaces/take_screenshot.rbs diff --git a/rb/sig/lib/selenium/webdriver/common/html5/shared_web_storage.rbs b/rb/sig/lib/selenium/webdriver/common/html5/shared_web_storage.rbs index 036c1ceee7c81..13ed50003cbc6 100644 --- a/rb/sig/lib/selenium/webdriver/common/html5/shared_web_storage.rbs +++ b/rb/sig/lib/selenium/webdriver/common/html5/shared_web_storage.rbs @@ -3,6 +3,7 @@ module Selenium module HTML5 module SharedWebStorage include Enumerable[untyped] + include _LocalStorage def key?: (untyped key) -> untyped diff --git a/rb/sig/lib/selenium/webdriver/common/profile_helper.rbs b/rb/sig/lib/selenium/webdriver/common/profile_helper.rbs index 0c742640c7bad..ce6a56ad64bb5 100644 --- a/rb/sig/lib/selenium/webdriver/common/profile_helper.rbs +++ b/rb/sig/lib/selenium/webdriver/common/profile_helper.rbs @@ -1,6 +1,7 @@ module Selenium module WebDriver module ProfileHelper + def self.included: (untyped base) -> untyped def self.decoded: (untyped json) -> untyped diff --git a/rb/sig/lib/selenium/webdriver/common/search_context.rbs b/rb/sig/lib/selenium/webdriver/common/search_context.rbs index 36b4b4e1f45dd..5f8f227156cb6 100644 --- a/rb/sig/lib/selenium/webdriver/common/search_context.rbs +++ b/rb/sig/lib/selenium/webdriver/common/search_context.rbs @@ -1,6 +1,8 @@ module Selenium module WebDriver module SearchContext + include _Driver + FINDERS: untyped def find_element: (*untyped args) -> untyped From b1161668990660edc1cd212abc46eac6e854b4ca Mon Sep 17 00:00:00 2001 From: aguspe Date: Sat, 17 Feb 2024 23:30:56 +0100 Subject: [PATCH 16/41] 117 problems in 47 files --- rb/sig/lib/selenium/interfaces/commands.rbs | 3 +++ rb/sig/lib/selenium/interfaces/commands_list.rbs | 3 +++ rb/sig/lib/selenium/interfaces/profile.rbs | 3 +++ rb/sig/lib/selenium/webdriver/chromium/driver.rbs | 3 --- rb/sig/lib/selenium/webdriver/common/profile_helper.rbs | 1 + rb/sig/lib/selenium/webdriver/remote/bridge.rbs | 2 ++ 6 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 rb/sig/lib/selenium/interfaces/commands.rbs create mode 100644 rb/sig/lib/selenium/interfaces/commands_list.rbs create mode 100644 rb/sig/lib/selenium/interfaces/profile.rbs diff --git a/rb/sig/lib/selenium/interfaces/commands.rbs b/rb/sig/lib/selenium/interfaces/commands.rbs new file mode 100644 index 0000000000000..876539899adcf --- /dev/null +++ b/rb/sig/lib/selenium/interfaces/commands.rbs @@ -0,0 +1,3 @@ +interface _Commands + def commands: (untyped command) -> untyped +end diff --git a/rb/sig/lib/selenium/interfaces/commands_list.rbs b/rb/sig/lib/selenium/interfaces/commands_list.rbs new file mode 100644 index 0000000000000..356b9272bc188 --- /dev/null +++ b/rb/sig/lib/selenium/interfaces/commands_list.rbs @@ -0,0 +1,3 @@ +interface _CommandList + def command_list: () -> untyped +end diff --git a/rb/sig/lib/selenium/interfaces/profile.rbs b/rb/sig/lib/selenium/interfaces/profile.rbs new file mode 100644 index 0000000000000..e802692900f4d --- /dev/null +++ b/rb/sig/lib/selenium/interfaces/profile.rbs @@ -0,0 +1,3 @@ +interface _Profile + def layout_on_disk: () -> untyped +end diff --git a/rb/sig/lib/selenium/webdriver/chromium/driver.rbs b/rb/sig/lib/selenium/webdriver/chromium/driver.rbs index 5c76345c7225e..bdfd23269f205 100644 --- a/rb/sig/lib/selenium/webdriver/chromium/driver.rbs +++ b/rb/sig/lib/selenium/webdriver/chromium/driver.rbs @@ -6,9 +6,6 @@ module Selenium EXTENSIONS: ::Array[untyped] - def devtools_url: () -> untyped - - def devtools_version: () -> untyped end end end diff --git a/rb/sig/lib/selenium/webdriver/common/profile_helper.rbs b/rb/sig/lib/selenium/webdriver/common/profile_helper.rbs index ce6a56ad64bb5..0572b23f541ce 100644 --- a/rb/sig/lib/selenium/webdriver/common/profile_helper.rbs +++ b/rb/sig/lib/selenium/webdriver/common/profile_helper.rbs @@ -1,6 +1,7 @@ module Selenium module WebDriver module ProfileHelper + include _Profile def self.included: (untyped base) -> untyped diff --git a/rb/sig/lib/selenium/webdriver/remote/bridge.rbs b/rb/sig/lib/selenium/webdriver/remote/bridge.rbs index 936c06ca4b54e..cf1a1d7be4d4f 100644 --- a/rb/sig/lib/selenium/webdriver/remote/bridge.rbs +++ b/rb/sig/lib/selenium/webdriver/remote/bridge.rbs @@ -2,6 +2,8 @@ module Selenium module WebDriver module Remote class Bridge + include _CommandList + @http: untyped @file_detector: untyped From ebeaceefa3fc51909c8c9505aa881f5cb99a44b9 Mon Sep 17 00:00:00 2001 From: aguspe Date: Sun, 18 Feb 2024 16:53:59 +0100 Subject: [PATCH 17/41] 107 problems in 46 files --- rb/lib/selenium/devtools/support/cdp_client_generator.rb | 9 +++++---- .../selenium/devtools/support/cdp_client_generator.rbs | 2 ++ rb/sig/lib/selenium/webdriver/chromium/features.rbs | 2 +- rb/sig/lib/selenium/webdriver/remote/response.rbs | 2 +- rb/sig/lib/selenium/webdriver/support/color.rbs | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/rb/lib/selenium/devtools/support/cdp_client_generator.rb b/rb/lib/selenium/devtools/support/cdp_client_generator.rb index 4b12931d4dab1..a600e3e6fa223 100644 --- a/rb/lib/selenium/devtools/support/cdp_client_generator.rb +++ b/rb/lib/selenium/devtools/support/cdp_client_generator.rb @@ -26,8 +26,9 @@ module DevTools module Support class CDPClientGenerator # Input JSON files are generated from PDL tasks. - DOMAIN_TEMPLATE_PATH = File.expand_path('cdp/domain.rb.erb', __dir__) - LOADER_TEMPLATE_PATH = File.expand_path('cdp/loader.rb.erb', __dir__) + DIR = __dir__ || '' + DOMAIN_TEMPLATE_PATH = File.expand_path('cdp/domain.rb.erb', DIR) + LOADER_TEMPLATE_PATH = File.expand_path('cdp/loader.rb.erb', DIR) RESERVED_KEYWORDS = %w[end].freeze @@ -39,9 +40,9 @@ def call(output_dir:, version:, **opts) @version = version browser_protocol_path = opts.delete(:browser_protocol_path) do - File.expand_path('cdp/browser_protocol.json', __dir__) + File.expand_path('cdp/browser_protocol.json', DIR) end - js_protocol_path = opts.delete(:js_protocol_path) { File.expand_path('cdp/js_protocol.json', __dir__) } + js_protocol_path = opts.delete(:js_protocol_path) { File.expand_path('cdp/js_protocol.json', DIR) } raise ArgumentError, "Invalid arguments: #{opts.keys}" unless opts.empty? diff --git a/rb/sig/lib/selenium/devtools/support/cdp_client_generator.rbs b/rb/sig/lib/selenium/devtools/support/cdp_client_generator.rbs index dfe1efe214b42..6dddf605c48f8 100644 --- a/rb/sig/lib/selenium/devtools/support/cdp_client_generator.rbs +++ b/rb/sig/lib/selenium/devtools/support/cdp_client_generator.rbs @@ -2,6 +2,8 @@ module Selenium module DevTools module Support class CDPClientGenerator + DIR: untyped + @domain_template: untyped @loader_template: untyped diff --git a/rb/sig/lib/selenium/webdriver/chromium/features.rbs b/rb/sig/lib/selenium/webdriver/chromium/features.rbs index fe1a6e3b13b55..05ef1b05db5ae 100644 --- a/rb/sig/lib/selenium/webdriver/chromium/features.rbs +++ b/rb/sig/lib/selenium/webdriver/chromium/features.rbs @@ -34,7 +34,7 @@ module Selenium def available_log_types: () -> Array[Symbol] - def log: (untyped type) -> untyped + def log: (Symbol type) -> Array[Hash[String, untyped]] end end end diff --git a/rb/sig/lib/selenium/webdriver/remote/response.rbs b/rb/sig/lib/selenium/webdriver/remote/response.rbs index ff18ed5caac38..2fb2cb8756483 100644 --- a/rb/sig/lib/selenium/webdriver/remote/response.rbs +++ b/rb/sig/lib/selenium/webdriver/remote/response.rbs @@ -22,7 +22,7 @@ module Selenium def add_backtrace: (untyped ex, untyped server_trace) -> (nil | untyped) - def backtrace_from_remote: (untyped server_trace) -> untyped + def backtrace_from_remote: (untyped server_trace) -> String def process_error: () -> (nil | untyped) end diff --git a/rb/sig/lib/selenium/webdriver/support/color.rbs b/rb/sig/lib/selenium/webdriver/support/color.rbs index 501b0518c45fd..a411492a0fd5a 100644 --- a/rb/sig/lib/selenium/webdriver/support/color.rbs +++ b/rb/sig/lib/selenium/webdriver/support/color.rbs @@ -40,7 +40,7 @@ module Selenium def self.hue_to_rgb: (untyped lum1, untyped lum2, untyped hue) -> untyped - def initialize: (untyped red, untyped green, untyped blue, ?Float alpha) -> void + def initialize: (String ?red, String ?green, String ?blue, ?Float | Integer | String ?alpha, *untyped args) -> void def ==: (untyped other) -> (bool | untyped) From 86d672046975d7b36f6576eb0f0b5fe162db1a86 Mon Sep 17 00:00:00 2001 From: aguspe Date: Mon, 19 Feb 2024 22:09:44 +0100 Subject: [PATCH 18/41] 106 problems in 45 files --- rb/Steepfile | 9 ++++++--- rb/sig/{lib/selenium => }/interfaces/action_builder.rbs | 0 rb/sig/{lib/selenium => }/interfaces/bridge.rbs | 0 rb/sig/{lib/selenium => }/interfaces/commands.rbs | 0 rb/sig/{lib/selenium => }/interfaces/commands_list.rbs | 0 rb/sig/{lib/selenium => }/interfaces/devtools.rbs | 0 rb/sig/{lib/selenium => }/interfaces/driver.rbs | 0 .../selenium => }/interfaces/full_page_screenshot.rbs | 0 rb/sig/{lib/selenium => }/interfaces/local_storage.rbs | 0 rb/sig/{lib/selenium => }/interfaces/options.rbs | 0 rb/sig/{lib/selenium => }/interfaces/platform.rbs | 0 rb/sig/{lib/selenium => }/interfaces/profile.rbs | 0 rb/sig/{lib/selenium => }/interfaces/proxy.rbs | 0 rb/sig/{lib/selenium => }/interfaces/take_screenshot.rbs | 0 14 files changed, 6 insertions(+), 3 deletions(-) rename rb/sig/{lib/selenium => }/interfaces/action_builder.rbs (100%) rename rb/sig/{lib/selenium => }/interfaces/bridge.rbs (100%) rename rb/sig/{lib/selenium => }/interfaces/commands.rbs (100%) rename rb/sig/{lib/selenium => }/interfaces/commands_list.rbs (100%) rename rb/sig/{lib/selenium => }/interfaces/devtools.rbs (100%) rename rb/sig/{lib/selenium => }/interfaces/driver.rbs (100%) rename rb/sig/{lib/selenium => }/interfaces/full_page_screenshot.rbs (100%) rename rb/sig/{lib/selenium => }/interfaces/local_storage.rbs (100%) rename rb/sig/{lib/selenium => }/interfaces/options.rbs (100%) rename rb/sig/{lib/selenium => }/interfaces/platform.rbs (100%) rename rb/sig/{lib/selenium => }/interfaces/profile.rbs (100%) rename rb/sig/{lib/selenium => }/interfaces/proxy.rbs (100%) rename rb/sig/{lib/selenium => }/interfaces/take_screenshot.rbs (100%) diff --git a/rb/Steepfile b/rb/Steepfile index d377e55385f5a..d63dd2d39dba5 100644 --- a/rb/Steepfile +++ b/rb/Steepfile @@ -2,11 +2,14 @@ target :lib do signature 'sig' # Signature directory check 'lib' # Directory name ignore( - 'lib/selenium/webdriver/common/platform.rb', # Ignore line 166 due to UDP RBS issue - 'lib/selenium/webdriver/remote/http/curb.rb' # Ignore due to webmock gem not having RBS signatures + # Ignore line 166 due to UDP RBS issue + 'lib/selenium/webdriver/common/platform.rb', + # Ignore due to webmock gem not having RBS signatures + 'lib/selenium/webdriver/remote/http/curb.rb', + # Ignore due to line 71, there is one last error where RBS thinks backtrace is nil + 'lib/selenium/webdriver/remote/response.rb' ) - library( 'base64', 'date', diff --git a/rb/sig/lib/selenium/interfaces/action_builder.rbs b/rb/sig/interfaces/action_builder.rbs similarity index 100% rename from rb/sig/lib/selenium/interfaces/action_builder.rbs rename to rb/sig/interfaces/action_builder.rbs diff --git a/rb/sig/lib/selenium/interfaces/bridge.rbs b/rb/sig/interfaces/bridge.rbs similarity index 100% rename from rb/sig/lib/selenium/interfaces/bridge.rbs rename to rb/sig/interfaces/bridge.rbs diff --git a/rb/sig/lib/selenium/interfaces/commands.rbs b/rb/sig/interfaces/commands.rbs similarity index 100% rename from rb/sig/lib/selenium/interfaces/commands.rbs rename to rb/sig/interfaces/commands.rbs diff --git a/rb/sig/lib/selenium/interfaces/commands_list.rbs b/rb/sig/interfaces/commands_list.rbs similarity index 100% rename from rb/sig/lib/selenium/interfaces/commands_list.rbs rename to rb/sig/interfaces/commands_list.rbs diff --git a/rb/sig/lib/selenium/interfaces/devtools.rbs b/rb/sig/interfaces/devtools.rbs similarity index 100% rename from rb/sig/lib/selenium/interfaces/devtools.rbs rename to rb/sig/interfaces/devtools.rbs diff --git a/rb/sig/lib/selenium/interfaces/driver.rbs b/rb/sig/interfaces/driver.rbs similarity index 100% rename from rb/sig/lib/selenium/interfaces/driver.rbs rename to rb/sig/interfaces/driver.rbs diff --git a/rb/sig/lib/selenium/interfaces/full_page_screenshot.rbs b/rb/sig/interfaces/full_page_screenshot.rbs similarity index 100% rename from rb/sig/lib/selenium/interfaces/full_page_screenshot.rbs rename to rb/sig/interfaces/full_page_screenshot.rbs diff --git a/rb/sig/lib/selenium/interfaces/local_storage.rbs b/rb/sig/interfaces/local_storage.rbs similarity index 100% rename from rb/sig/lib/selenium/interfaces/local_storage.rbs rename to rb/sig/interfaces/local_storage.rbs diff --git a/rb/sig/lib/selenium/interfaces/options.rbs b/rb/sig/interfaces/options.rbs similarity index 100% rename from rb/sig/lib/selenium/interfaces/options.rbs rename to rb/sig/interfaces/options.rbs diff --git a/rb/sig/lib/selenium/interfaces/platform.rbs b/rb/sig/interfaces/platform.rbs similarity index 100% rename from rb/sig/lib/selenium/interfaces/platform.rbs rename to rb/sig/interfaces/platform.rbs diff --git a/rb/sig/lib/selenium/interfaces/profile.rbs b/rb/sig/interfaces/profile.rbs similarity index 100% rename from rb/sig/lib/selenium/interfaces/profile.rbs rename to rb/sig/interfaces/profile.rbs diff --git a/rb/sig/lib/selenium/interfaces/proxy.rbs b/rb/sig/interfaces/proxy.rbs similarity index 100% rename from rb/sig/lib/selenium/interfaces/proxy.rbs rename to rb/sig/interfaces/proxy.rbs diff --git a/rb/sig/lib/selenium/interfaces/take_screenshot.rbs b/rb/sig/interfaces/take_screenshot.rbs similarity index 100% rename from rb/sig/lib/selenium/interfaces/take_screenshot.rbs rename to rb/sig/interfaces/take_screenshot.rbs From 764a8ba6d317cb878f43dbdd6092e95766c9e94e Mon Sep 17 00:00:00 2001 From: aguspe Date: Tue, 20 Feb 2024 20:00:10 +0100 Subject: [PATCH 19/41] 99 problems in 44 files --- rb/sig/gems/websocket/handshake.rbs | 7 ++++++ rb/sig/gems/websocket/incoming.rbs | 9 ++++++++ rb/sig/gems/websocket/outgoing.rbs | 9 ++++++++ rb/sig/gems/websocket/websocket.rbs | 22 +++++++++++++++++++ rb/sig/gems/zip/entry.rbs | 7 ++++++ rb/sig/gems/zip/file.rbs | 6 +++++ rb/sig/interfaces/define_method.rbs | 3 +++ rb/sig/interfaces/features.rbs | 3 +++ rb/sig/interfaces/target.rbs | 3 +++ .../lib/selenium/webdriver/common/logger.rbs | 2 +- .../webdriver/common/profile_helper.rbs | 4 ++++ .../webdriver/common/websocket_connection.rbs | 2 ++ rb/sig/lib/selenium/webdriver/devtools.rbs | 3 +++ .../lib/selenium/webdriver/remote/bridge.rbs | 1 + .../lib/selenium/webdriver/support/color.rbs | 2 +- 15 files changed, 81 insertions(+), 2 deletions(-) create mode 100644 rb/sig/gems/websocket/handshake.rbs create mode 100644 rb/sig/gems/websocket/incoming.rbs create mode 100644 rb/sig/gems/websocket/outgoing.rbs create mode 100644 rb/sig/gems/websocket/websocket.rbs create mode 100644 rb/sig/gems/zip/entry.rbs create mode 100644 rb/sig/gems/zip/file.rbs create mode 100644 rb/sig/interfaces/define_method.rbs create mode 100644 rb/sig/interfaces/features.rbs create mode 100644 rb/sig/interfaces/target.rbs diff --git a/rb/sig/gems/websocket/handshake.rbs b/rb/sig/gems/websocket/handshake.rbs new file mode 100644 index 0000000000000..b040e994f6301 --- /dev/null +++ b/rb/sig/gems/websocket/handshake.rbs @@ -0,0 +1,7 @@ +module WebSocket + module Handshake + class Client + def initialize: (untyped) -> void + end + end +end diff --git a/rb/sig/gems/websocket/incoming.rbs b/rb/sig/gems/websocket/incoming.rbs new file mode 100644 index 0000000000000..1cd693a678b72 --- /dev/null +++ b/rb/sig/gems/websocket/incoming.rbs @@ -0,0 +1,9 @@ +module WebSocket + module Frame + class Incoming + class Client + def initialize: (untyped) -> void + end + end + end +end diff --git a/rb/sig/gems/websocket/outgoing.rbs b/rb/sig/gems/websocket/outgoing.rbs new file mode 100644 index 0000000000000..2d39c4483bdc0 --- /dev/null +++ b/rb/sig/gems/websocket/outgoing.rbs @@ -0,0 +1,9 @@ +module WebSocket + module Frame + class Outgoing + class Client + def initialize: (untyped) -> void + end + end + end +end diff --git a/rb/sig/gems/websocket/websocket.rbs b/rb/sig/gems/websocket/websocket.rbs new file mode 100644 index 0000000000000..03cbfaecf3ef4 --- /dev/null +++ b/rb/sig/gems/websocket/websocket.rbs @@ -0,0 +1,22 @@ +module WebSocket + DEFAULT_VERSION: Integer + ROOT: String + + # Defining autoloaded classes as interface or class is dependent on their implementation, + # which is not provided. Here, we'll declare them as modules, but they might need to be + # updated according to their actual definitions. + module Error + end + + module ExceptionHandler + end + + module Frame + end + + module Handshake + end + + module NiceInspect + end +end diff --git a/rb/sig/gems/zip/entry.rbs b/rb/sig/gems/zip/entry.rbs new file mode 100644 index 0000000000000..7a6ccb1cbf90b --- /dev/null +++ b/rb/sig/gems/zip/entry.rbs @@ -0,0 +1,7 @@ +module Zip + class Entry + def initialize: (untyped name, untyped entry_name) -> untyped + + def follow_symlinks=: (untyped) -> untyped + end +end diff --git a/rb/sig/gems/zip/file.rbs b/rb/sig/gems/zip/file.rbs new file mode 100644 index 0000000000000..63ba02cc66a59 --- /dev/null +++ b/rb/sig/gems/zip/file.rbs @@ -0,0 +1,6 @@ +module Zip + class File + def open: (untyped) -> untyped + end +end + diff --git a/rb/sig/interfaces/define_method.rbs b/rb/sig/interfaces/define_method.rbs new file mode 100644 index 0000000000000..5b5cc888844b8 --- /dev/null +++ b/rb/sig/interfaces/define_method.rbs @@ -0,0 +1,3 @@ +interface _DefineMethod + def define_method: (untyped) -> untyped +end diff --git a/rb/sig/interfaces/features.rbs b/rb/sig/interfaces/features.rbs new file mode 100644 index 0000000000000..42d59006c7977 --- /dev/null +++ b/rb/sig/interfaces/features.rbs @@ -0,0 +1,3 @@ +interface _Features + def upload_if_necessary: (untyped keys) -> untyped +end diff --git a/rb/sig/interfaces/target.rbs b/rb/sig/interfaces/target.rbs new file mode 100644 index 0000000000000..2742c815145a2 --- /dev/null +++ b/rb/sig/interfaces/target.rbs @@ -0,0 +1,3 @@ +interface _Target + def target: () -> String +end diff --git a/rb/sig/lib/selenium/webdriver/common/logger.rbs b/rb/sig/lib/selenium/webdriver/common/logger.rbs index 40d17d66ad377..e895190dd2702 100644 --- a/rb/sig/lib/selenium/webdriver/common/logger.rbs +++ b/rb/sig/lib/selenium/webdriver/common/logger.rbs @@ -21,7 +21,7 @@ module Selenium def allow: (*Symbol | Array[Symbol] ids) -> Array[Symbol] - def debug: (String message, ?id: Symbol | Array[Symbol] id) ?{ () -> void } -> void + def debug: (?String ?message, ?id: Symbol | Array[Symbol] id) ?{ () -> void } -> void def info: (String message, ?id: Symbol | Array[Symbol] id) ?{ () -> void } -> void diff --git a/rb/sig/lib/selenium/webdriver/common/profile_helper.rbs b/rb/sig/lib/selenium/webdriver/common/profile_helper.rbs index 0572b23f541ce..6333b19464dee 100644 --- a/rb/sig/lib/selenium/webdriver/common/profile_helper.rbs +++ b/rb/sig/lib/selenium/webdriver/common/profile_helper.rbs @@ -21,6 +21,10 @@ module Selenium module ClassMethods def from_json: (untyped json) -> untyped + + def new: (untyped directory) -> untyped + + def decoded: (untyped json) -> untyped end end end diff --git a/rb/sig/lib/selenium/webdriver/common/websocket_connection.rbs b/rb/sig/lib/selenium/webdriver/common/websocket_connection.rbs index a7492babc9b40..ddc35cf26118b 100644 --- a/rb/sig/lib/selenium/webdriver/common/websocket_connection.rbs +++ b/rb/sig/lib/selenium/webdriver/common/websocket_connection.rbs @@ -1,6 +1,8 @@ module Selenium module WebDriver class WebSocketConnection + include WebSocket + @callback_threads: untyped @session_id: untyped diff --git a/rb/sig/lib/selenium/webdriver/devtools.rbs b/rb/sig/lib/selenium/webdriver/devtools.rbs index 14f2b476d7370..088e3e8224bfb 100644 --- a/rb/sig/lib/selenium/webdriver/devtools.rbs +++ b/rb/sig/lib/selenium/webdriver/devtools.rbs @@ -1,6 +1,9 @@ module Selenium module WebDriver class DevTools + include _DefineMethod + include _Target + @ws: untyped @session_id: untyped diff --git a/rb/sig/lib/selenium/webdriver/remote/bridge.rbs b/rb/sig/lib/selenium/webdriver/remote/bridge.rbs index cf1a1d7be4d4f..5dc576b09b7ce 100644 --- a/rb/sig/lib/selenium/webdriver/remote/bridge.rbs +++ b/rb/sig/lib/selenium/webdriver/remote/bridge.rbs @@ -3,6 +3,7 @@ module Selenium module Remote class Bridge include _CommandList + include _Features @http: untyped diff --git a/rb/sig/lib/selenium/webdriver/support/color.rbs b/rb/sig/lib/selenium/webdriver/support/color.rbs index a411492a0fd5a..208d18b21141d 100644 --- a/rb/sig/lib/selenium/webdriver/support/color.rbs +++ b/rb/sig/lib/selenium/webdriver/support/color.rbs @@ -34,7 +34,7 @@ module Selenium attr_reader alpha: untyped - def self.from_string: (untyped str) -> untyped + def self.from_string: (String str) -> untyped def self.from_hsl: (untyped h, untyped s, untyped l, untyped a) -> untyped From 655491f056aca08955c4a18bddb8155026566662 Mon Sep 17 00:00:00 2001 From: aguspe Date: Wed, 21 Feb 2024 19:03:17 +0100 Subject: [PATCH 20/41] 95 problems in 43 files --- rb/Gemfile.lock | 5 ----- rb/sig/gems/rexml/document.rbs | 8 ++++++++ rb/sig/gems/rexml/xpath.rbs | 6 ++++++ rb/sig/lib/selenium/webdriver/common/zipper.rbs | 2 +- 4 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 rb/sig/gems/rexml/document.rbs create mode 100644 rb/sig/gems/rexml/xpath.rbs diff --git a/rb/Gemfile.lock b/rb/Gemfile.lock index 7e35e140b423c..d5703e596f667 100644 --- a/rb/Gemfile.lock +++ b/rb/Gemfile.lock @@ -50,11 +50,9 @@ GEM i18n (1.14.1) concurrent-ruby (~> 1.0) io-console (0.7.2) - io-console (0.7.2-java) irb (1.11.2) rdoc reline (>= 0.4.2) - jar-dependencies (0.4.1) json (2.7.1) json (2.7.1-java) language_server-protocol (3.17.0.3) @@ -70,8 +68,6 @@ GEM racc psych (5.1.2) stringio - psych (5.1.2-java) - jar-dependencies (>= 0.1.7) public_suffix (5.0.4) racc (1.7.3) racc (1.7.3-java) @@ -148,7 +144,6 @@ GEM terminal-table (>= 2, < 4) stringio (3.1.0) strscan (3.1.0) - strscan (3.1.0-java) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) tzinfo (2.0.6) diff --git a/rb/sig/gems/rexml/document.rbs b/rb/sig/gems/rexml/document.rbs new file mode 100644 index 0000000000000..9f486197fc6b6 --- /dev/null +++ b/rb/sig/gems/rexml/document.rbs @@ -0,0 +1,8 @@ +module REXML + class Document + def initialize: (untyped element) -> void + + def root: () -> untyped + end +end + diff --git a/rb/sig/gems/rexml/xpath.rbs b/rb/sig/gems/rexml/xpath.rbs new file mode 100644 index 0000000000000..00540b8633893 --- /dev/null +++ b/rb/sig/gems/rexml/xpath.rbs @@ -0,0 +1,6 @@ +module REXML + class XPath + def self.first: (untyped element, untyped path) -> untyped + end +end + diff --git a/rb/sig/lib/selenium/webdriver/common/zipper.rbs b/rb/sig/lib/selenium/webdriver/common/zipper.rbs index 0988f7bb50f52..090f02a7d49f3 100644 --- a/rb/sig/lib/selenium/webdriver/common/zipper.rbs +++ b/rb/sig/lib/selenium/webdriver/common/zipper.rbs @@ -1,7 +1,7 @@ module Selenium module WebDriver module Zipper - EXTENSIONS: ::Array[".zip" | ".xpi"] + EXTENSIONS: Array[String] def self.unzip: (untyped path) -> untyped From d60d506a40cae273ea28e5bb3143fdb060a21e8d Mon Sep 17 00:00:00 2001 From: aguspe Date: Thu, 22 Feb 2024 21:37:39 +0100 Subject: [PATCH 21/41] 92 problems in 42 files --- rb/sig/interfaces/define_method.rbs | 2 +- rb/sig/interfaces/target.rbs | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/rb/sig/interfaces/define_method.rbs b/rb/sig/interfaces/define_method.rbs index 5b5cc888844b8..62eff9c38997f 100644 --- a/rb/sig/interfaces/define_method.rbs +++ b/rb/sig/interfaces/define_method.rbs @@ -1,3 +1,3 @@ interface _DefineMethod - def define_method: (untyped) -> untyped + def define_method: (untyped) { (untyped) -> untyped } -> untyped end diff --git a/rb/sig/interfaces/target.rbs b/rb/sig/interfaces/target.rbs index 2742c815145a2..27930d3b44ff4 100644 --- a/rb/sig/interfaces/target.rbs +++ b/rb/sig/interfaces/target.rbs @@ -1,3 +1,7 @@ interface _Target - def target: () -> String + def target: () -> untyped + + def getTarget: () -> Hash[untyped, untyped] + + def attach_to_target: (Hash[untyped, untyped]) -> untyped end From 80d02c6e786c9586d80101bb0cb10e0c6e9ec353 Mon Sep 17 00:00:00 2001 From: aguspe Date: Thu, 22 Feb 2024 21:47:01 +0100 Subject: [PATCH 22/41] 9842 problems in 41 files --- rb/sig/interfaces/action_builder.rbs | 2 ++ rb/sig/interfaces/clickable.rbs | 3 +++ .../webdriver/common/interactions/key_actions.rbs | 9 ++++++--- 3 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 rb/sig/interfaces/clickable.rbs diff --git a/rb/sig/interfaces/action_builder.rbs b/rb/sig/interfaces/action_builder.rbs index e626ea14cc48b..d2500810780af 100644 --- a/rb/sig/interfaces/action_builder.rbs +++ b/rb/sig/interfaces/action_builder.rbs @@ -4,4 +4,6 @@ interface _ActionBuilder def device: (untyped) -> Selenium::WebDriver::Interactions::InputDevice def add_pointer_input: (Symbol kind, String name) -> ::Selenium::WebDriver::Interactions::PointerInput + + def add_key_input: (String key) -> ::Selenium::WebDriver::Interactions::KeyInput end diff --git a/rb/sig/interfaces/clickable.rbs b/rb/sig/interfaces/clickable.rbs new file mode 100644 index 0000000000000..405bd0086aec7 --- /dev/null +++ b/rb/sig/interfaces/clickable.rbs @@ -0,0 +1,3 @@ +interface _Clickable + def click: (untyped) -> untyped +end diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/key_actions.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/key_actions.rbs index 56125a973160d..f66890728d9ca 100644 --- a/rb/sig/lib/selenium/webdriver/common/interactions/key_actions.rbs +++ b/rb/sig/lib/selenium/webdriver/common/interactions/key_actions.rbs @@ -1,11 +1,14 @@ module Selenium module WebDriver module KeyActions - def key_down: (*Symbol | String | Element args, ?device: Symbol | String?) -> self + include _ActionBuilder + include _Clickable - def key_up: (*Symbol | String | Element args, ?device: Symbol | String?) -> self + def key_down: (*Symbol | String | Element args, ?device: Symbol | String?) -> KeyActions - def send_keys: (*Symbol | String | Element args, ?device: Symbol | String?) -> self + def key_up: (*Symbol | String | Element args, ?device: Symbol | String?) -> KeyActions + + def send_keys: (*untyped args, ?device: Symbol | String?) -> self private From 55b6cdfdb718d636a0a758165a9f78c5890d2584 Mon Sep 17 00:00:00 2001 From: aguspe Date: Fri, 23 Feb 2024 23:51:32 +0100 Subject: [PATCH 23/41] 81 problems in 41 files --- rb/Steepfile | 1 + rb/sig/gems/open3/open3.rbs | 3 +++ rb/sig/gems/zip/file.rbs | 2 ++ rb/sig/lib/selenium/webdriver/common/selenium_manager.rbs | 1 + 4 files changed, 7 insertions(+) create mode 100644 rb/sig/gems/open3/open3.rbs diff --git a/rb/Steepfile b/rb/Steepfile index d63dd2d39dba5..a66a16d842177 100644 --- a/rb/Steepfile +++ b/rb/Steepfile @@ -14,6 +14,7 @@ target :lib do 'base64', 'date', 'erb', + 'find', 'forwardable', 'ipaddr', 'net-http', diff --git a/rb/sig/gems/open3/open3.rbs b/rb/sig/gems/open3/open3.rbs new file mode 100644 index 0000000000000..dc9904a99d157 --- /dev/null +++ b/rb/sig/gems/open3/open3.rbs @@ -0,0 +1,3 @@ +module Open3 + def self.capture3: (*untyped) -> untyped +end diff --git a/rb/sig/gems/zip/file.rbs b/rb/sig/gems/zip/file.rbs index 63ba02cc66a59..8b62de9c68ccc 100644 --- a/rb/sig/gems/zip/file.rbs +++ b/rb/sig/gems/zip/file.rbs @@ -1,5 +1,7 @@ module Zip class File + CREATE: untyped + def open: (untyped) -> untyped end end diff --git a/rb/sig/lib/selenium/webdriver/common/selenium_manager.rbs b/rb/sig/lib/selenium/webdriver/common/selenium_manager.rbs index f4fd4bf2650f7..7355c8c27917b 100644 --- a/rb/sig/lib/selenium/webdriver/common/selenium_manager.rbs +++ b/rb/sig/lib/selenium/webdriver/common/selenium_manager.rbs @@ -7,6 +7,7 @@ module Selenium # class SeleniumManager include _Platform + include Open3 self.@bin_path: untyped From 7895af55ec44434c432ded8701f1aab0795bb4a6 Mon Sep 17 00:00:00 2001 From: aguspe Date: Sat, 24 Feb 2024 22:48:29 +0100 Subject: [PATCH 24/41] 69 problems in 36 files --- rb/Steepfile | 1 - rb/sig/interfaces/devtools.rbs | 2 +- rb/sig/interfaces/driver.rbs | 4 ++++ rb/sig/lib/selenium/webdriver/atoms.rbs | 5 +++++ rb/sig/lib/selenium/webdriver/common/action_builder.rbs | 4 ++-- rb/sig/lib/selenium/webdriver/common/driver.rbs | 2 ++ .../common/driver_extensions/has_file_downloads.rbs | 2 ++ .../webdriver/common/driver_extensions/uploads_files.rbs | 2 ++ .../selenium/webdriver/common/html5/shared_web_storage.rbs | 2 ++ .../selenium/webdriver/common/interactions/pointer_press.rbs | 2 +- rb/sig/lib/selenium/webdriver/common/local_driver.rbs | 2 ++ rb/sig/lib/selenium/webdriver/common/target_locator.rbs | 2 +- 12 files changed, 24 insertions(+), 6 deletions(-) diff --git a/rb/Steepfile b/rb/Steepfile index a66a16d842177..b48006fc48a71 100644 --- a/rb/Steepfile +++ b/rb/Steepfile @@ -19,6 +19,5 @@ target :lib do 'ipaddr', 'net-http', 'openssl', - 'uri', 'securerandom') # Standard libraries used end diff --git a/rb/sig/interfaces/devtools.rbs b/rb/sig/interfaces/devtools.rbs index a181083ef99a6..01b4ce39f1bc6 100644 --- a/rb/sig/interfaces/devtools.rbs +++ b/rb/sig/interfaces/devtools.rbs @@ -3,7 +3,7 @@ interface _DevTools end interface _ExecuteScript - def execute_script: (untyped) -> untyped + def execute_script: (untyped, *untyped) -> untyped end interface _FindElements diff --git a/rb/sig/interfaces/driver.rbs b/rb/sig/interfaces/driver.rbs index 23cad0c9ee890..4089947d7abe4 100644 --- a/rb/sig/interfaces/driver.rbs +++ b/rb/sig/interfaces/driver.rbs @@ -10,4 +10,8 @@ interface _Driver def ref: () -> untyped def bridge: () -> untyped + + def browser: () -> untyped + + def service_url: (untyped service) -> untyped end diff --git a/rb/sig/lib/selenium/webdriver/atoms.rbs b/rb/sig/lib/selenium/webdriver/atoms.rbs index 0382de4bfd8d6..eacbd40132411 100644 --- a/rb/sig/lib/selenium/webdriver/atoms.rbs +++ b/rb/sig/lib/selenium/webdriver/atoms.rbs @@ -1,6 +1,11 @@ module Selenium module WebDriver module Atoms + include _Bridge + include _ExecuteScript + + def atom_script: (untyped) -> untyped + private def read_atom: (Symbol function) -> String diff --git a/rb/sig/lib/selenium/webdriver/common/action_builder.rbs b/rb/sig/lib/selenium/webdriver/common/action_builder.rbs index b52dc09cb95db..1d8fd39b3a27a 100644 --- a/rb/sig/lib/selenium/webdriver/common/action_builder.rbs +++ b/rb/sig/lib/selenium/webdriver/common/action_builder.rbs @@ -39,7 +39,7 @@ module Selenium def perform: () -> nil - def clear_all_actions: () -> [] + def clear_all_actions: () -> Array[::Selenium::WebDriver::Interactions::InputDevice] def release_actions: () -> untyped @@ -47,7 +47,7 @@ module Selenium def tick: (*Interactions::InputDevice action_devices) -> (nil | Array[Interactions::InputDevice]) - def add_input: (Interactions::InputDevice | Symbol device) -> Interactions::InputDevice + def add_input: (Interactions::InputDevice | Symbol | interned device) -> Interactions::InputDevice end end end diff --git a/rb/sig/lib/selenium/webdriver/common/driver.rbs b/rb/sig/lib/selenium/webdriver/common/driver.rbs index 4445bbeddb1f8..e8f450a9617fa 100644 --- a/rb/sig/lib/selenium/webdriver/common/driver.rbs +++ b/rb/sig/lib/selenium/webdriver/common/driver.rbs @@ -7,6 +7,8 @@ module Selenium @navigate: untyped + @service_manager: untyped + def self.for: (*Symbol | Hash[Symbol, untyped]) -> untyped def initialize: (?bridge: Support::EventFiringBridge? bridge, ?listener: Support::AbstractEventListener? listener, **untyped opts) -> void diff --git a/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_file_downloads.rbs b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_file_downloads.rbs index d4b191d59cb87..c939c6eed4795 100644 --- a/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_file_downloads.rbs +++ b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_file_downloads.rbs @@ -2,6 +2,8 @@ module Selenium module WebDriver module DriverExtensions module HasFileDownloads + include _Driver + def downloadable_files: () -> untyped def download_file: (untyped file_name, untyped target_directory) -> untyped diff --git a/rb/sig/lib/selenium/webdriver/common/driver_extensions/uploads_files.rbs b/rb/sig/lib/selenium/webdriver/common/driver_extensions/uploads_files.rbs index fe3a3f395763f..89681963b5dd7 100644 --- a/rb/sig/lib/selenium/webdriver/common/driver_extensions/uploads_files.rbs +++ b/rb/sig/lib/selenium/webdriver/common/driver_extensions/uploads_files.rbs @@ -2,6 +2,8 @@ module Selenium module WebDriver module DriverExtensions module UploadsFiles + include _Driver + def file_detector=: (untyped detector) -> untyped end end diff --git a/rb/sig/lib/selenium/webdriver/common/html5/shared_web_storage.rbs b/rb/sig/lib/selenium/webdriver/common/html5/shared_web_storage.rbs index 13ed50003cbc6..85a59dc19453c 100644 --- a/rb/sig/lib/selenium/webdriver/common/html5/shared_web_storage.rbs +++ b/rb/sig/lib/selenium/webdriver/common/html5/shared_web_storage.rbs @@ -16,6 +16,8 @@ module Selenium def empty?: () -> untyped def each: () ?{ (untyped, untyped) -> untyped } -> untyped + + def []: (untyped key) -> untyped end end end diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/pointer_press.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/pointer_press.rbs index a9e183a7b3683..0c0ae8998bb97 100644 --- a/rb/sig/lib/selenium/webdriver/common/interactions/pointer_press.rbs +++ b/rb/sig/lib/selenium/webdriver/common/interactions/pointer_press.rbs @@ -12,7 +12,7 @@ module Selenium include PointerEventProperties - BUTTONS: { left: 0, touch: 0, pen_contact: 0, middle: 1, right: 2, pen_barrel: 2, x1: 3, back: 3, x2: 4, forward: 4 } + BUTTONS: { Symbol: Integer } DIRECTIONS: { down: :pointerDown, up: :pointerUp } diff --git a/rb/sig/lib/selenium/webdriver/common/local_driver.rbs b/rb/sig/lib/selenium/webdriver/common/local_driver.rbs index 402d0d412b784..7aecc6e07d2d1 100644 --- a/rb/sig/lib/selenium/webdriver/common/local_driver.rbs +++ b/rb/sig/lib/selenium/webdriver/common/local_driver.rbs @@ -1,6 +1,8 @@ module Selenium module WebDriver module LocalDriver + include _Driver + def initialize_local_driver: (untyped options, untyped service, untyped url) -> ::Array[untyped] def process_options: (untyped options, untyped service) -> untyped diff --git a/rb/sig/lib/selenium/webdriver/common/target_locator.rbs b/rb/sig/lib/selenium/webdriver/common/target_locator.rbs index 8f648f245c3c5..609989c2ca3d8 100644 --- a/rb/sig/lib/selenium/webdriver/common/target_locator.rbs +++ b/rb/sig/lib/selenium/webdriver/common/target_locator.rbs @@ -9,7 +9,7 @@ module Selenium def new_window: (?::Symbol `type`) { (untyped) -> untyped } -> untyped - def window: (untyped id) { () -> untyped } -> untyped + def window: (untyped id) ?{ () -> untyped } -> untyped def active_element: () -> Element From 41b23a3e251ac8a8b9420c30f479562d201852ec Mon Sep 17 00:00:00 2001 From: aguspe Date: Sun, 25 Feb 2024 19:47:33 +0100 Subject: [PATCH 25/41] 67 problems in 34 files --- rb/sig/interfaces/action_builder.rbs | 2 ++ rb/sig/interfaces/options.rbs | 2 ++ rb/sig/lib/selenium/webdriver/common/socket_poller.rbs | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/rb/sig/interfaces/action_builder.rbs b/rb/sig/interfaces/action_builder.rbs index d2500810780af..a26f787e4ccfe 100644 --- a/rb/sig/interfaces/action_builder.rbs +++ b/rb/sig/interfaces/action_builder.rbs @@ -6,4 +6,6 @@ interface _ActionBuilder def add_pointer_input: (Symbol kind, String name) -> ::Selenium::WebDriver::Interactions::PointerInput def add_key_input: (String key) -> ::Selenium::WebDriver::Interactions::KeyInput + + def add_wheel_input: (String name) -> ::Selenium::WebDriver::Interactions::InputDevice end diff --git a/rb/sig/interfaces/options.rbs b/rb/sig/interfaces/options.rbs index e45aeda945f48..489d92faab385 100644 --- a/rb/sig/interfaces/options.rbs +++ b/rb/sig/interfaces/options.rbs @@ -1,3 +1,5 @@ interface _Options def enable_login: -> untyped + + def enable_logging: (untyped browser_options) -> untyped end diff --git a/rb/sig/lib/selenium/webdriver/common/socket_poller.rbs b/rb/sig/lib/selenium/webdriver/common/socket_poller.rbs index 815c1819ee403..aff2a40bbcc11 100644 --- a/rb/sig/lib/selenium/webdriver/common/socket_poller.rbs +++ b/rb/sig/lib/selenium/webdriver/common/socket_poller.rbs @@ -19,9 +19,9 @@ module Selenium CONNECT_TIMEOUT: Integer - NOT_CONNECTED_ERRORS: untyped + NOT_CONNECTED_ERRORS: Array[singleton(::Errno::ECONNREFUSED) | singleton(::Errno::ENOTCONN) | singleton(::Errno::EPERM)] - CONNECTED_ERRORS: untyped + CONNECTED_ERRORS: Array[singleton(::Errno::EISCONN) | singleton(::Errno::EINVAL) | singleton(::Errno::EALREADY)] # we use a plain TCPSocket here since JRuby has issues closing socket # see https://github.com/jruby/jruby/issues/5709 From 84198d537b0d8d58e2120b9d92f0416129367b68 Mon Sep 17 00:00:00 2001 From: aguspe Date: Sun, 25 Feb 2024 20:02:08 +0100 Subject: [PATCH 26/41] 62 problems in 32 files --- rb/Steepfile | 1 + rb/sig/lib/selenium/webdriver/common/driver.rbs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/rb/Steepfile b/rb/Steepfile index b48006fc48a71..6e90a781691bc 100644 --- a/rb/Steepfile +++ b/rb/Steepfile @@ -19,5 +19,6 @@ target :lib do 'ipaddr', 'net-http', 'openssl', + 'tmpdir', 'securerandom') # Standard libraries used end diff --git a/rb/sig/lib/selenium/webdriver/common/driver.rbs b/rb/sig/lib/selenium/webdriver/common/driver.rbs index e8f450a9617fa..6bcec5f64ed20 100644 --- a/rb/sig/lib/selenium/webdriver/common/driver.rbs +++ b/rb/sig/lib/selenium/webdriver/common/driver.rbs @@ -9,7 +9,7 @@ module Selenium @service_manager: untyped - def self.for: (*Symbol | Hash[Symbol, untyped]) -> untyped + def self.for: (Symbol browser, ?Hash[Symbol, untyped] opts) -> untyped def initialize: (?bridge: Support::EventFiringBridge? bridge, ?listener: Support::AbstractEventListener? listener, **untyped opts) -> void From 6d09985e4128b89aaa51f1fdfc86c7722aeff763 Mon Sep 17 00:00:00 2001 From: aguspe Date: Mon, 26 Feb 2024 20:33:02 +0100 Subject: [PATCH 27/41] 54 problems in 30 files --- rb/Steepfile | 8 +++- rb/rbs_collection.lock.yaml | 38 +++++++++++++------ rb/sig/gems/zip/entry.rbs | 7 ---- rb/sig/gems/zip/file.rbs | 8 ---- .../selenium/webdriver/chrome/features.rbs | 1 + 5 files changed, 34 insertions(+), 28 deletions(-) delete mode 100644 rb/sig/gems/zip/entry.rbs delete mode 100644 rb/sig/gems/zip/file.rbs diff --git a/rb/Steepfile b/rb/Steepfile index 6e90a781691bc..32ace9080159f 100644 --- a/rb/Steepfile +++ b/rb/Steepfile @@ -1,5 +1,5 @@ target :lib do - signature 'sig' # Signature directory + signature 'sig', '.gem_rbs_collection/rubyzip' # Signature directory check 'lib' # Directory name ignore( # Ignore line 166 due to UDP RBS issue @@ -10,6 +10,7 @@ target :lib do 'lib/selenium/webdriver/remote/response.rb' ) + # Standard libraries used in the project library( 'base64', 'date', @@ -20,5 +21,8 @@ target :lib do 'net-http', 'openssl', 'tmpdir', - 'securerandom') # Standard libraries used + 'securerandom', + 'uri', + 'zlib' + ) end diff --git a/rb/rbs_collection.lock.yaml b/rb/rbs_collection.lock.yaml index f581d00b0d6eb..ce3878d164f4f 100644 --- a/rb/rbs_collection.lock.yaml +++ b/rb/rbs_collection.lock.yaml @@ -6,7 +6,7 @@ gems: source: type: git name: ruby/gem_rbs_collection - revision: 4b0d2f72e63b6c3e92dc54e19ce23dd24524f9a7 + revision: 01361bb0fd6e2f3e2da2b11a733ffc938b9047c4 remote: https://github.com/ruby/gem_rbs_collection.git repo_dir: gems - name: ast @@ -14,9 +14,13 @@ gems: source: type: git name: ruby/gem_rbs_collection - revision: 8149bc3fc0f720d935dc0592dc8886e03052f65f + revision: 01361bb0fd6e2f3e2da2b11a733ffc938b9047c4 remote: https://github.com/ruby/gem_rbs_collection.git repo_dir: gems +- name: bigdecimal + version: '0' + source: + type: stdlib - name: cgi version: '0' source: @@ -25,6 +29,14 @@ gems: version: '0' source: type: stdlib +- name: hashdiff + version: '1.1' + source: + type: git + name: ruby/gem_rbs_collection + revision: 01361bb0fd6e2f3e2da2b11a733ffc938b9047c4 + remote: https://github.com/ruby/gem_rbs_collection.git + repo_dir: gems - name: json version: '0' source: @@ -46,7 +58,7 @@ gems: source: type: git name: ruby/gem_rbs_collection - revision: 8149bc3fc0f720d935dc0592dc8886e03052f65f + revision: 01361bb0fd6e2f3e2da2b11a733ffc938b9047c4 remote: https://github.com/ruby/gem_rbs_collection.git repo_dir: gems - name: parser @@ -54,7 +66,7 @@ gems: source: type: git name: ruby/gem_rbs_collection - revision: 4b0d2f72e63b6c3e92dc54e19ce23dd24524f9a7 + revision: 01361bb0fd6e2f3e2da2b11a733ffc938b9047c4 remote: https://github.com/ruby/gem_rbs_collection.git repo_dir: gems - name: rack @@ -62,7 +74,7 @@ gems: source: type: git name: ruby/gem_rbs_collection - revision: 8149bc3fc0f720d935dc0592dc8886e03052f65f + revision: 01361bb0fd6e2f3e2da2b11a733ffc938b9047c4 remote: https://github.com/ruby/gem_rbs_collection.git repo_dir: gems - name: rainbow @@ -70,7 +82,7 @@ gems: source: type: git name: ruby/gem_rbs_collection - revision: 8149bc3fc0f720d935dc0592dc8886e03052f65f + revision: 01361bb0fd6e2f3e2da2b11a733ffc938b9047c4 remote: https://github.com/ruby/gem_rbs_collection.git repo_dir: gems - name: rake @@ -78,7 +90,7 @@ gems: source: type: git name: ruby/gem_rbs_collection - revision: 4b0d2f72e63b6c3e92dc54e19ce23dd24524f9a7 + revision: 01361bb0fd6e2f3e2da2b11a733ffc938b9047c4 remote: https://github.com/ruby/gem_rbs_collection.git repo_dir: gems - name: regexp_parser @@ -86,15 +98,19 @@ gems: source: type: git name: ruby/gem_rbs_collection - revision: 4b0d2f72e63b6c3e92dc54e19ce23dd24524f9a7 + revision: 01361bb0fd6e2f3e2da2b11a733ffc938b9047c4 remote: https://github.com/ruby/gem_rbs_collection.git repo_dir: gems +- name: ripper + version: '0' + source: + type: stdlib - name: rubocop version: '1.57' source: type: git name: ruby/gem_rbs_collection - revision: 4b0d2f72e63b6c3e92dc54e19ce23dd24524f9a7 + revision: 01361bb0fd6e2f3e2da2b11a733ffc938b9047c4 remote: https://github.com/ruby/gem_rbs_collection.git repo_dir: gems - name: rubocop-ast @@ -102,7 +118,7 @@ gems: source: type: git name: ruby/gem_rbs_collection - revision: 4b0d2f72e63b6c3e92dc54e19ce23dd24524f9a7 + revision: 01361bb0fd6e2f3e2da2b11a733ffc938b9047c4 remote: https://github.com/ruby/gem_rbs_collection.git repo_dir: gems - name: tempfile @@ -118,7 +134,7 @@ gems: source: type: git name: ruby/gem_rbs_collection - revision: 8149bc3fc0f720d935dc0592dc8886e03052f65f + revision: 01361bb0fd6e2f3e2da2b11a733ffc938b9047c4 remote: https://github.com/ruby/gem_rbs_collection.git repo_dir: gems gemfile_lock_path: Gemfile.lock diff --git a/rb/sig/gems/zip/entry.rbs b/rb/sig/gems/zip/entry.rbs deleted file mode 100644 index 7a6ccb1cbf90b..0000000000000 --- a/rb/sig/gems/zip/entry.rbs +++ /dev/null @@ -1,7 +0,0 @@ -module Zip - class Entry - def initialize: (untyped name, untyped entry_name) -> untyped - - def follow_symlinks=: (untyped) -> untyped - end -end diff --git a/rb/sig/gems/zip/file.rbs b/rb/sig/gems/zip/file.rbs deleted file mode 100644 index 8b62de9c68ccc..0000000000000 --- a/rb/sig/gems/zip/file.rbs +++ /dev/null @@ -1,8 +0,0 @@ -module Zip - class File - CREATE: untyped - - def open: (untyped) -> untyped - end -end - diff --git a/rb/sig/lib/selenium/webdriver/chrome/features.rbs b/rb/sig/lib/selenium/webdriver/chrome/features.rbs index da96fa5177673..ca81c62d2ba3c 100644 --- a/rb/sig/lib/selenium/webdriver/chrome/features.rbs +++ b/rb/sig/lib/selenium/webdriver/chrome/features.rbs @@ -3,6 +3,7 @@ module Selenium module Chrome module Features include WebDriver::Chromium::Features + include _Commands CHROME_COMMANDS: Hash[Symbol, Array[Symbol | String]] From 1c91e3e8ab80811d7760188c93bd4acbd1dad362 Mon Sep 17 00:00:00 2001 From: aguspe Date: Wed, 28 Feb 2024 17:01:42 +0100 Subject: [PATCH 28/41] Expand lists of ignored files --- rb/Steepfile | 33 ++++++++++++++++++- .../devtools/support/cdp_client_generator.rb | 2 +- rb/lib/selenium/webdriver/safari/options.rb | 2 -- rb/sig/interfaces/bridge.rbs | 2 +- .../selenium/webdriver/bidi/log_inspector.rbs | 2 +- .../selenium/webdriver/chrome/features.rbs | 2 +- .../selenium/webdriver/chromium/options.rbs | 4 +-- .../lib/selenium/webdriver/common/driver.rbs | 2 +- .../common/interactions/input_device.rbs | 4 +-- .../common/interactions/pointer_press.rbs | 2 +- .../webdriver/common/interactions/scroll.rbs | 5 +-- .../lib/selenium/webdriver/common/logger.rbs | 6 ++-- .../lib/selenium/webdriver/common/options.rbs | 6 ++-- .../webdriver/common/takes_screenshot.rbs | 2 +- .../virtual_authenticator/credential.rbs | 6 ++-- .../devtools/network_interceptor.rbs | 14 ++------ .../selenium/webdriver/firefox/options.rbs | 4 +-- rb/sig/lib/selenium/webdriver/ie/options.rbs | 2 +- .../lib/selenium/webdriver/safari/options.rbs | 3 +- .../lib/selenium/webdriver/support/color.rbs | 6 ++-- 20 files changed, 62 insertions(+), 47 deletions(-) diff --git a/rb/Steepfile b/rb/Steepfile index 32ace9080159f..64373c565cd43 100644 --- a/rb/Steepfile +++ b/rb/Steepfile @@ -7,7 +7,38 @@ target :lib do # Ignore due to webmock gem not having RBS signatures 'lib/selenium/webdriver/remote/http/curb.rb', # Ignore due to line 71, there is one last error where RBS thinks backtrace is nil - 'lib/selenium/webdriver/remote/response.rb' + 'lib/selenium/webdriver/remote/response.rb', + # Ignore due to Errno::EACCES error + 'lib/selenium/webdriver/support/color.rb', + 'lib/selenium/webdriver/common/port_prober.rb', + # Ignore due to error overloading + 'lib/selenium/webdriver/common/socket_poller.rb', + # Ignore due to Parser on line 611 + 'lib/selenium/webdriver/remote/bridge.rb', + # Ignore due to error on line 101 with block + 'lib/selenium/webdriver/devtools/network_interceptor.rb', + # Ignore due to error on line 21 with overloading issues + 'lib/selenium/webdriver/common/virtual_authenticator/credential.rb', + # Ignore due to error with the Zipper RBS + 'lib/selenium/webdriver/common/zipper.rb', + # Ignore due to error on line 117 with the debug? method + 'lib/selenium/webdriver/common/selenium_manager.rb', + # Ignore due to line 230 with the overloading issues + 'lib/selenium/webdriver/common/action_builder.rb', + # Ignore due to CAPABILITIES not able to be found on line 55 + 'lib/selenium/webdriver/common/options.rb', + # Ignore due to strftime error in RBS on line 188 + 'lib/selenium/webdriver/common/logger.rb', + # Ignore due to error with Process + 'lib/selenium/webdriver/common/child_process.rb', + # Ignore due to Net::HTTP not being found on line 49 + 'lib/selenium/webdriver/chromium/driver.rb', + # Ignore due to error on line 37 with include? + 'lib/selenium/webdriver/support/guards/guard_condition.rb', + # Ignore due to positional argument error on line 69 + 'lib/selenium/webdriver/common/socket_lock.rb', + # Ignore due to is_a? bot error on line 70 + 'lib/selenium/webdriver/remote/driver.rb' ) # Standard libraries used in the project diff --git a/rb/lib/selenium/devtools/support/cdp_client_generator.rb b/rb/lib/selenium/devtools/support/cdp_client_generator.rb index 3ef10746341f6..be3562704bfef 100644 --- a/rb/lib/selenium/devtools/support/cdp_client_generator.rb +++ b/rb/lib/selenium/devtools/support/cdp_client_generator.rb @@ -104,7 +104,7 @@ def process_loader(domains) Selenium::DevTools::Support::CDPClientGenerator.new.call( browser_protocol_path: browser_protocol_path, js_protocol_path: js_protocol_path, - output_dir: loader_path.sub(/\.rb$/, ''), + output_dir: loader_path&.sub(/\.rb$/, ''), loader_path: loader_path, version: version ) diff --git a/rb/lib/selenium/webdriver/safari/options.rb b/rb/lib/selenium/webdriver/safari/options.rb index 352132648207f..ac86ff8ae9459 100644 --- a/rb/lib/selenium/webdriver/safari/options.rb +++ b/rb/lib/selenium/webdriver/safari/options.rb @@ -22,8 +22,6 @@ module WebDriver module Safari class Options < WebDriver::Options attr_accessor :options - - # @see https://developer.apple.com/documentation/webkit/about_webdriver_for_safari CAPABILITIES = {automatic_inspection: 'safari:automaticInspection', automatic_profiling: 'safari:automaticProfiling'}.freeze BROWSER = Selenium::WebDriver::Safari.technology_preview? ? 'Safari Technology Preview' : 'safari' diff --git a/rb/sig/interfaces/bridge.rbs b/rb/sig/interfaces/bridge.rbs index 66665e14eccb3..65b901248fda3 100644 --- a/rb/sig/interfaces/bridge.rbs +++ b/rb/sig/interfaces/bridge.rbs @@ -1,3 +1,3 @@ interface _Bridge - def execute: (untyped command, ?::Hash[untyped, untyped] opts, ?untyped? command_hash) -> untyped + def execute: (untyped command, ?Hash[untyped, untyped] opts, ?untyped? command_hash) -> untyped end diff --git a/rb/sig/lib/selenium/webdriver/bidi/log_inspector.rbs b/rb/sig/lib/selenium/webdriver/bidi/log_inspector.rbs index 16ed800a09be3..a6e1bf86452a1 100644 --- a/rb/sig/lib/selenium/webdriver/bidi/log_inspector.rbs +++ b/rb/sig/lib/selenium/webdriver/bidi/log_inspector.rbs @@ -4,7 +4,7 @@ module Selenium class LogInspector @bidi: untyped - EVENTS: { entry_added: "entryAdded" } + EVENTS: Hash[Symbol, String] LOG_LEVEL: { DEBUG: "debug", ERROR: "error", INFO: "info", WARNING: "warning" } diff --git a/rb/sig/lib/selenium/webdriver/chrome/features.rbs b/rb/sig/lib/selenium/webdriver/chrome/features.rbs index ca81c62d2ba3c..faa1827717148 100644 --- a/rb/sig/lib/selenium/webdriver/chrome/features.rbs +++ b/rb/sig/lib/selenium/webdriver/chrome/features.rbs @@ -3,9 +3,9 @@ module Selenium module Chrome module Features include WebDriver::Chromium::Features - include _Commands CHROME_COMMANDS: Hash[Symbol, Array[Symbol | String]] + COMMANDS: Array[Symbol | String] def command_list: -> untyped diff --git a/rb/sig/lib/selenium/webdriver/chromium/options.rbs b/rb/sig/lib/selenium/webdriver/chromium/options.rbs index 9aa9ebb1407ba..68141ea91a493 100644 --- a/rb/sig/lib/selenium/webdriver/chromium/options.rbs +++ b/rb/sig/lib/selenium/webdriver/chromium/options.rbs @@ -18,10 +18,8 @@ module Selenium attr_accessor logging_prefs: untyped - # see: http://chromedriver.chromium.org/capabilities - CAPABILITIES: { args: "args", binary: "binary", local_state: "localState", prefs: "prefs", detach: "detach", debugger_address: "debuggerAddress", exclude_switches: "excludeSwitches", minidump_path: "minidumpPath", emulation: "mobileEmulation", perf_logging_prefs: "perfLoggingPrefs", window_types: "windowTypes", android_package: "androidPackage", android_activity: "androidActivity", android_device_serial: "androidDeviceSerial", android_use_running_app: "androidUseRunningApp" } + CAPABILITIES: Hash[Symbol, String] - # NOTE: special handling of 'extensions' to validate when set instead of when used attr_reader extensions: untyped def initialize: (?profile: untyped?, **untyped opts) -> void diff --git a/rb/sig/lib/selenium/webdriver/common/driver.rbs b/rb/sig/lib/selenium/webdriver/common/driver.rbs index 6bcec5f64ed20..0f662b3c38d7b 100644 --- a/rb/sig/lib/selenium/webdriver/common/driver.rbs +++ b/rb/sig/lib/selenium/webdriver/common/driver.rbs @@ -9,7 +9,7 @@ module Selenium @service_manager: untyped - def self.for: (Symbol browser, ?Hash[Symbol, untyped] opts) -> untyped + def self.for: (?Symbol browser, ?Hash[Symbol, untyped] opts, *untyped args) -> untyped def initialize: (?bridge: Support::EventFiringBridge? bridge, ?listener: Support::AbstractEventListener? listener, **untyped opts) -> void diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/input_device.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/input_device.rbs index 98d2ba3c072e0..79ca3c0c67573 100644 --- a/rb/sig/lib/selenium/webdriver/common/interactions/input_device.rbs +++ b/rb/sig/lib/selenium/webdriver/common/interactions/input_device.rbs @@ -16,11 +16,11 @@ module Selenium def add_action: (Interaction action) -> Array[Interaction] - def clear_actions: () -> [] + def clear_actions: () -> Array[untyped] def create_pause: (Float duration) -> Array[Interaction] - def encode: () -> ({ type: String, id: String, actions: Array[untyped] } | nil) + def encode: () -> Hash[untyped, untyped] end end end diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/pointer_press.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/pointer_press.rbs index 0c0ae8998bb97..50211325feb93 100644 --- a/rb/sig/lib/selenium/webdriver/common/interactions/pointer_press.rbs +++ b/rb/sig/lib/selenium/webdriver/common/interactions/pointer_press.rbs @@ -12,7 +12,7 @@ module Selenium include PointerEventProperties - BUTTONS: { Symbol: Integer } + BUTTONS: Array[Hash[Symbol, Integer]] DIRECTIONS: { down: :pointerDown, up: :pointerUp } diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/scroll.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/scroll.rbs index bc32ccac9b1af..0d94400680a65 100644 --- a/rb/sig/lib/selenium/webdriver/common/interactions/scroll.rbs +++ b/rb/sig/lib/selenium/webdriver/common/interactions/scroll.rbs @@ -16,11 +16,12 @@ module Selenium @delta_y: untyped - def initialize: (source: untyped, ?origin: ::Symbol, ?duration: ::Float, **untyped opts) -> void + def initialize: (source: untyped, ?origin: Symbol, ?duration: Float, **untyped opts) -> void | + (**untyped opts) -> void def assert_source: (untyped source) -> (untyped | nil) - def encode: () -> ::Hash[::String, untyped] + def encode: () -> Hash[String, untyped] end end end diff --git a/rb/sig/lib/selenium/webdriver/common/logger.rbs b/rb/sig/lib/selenium/webdriver/common/logger.rbs index e895190dd2702..f2d3800e13004 100644 --- a/rb/sig/lib/selenium/webdriver/common/logger.rbs +++ b/rb/sig/lib/selenium/webdriver/common/logger.rbs @@ -21,7 +21,7 @@ module Selenium def allow: (*Symbol | Array[Symbol] ids) -> Array[Symbol] - def debug: (?String ?message, ?id: Symbol | Array[Symbol] id) ?{ () -> void } -> void + def debug: (String ?message, ?id: Symbol | Array[Symbol] id) ?{ () -> void } -> void def info: (String message, ?id: Symbol | Array[Symbol] id) ?{ () -> void } -> void @@ -29,13 +29,13 @@ module Selenium def warn: (String message, ?id: Symbol | Array[Symbol] id) ?{ () -> void } -> void - def deprecate: (String old, ?String? new, ?id: Symbol | Array[Symbol] id, ?reference: ::String reference) { () -> void } -> (void) + def deprecate: (String old, ?String? new, ?id: Symbol | Array[Symbol] id, ?reference: String reference) { () -> void } -> (void) private def create_logger: (String name, level: Symbol level) -> ::Logger - def discard_or_log: (Symbol level, String message, (::Symbol | ::Array[::Symbol]) | [(::Symbol | ::Array[::Symbol])] id) ?{ () -> void } -> (void) + def discard_or_log: (Symbol level, String message, (Symbol | Array[::Symbol]) | [(Symbol | Array[Symbol])] id) ?{ () -> void } -> (void) end end end diff --git a/rb/sig/lib/selenium/webdriver/common/options.rbs b/rb/sig/lib/selenium/webdriver/common/options.rbs index 9e0cdda1610f4..ccb419b4f7902 100644 --- a/rb/sig/lib/selenium/webdriver/common/options.rbs +++ b/rb/sig/lib/selenium/webdriver/common/options.rbs @@ -3,15 +3,15 @@ module Selenium class Options @options: untyped - W3C_OPTIONS: ::Array[:browser_name | :browser_version | :platform_name | :accept_insecure_certs | :page_load_strategy | :proxy | :set_window_rect | :timeouts | :unhandled_prompt_behavior | :strict_file_interactability | :web_socket_url] + W3C_OPTIONS: Array[Symbol] - GRID_OPTIONS: ::Array[:enable_downloads] + GRID_OPTIONS: Array[Symbol] BROWSER: untyped KEY: untyped - CAPABILITIES: untyped + CAPABILITIES: Hash[Symbol, String] attr_reader self.driver_path: untyped diff --git a/rb/sig/lib/selenium/webdriver/common/takes_screenshot.rbs b/rb/sig/lib/selenium/webdriver/common/takes_screenshot.rbs index d9838e3b17eae..efe1cce041dec 100644 --- a/rb/sig/lib/selenium/webdriver/common/takes_screenshot.rbs +++ b/rb/sig/lib/selenium/webdriver/common/takes_screenshot.rbs @@ -5,7 +5,7 @@ module Selenium def save_screenshot: (String png_path, ?full_page: bool full_page) -> untyped - def screenshot_as: (Symbol format, ?full_page: bool full_page) -> (Integer | Float | String | nil) + def screenshot_as: (Symbol format, ?full_page: bool full_page) -> String? end end end diff --git a/rb/sig/lib/selenium/webdriver/common/virtual_authenticator/credential.rbs b/rb/sig/lib/selenium/webdriver/common/virtual_authenticator/credential.rbs index bb1a659f48fb1..b80c99be9aa73 100644 --- a/rb/sig/lib/selenium/webdriver/common/virtual_authenticator/credential.rbs +++ b/rb/sig/lib/selenium/webdriver/common/virtual_authenticator/credential.rbs @@ -13,15 +13,15 @@ module Selenium @sign_count: untyped - def self.resident: (**untyped opts) -> untyped + def self.resident: (**untyped opts) -> Credential - def self.non_resident: (**untyped opts) -> untyped + def self.non_resident: (**untyped opts) -> Credential def self.encode: (untyped byte_array) -> untyped def self.decode: (untyped base64) -> untyped - def self.from_json: (untyped opts) -> untyped + def self.from_json: (untyped opts) -> Credential attr_reader id: untyped diff --git a/rb/sig/lib/selenium/webdriver/devtools/network_interceptor.rbs b/rb/sig/lib/selenium/webdriver/devtools/network_interceptor.rbs index 3dfb6b2081188..c37ab73053bbb 100644 --- a/rb/sig/lib/selenium/webdriver/devtools/network_interceptor.rbs +++ b/rb/sig/lib/selenium/webdriver/devtools/network_interceptor.rbs @@ -10,13 +10,9 @@ module Selenium @cancelled_requests: untyped - # CDP fails to get body on certain responses (301) and raises: - # "Can only get response body on requests captured after headers received." - CANNOT_GET_BODY_ON_REDIRECT_ERROR_CODE: "-32000" + CANNOT_GET_BODY_ON_REDIRECT_ERROR_CODE: String - # CDP fails to operate with intercepted requests. - # Typical reason is browser cancelling intercepted requests/responses. - INVALID_INTERCEPTION_ID_ERROR_CODE: "-32602" + INVALID_INTERCEPTION_ID_ERROR_CODE: String def initialize: (untyped devtools) -> void @@ -28,20 +24,14 @@ module Selenium attr_accessor lock: untyped - # We should be thread-safe to use the hash without synchronization - # because its keys are interception job identifiers and they should be - # unique within a devtools session. def pending_response_requests: () -> untyped - # Ensure usage of cancelled_requests is thread-safe via synchronization! def cancelled_requests: () -> untyped def track_cancelled_request: (untyped data) -> (nil | untyped) def request_paused: (untyped data) { () -> untyped } -> untyped - # The presence of any of these fields indicate we're at the response stage. - # @see https://chromedevtools.github.io/devtools-protocol/tot/Fetch/#event-requestPaused def response?: (untyped params) -> untyped def intercept_request: (untyped id, untyped params) { () -> untyped } -> untyped diff --git a/rb/sig/lib/selenium/webdriver/firefox/options.rbs b/rb/sig/lib/selenium/webdriver/firefox/options.rbs index e56b258842a1c..914cb204fb1ff 100644 --- a/rb/sig/lib/selenium/webdriver/firefox/options.rbs +++ b/rb/sig/lib/selenium/webdriver/firefox/options.rbs @@ -10,12 +10,10 @@ module Selenium KEY: "moz:firefoxOptions" - # see: https://developer.mozilla.org/en-US/docs/Web/WebDriver/Capabilities/firefoxOptions - CAPABILITIES: { binary: "binary", args: "args", log: "log", prefs: "prefs", env: "env", android_package: "androidPackage", android_activity: "androidActivity", android_device_serial: "androidDeviceSerial", android_intent_arguments: "androidIntentArguments" } + CAPABILITIES: Hash[Symbol, String] BROWSER: "firefox" - # NOTE: special handling of 'profile' to validate when set instead of when used attr_reader profile: untyped def initialize: (?log_level: untyped?, **untyped opts) -> void diff --git a/rb/sig/lib/selenium/webdriver/ie/options.rbs b/rb/sig/lib/selenium/webdriver/ie/options.rbs index e2f90e25e8e29..f28be8d158b88 100644 --- a/rb/sig/lib/selenium/webdriver/ie/options.rbs +++ b/rb/sig/lib/selenium/webdriver/ie/options.rbs @@ -10,7 +10,7 @@ module Selenium SCROLL_BOTTOM: 1 - CAPABILITIES: { browser_attach_timeout: "browserAttachTimeout", element_scroll_behavior: "elementScrollBehavior", full_page_screenshot: "ie.enableFullPageScreenshot", ensure_clean_session: "ie.ensureCleanSession", file_upload_dialog_timeout: "ie.fileUploadDialogTimeout", force_create_process_api: "ie.forceCreateProcessApi", force_shell_windows_api: "ie.forceShellWindowsApi", ignore_protected_mode_settings: "ignoreProtectedModeSettings", ignore_zoom_level: "ignoreZoomSetting", initial_browser_url: "initialBrowserUrl", native_events: "nativeEvents", persistent_hover: "enablePersistentHover", require_window_focus: "requireWindowFocus", use_per_process_proxy: "ie.usePerProcessProxy", use_legacy_file_upload_dialog_handling: "ie.useLegacyFileUploadDialogHandling", attach_to_edge_chrome: "ie.edgechromium", edge_executable_path: "ie.edgepath", ignore_process_match: "ie.ignoreprocessmatch" } + CAPABILITIES: Hash[Symbol, String] BROWSER: "internet explorer" diff --git a/rb/sig/lib/selenium/webdriver/safari/options.rbs b/rb/sig/lib/selenium/webdriver/safari/options.rbs index 7c0d88040c9bc..6ae1af64afe5f 100644 --- a/rb/sig/lib/selenium/webdriver/safari/options.rbs +++ b/rb/sig/lib/selenium/webdriver/safari/options.rbs @@ -4,8 +4,7 @@ module Selenium class Options < WebDriver::Options attr_accessor options: untyped - # @see https://developer.apple.com/documentation/webkit/about_webdriver_for_safari - CAPABILITIES: { automatic_inspection: "safari:automaticInspection", automatic_profiling: "safari:automaticProfiling" } + CAPABILITIES: Hash[Symbol, String] BROWSER: untyped diff --git a/rb/sig/lib/selenium/webdriver/support/color.rbs b/rb/sig/lib/selenium/webdriver/support/color.rbs index 208d18b21141d..8a540a9c3b3ac 100644 --- a/rb/sig/lib/selenium/webdriver/support/color.rbs +++ b/rb/sig/lib/selenium/webdriver/support/color.rbs @@ -40,7 +40,7 @@ module Selenium def self.hue_to_rgb: (untyped lum1, untyped lum2, untyped hue) -> untyped - def initialize: (String ?red, String ?green, String ?blue, ?Float | Integer | String ?alpha, *untyped args) -> void + def initialize: (String red, String green, String blue, Float | Integer | String ?alpha, *untyped args) -> void def ==: (untyped other) -> (bool | untyped) @@ -48,9 +48,9 @@ module Selenium def hash: () -> untyped - def rgb: () -> ::String + def rgb: () -> String - def rgba: () -> ::String + def rgba: () -> String def hex: () -> untyped end From 650c0da01c99af15f74c0257807ad4f63b3f1dae Mon Sep 17 00:00:00 2001 From: aguspe Date: Tue, 5 Mar 2024 22:17:35 +0100 Subject: [PATCH 29/41] 15 problems in 8 files --- rb/lib/selenium/webdriver/common/takes_screenshot.rb | 2 +- rb/sig/lib/selenium/webdriver/chrome/features.rbs | 2 +- .../selenium/webdriver/common/interactions/input_device.rbs | 2 +- .../selenium/webdriver/common/interactions/pointer_press.rbs | 2 +- rb/sig/lib/selenium/webdriver/common/interactions/scroll.rbs | 3 +-- rb/sig/lib/selenium/webdriver/common/logger.rbs | 3 ++- rb/sig/lib/selenium/webdriver/common/takes_screenshot.rbs | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/rb/lib/selenium/webdriver/common/takes_screenshot.rb b/rb/lib/selenium/webdriver/common/takes_screenshot.rb index 41d27d7d5e450..965445ac26a2c 100644 --- a/rb/lib/selenium/webdriver/common/takes_screenshot.rb +++ b/rb/lib/selenium/webdriver/common/takes_screenshot.rb @@ -57,7 +57,7 @@ def screenshot_as(format, full_page: false) when :base64 full_page ? full_screenshot : screenshot when :png - screenshot_as(:base64, full_page: full_page)&.unpack1('m') + screenshot_as(:base64, full_page: full_page).unpack1('m') else raise Error::UnsupportedOperationError, "unsupported format: #{format.inspect}" end diff --git a/rb/sig/lib/selenium/webdriver/chrome/features.rbs b/rb/sig/lib/selenium/webdriver/chrome/features.rbs index faa1827717148..a4523edc32d4b 100644 --- a/rb/sig/lib/selenium/webdriver/chrome/features.rbs +++ b/rb/sig/lib/selenium/webdriver/chrome/features.rbs @@ -4,7 +4,7 @@ module Selenium module Features include WebDriver::Chromium::Features - CHROME_COMMANDS: Hash[Symbol, Array[Symbol | String]] + CHROME_COMMANDS: untyped COMMANDS: Array[Symbol | String] def command_list: -> untyped diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/input_device.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/input_device.rbs index 79ca3c0c67573..01e8e62c8db42 100644 --- a/rb/sig/lib/selenium/webdriver/common/interactions/input_device.rbs +++ b/rb/sig/lib/selenium/webdriver/common/interactions/input_device.rbs @@ -20,7 +20,7 @@ module Selenium def create_pause: (Float duration) -> Array[Interaction] - def encode: () -> Hash[untyped, untyped] + def encode: () -> untyped end end end diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/pointer_press.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/pointer_press.rbs index 50211325feb93..52d163e6b7ecd 100644 --- a/rb/sig/lib/selenium/webdriver/common/interactions/pointer_press.rbs +++ b/rb/sig/lib/selenium/webdriver/common/interactions/pointer_press.rbs @@ -12,7 +12,7 @@ module Selenium include PointerEventProperties - BUTTONS: Array[Hash[Symbol, Integer]] + BUTTONS: untyped DIRECTIONS: { down: :pointerDown, up: :pointerUp } diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/scroll.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/scroll.rbs index 0d94400680a65..e1ff908fc9499 100644 --- a/rb/sig/lib/selenium/webdriver/common/interactions/scroll.rbs +++ b/rb/sig/lib/selenium/webdriver/common/interactions/scroll.rbs @@ -16,8 +16,7 @@ module Selenium @delta_y: untyped - def initialize: (source: untyped, ?origin: Symbol, ?duration: Float, **untyped opts) -> void | - (**untyped opts) -> void + def initialize: (source: untyped, ?origin: Symbol, ?duration: Float, **untyped opts) -> void def assert_source: (untyped source) -> (untyped | nil) diff --git a/rb/sig/lib/selenium/webdriver/common/logger.rbs b/rb/sig/lib/selenium/webdriver/common/logger.rbs index f2d3800e13004..0b8f39a33ca76 100644 --- a/rb/sig/lib/selenium/webdriver/common/logger.rbs +++ b/rb/sig/lib/selenium/webdriver/common/logger.rbs @@ -1,7 +1,6 @@ module Selenium module WebDriver class Logger - extend Forwardable @allowed: Array[Symbol] @first_warning: bool @@ -31,6 +30,8 @@ module Selenium def deprecate: (String old, ?String? new, ?id: Symbol | Array[Symbol] id, ?reference: String reference) { () -> void } -> (void) + def debug?: () -> bool + private def create_logger: (String name, level: Symbol level) -> ::Logger diff --git a/rb/sig/lib/selenium/webdriver/common/takes_screenshot.rbs b/rb/sig/lib/selenium/webdriver/common/takes_screenshot.rbs index efe1cce041dec..723b68e5427d8 100644 --- a/rb/sig/lib/selenium/webdriver/common/takes_screenshot.rbs +++ b/rb/sig/lib/selenium/webdriver/common/takes_screenshot.rbs @@ -5,7 +5,7 @@ module Selenium def save_screenshot: (String png_path, ?full_page: bool full_page) -> untyped - def screenshot_as: (Symbol format, ?full_page: bool full_page) -> String? + def screenshot_as: (Symbol format, ?full_page: bool full_page) -> untyped end end end From e7fee249e485a622978aeba7fda7da37bf5c190b Mon Sep 17 00:00:00 2001 From: aguspe Date: Wed, 6 Mar 2024 22:30:40 +0100 Subject: [PATCH 30/41] 0 errors in 0 files --- rb/Steepfile | 21 ++++++++++++++++++- rb/lib/selenium/webdriver/firefox/driver.rb | 1 + .../selenium/webdriver/chromium/features.rbs | 3 ++- .../lib/selenium/webdriver/common/driver.rbs | 4 ++-- .../lib/selenium/webdriver/remote/bridge.rbs | 2 +- 5 files changed, 26 insertions(+), 5 deletions(-) diff --git a/rb/Steepfile b/rb/Steepfile index 64373c565cd43..94c6a346237e6 100644 --- a/rb/Steepfile +++ b/rb/Steepfile @@ -1,6 +1,7 @@ target :lib do signature 'sig', '.gem_rbs_collection/rubyzip' # Signature directory check 'lib' # Directory name + # Total amount of errors ignore 62 ignore( # Ignore line 166 due to UDP RBS issue 'lib/selenium/webdriver/common/platform.rb', @@ -38,7 +39,25 @@ target :lib do # Ignore due to positional argument error on line 69 'lib/selenium/webdriver/common/socket_lock.rb', # Ignore due to is_a? bot error on line 70 - 'lib/selenium/webdriver/remote/driver.rb' + 'lib/selenium/webdriver/remote/driver.rb', + # Ignore due to line 118 causing an error with URI & Net::HTTP + 'lib/selenium/server.rb', + # Ignore due to overloading issue on line 84 + 'lib/selenium/webdriver/chromium/features.rb', + # Ignore due to line 59 with the same URI & Net::HTTP issue + 'lib/selenium/webdriver/firefox/driver.rb', + # Ignore due to line 27 with overloading issue + 'lib/selenium/webdriver/bidi/log/console_log_entry.rb', + # Ignore due to line 74 with overloading issue + 'lib/selenium/webdriver/common/driver.rb', + # Ignore due to line 89 with overloading issue + 'lib/selenium/webdriver.rb', + # Ignore due to line 37 with overloading issue + 'lib/selenium/webdriver/common/interactions/wheel_input.rb', + # Cannot override last error on line 71 + 'lib/selenium/webdriver/common/wait.rb', + # Cannot override params on line 83 + 'lib/selenium/webdriver/bidi/log_inspector.rb' ) # Standard libraries used in the project diff --git a/rb/lib/selenium/webdriver/firefox/driver.rb b/rb/lib/selenium/webdriver/firefox/driver.rb index 717eea5ba711c..d8de991be5858 100644 --- a/rb/lib/selenium/webdriver/firefox/driver.rb +++ b/rb/lib/selenium/webdriver/firefox/driver.rb @@ -55,6 +55,7 @@ def devtools_url end uri = URI("http://#{capabilities['moz:debuggerAddress']}") + response = Net::HTTP.get(uri.hostname, '/json/version', uri.port) JSON.parse(response)['webSocketDebuggerUrl'] diff --git a/rb/sig/lib/selenium/webdriver/chromium/features.rbs b/rb/sig/lib/selenium/webdriver/chromium/features.rbs index 05ef1b05db5ae..a48cca64401fe 100644 --- a/rb/sig/lib/selenium/webdriver/chromium/features.rbs +++ b/rb/sig/lib/selenium/webdriver/chromium/features.rbs @@ -34,7 +34,8 @@ module Selenium def available_log_types: () -> Array[Symbol] - def log: (Symbol type) -> Array[Hash[String, untyped]] + def log: (Symbol type) -> Array[Hash[String, untyped]] | + (Symbol type) -> Array[LogEntry] end end end diff --git a/rb/sig/lib/selenium/webdriver/common/driver.rbs b/rb/sig/lib/selenium/webdriver/common/driver.rbs index 0f662b3c38d7b..87ca138394517 100644 --- a/rb/sig/lib/selenium/webdriver/common/driver.rbs +++ b/rb/sig/lib/selenium/webdriver/common/driver.rbs @@ -9,7 +9,7 @@ module Selenium @service_manager: untyped - def self.for: (?Symbol browser, ?Hash[Symbol, untyped] opts, *untyped args) -> untyped + def self.for: (untyped browser, Hash[untyped, untyped] opts) -> untyped def initialize: (?bridge: Support::EventFiringBridge? bridge, ?listener: Support::AbstractEventListener? listener, **untyped opts) -> void @@ -65,7 +65,7 @@ module Selenium attr_reader bridge: untyped - def create_bridge: (caps: untyped caps, url: String url, ?http_client: untyped? http_client) -> untyped + def create_bridge: (caps: untyped?, url: untyped?, http_client: untyped? ) -> untyped def service_url: (untyped service) -> untyped diff --git a/rb/sig/lib/selenium/webdriver/remote/bridge.rbs b/rb/sig/lib/selenium/webdriver/remote/bridge.rbs index 5dc576b09b7ce..a303ec5316006 100644 --- a/rb/sig/lib/selenium/webdriver/remote/bridge.rbs +++ b/rb/sig/lib/selenium/webdriver/remote/bridge.rbs @@ -229,7 +229,7 @@ module Selenium private - def execute: (untyped command, ?::Hash[untyped, untyped] opts, ?untyped? command_hash) -> untyped + def execute: (untyped command, ?::Hash[untyped, untyped] opts, ?untyped? command_hash) -> WebDriver::Remote::Response def escaper: () -> untyped From 5808ea74c9956e514bffbc4986d1e77ede937d23 Mon Sep 17 00:00:00 2001 From: aguspe Date: Wed, 6 Mar 2024 22:32:08 +0100 Subject: [PATCH 31/41] 0 errors in 0 files --- rb/Steepfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rb/Steepfile b/rb/Steepfile index 94c6a346237e6..8565398058443 100644 --- a/rb/Steepfile +++ b/rb/Steepfile @@ -1,7 +1,7 @@ target :lib do signature 'sig', '.gem_rbs_collection/rubyzip' # Signature directory check 'lib' # Directory name - # Total amount of errors ignore 62 + # Total amount of errors ignore 62 in 28 files ignore( # Ignore line 166 due to UDP RBS issue 'lib/selenium/webdriver/common/platform.rb', From ade5f2b0ca29635a06f45aa9c09a15d33614c895 Mon Sep 17 00:00:00 2001 From: aguspe Date: Thu, 7 Mar 2024 21:44:52 +0100 Subject: [PATCH 32/41] Updated common/driver to not use double splat operator --- rb/Steepfile | 4 +--- rb/lib/selenium/webdriver/common/driver.rb | 4 ++-- rb/sig/lib/selenium/webdriver/common/driver.rbs | 4 +++- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/rb/Steepfile b/rb/Steepfile index 8565398058443..29b2d7d407a86 100644 --- a/rb/Steepfile +++ b/rb/Steepfile @@ -1,7 +1,7 @@ target :lib do signature 'sig', '.gem_rbs_collection/rubyzip' # Signature directory check 'lib' # Directory name - # Total amount of errors ignore 62 in 28 files + # Total amount of errors ignore 61 in 27 files ignore( # Ignore line 166 due to UDP RBS issue 'lib/selenium/webdriver/common/platform.rb', @@ -48,8 +48,6 @@ target :lib do 'lib/selenium/webdriver/firefox/driver.rb', # Ignore due to line 27 with overloading issue 'lib/selenium/webdriver/bidi/log/console_log_entry.rb', - # Ignore due to line 74 with overloading issue - 'lib/selenium/webdriver/common/driver.rb', # Ignore due to line 89 with overloading issue 'lib/selenium/webdriver.rb', # Ignore due to line 37 with overloading issue diff --git a/rb/lib/selenium/webdriver/common/driver.rb b/rb/lib/selenium/webdriver/common/driver.rb index 00c9f470b5bd4..7a835d06ebf84 100644 --- a/rb/lib/selenium/webdriver/common/driver.rb +++ b/rb/lib/selenium/webdriver/common/driver.rb @@ -71,7 +71,7 @@ def for(browser, opts = {}) def initialize(bridge: nil, listener: nil, **opts) @devtools = nil @bidi = nil - bridge ||= create_bridge(**opts) + bridge ||= create_bridge(caps: opts[:caps], url: opts[:url], http_client: opts[:http_client]) add_extensions(bridge.browser) @bridge = listener ? Support::EventFiringBridge.new(bridge, listener) : bridge end @@ -292,7 +292,7 @@ def [](sel) end def browser - bridge&.browser + bridge.browser end def capabilities diff --git a/rb/sig/lib/selenium/webdriver/common/driver.rbs b/rb/sig/lib/selenium/webdriver/common/driver.rbs index 87ca138394517..67f2a9017680f 100644 --- a/rb/sig/lib/selenium/webdriver/common/driver.rbs +++ b/rb/sig/lib/selenium/webdriver/common/driver.rbs @@ -5,6 +5,8 @@ module Selenium include TakesScreenshot + @bidi: untyped + @devtools: untyped @navigate: untyped @service_manager: untyped @@ -65,7 +67,7 @@ module Selenium attr_reader bridge: untyped - def create_bridge: (caps: untyped?, url: untyped?, http_client: untyped? ) -> untyped + def create_bridge: (caps: untyped, url: untyped, ?http_client: untyped) -> untyped def service_url: (untyped service) -> untyped From bf32e498d01f366095d4267fca905de69c3b26d6 Mon Sep 17 00:00:00 2001 From: aguspe Date: Fri, 8 Mar 2024 21:39:35 +0100 Subject: [PATCH 33/41] Update types on wait --- rb/sig/lib/selenium/webdriver/common/wait.rbs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/rb/sig/lib/selenium/webdriver/common/wait.rbs b/rb/sig/lib/selenium/webdriver/common/wait.rbs index eb97bf216d5f9..1e1c888a9edf2 100644 --- a/rb/sig/lib/selenium/webdriver/common/wait.rbs +++ b/rb/sig/lib/selenium/webdriver/common/wait.rbs @@ -1,19 +1,19 @@ module Selenium module WebDriver class Wait - @timeout: untyped + @timeout: Numeric - @interval: untyped + @interval: Numeric - @message: untyped + @message: String - @ignored: untyped + @ignored: Array[Exception] - DEFAULT_TIMEOUT: 5 + DEFAULT_TIMEOUT: Integer - DEFAULT_INTERVAL: ::Float + DEFAULT_INTERVAL: Float - def initialize: (?::Hash[untyped, untyped] opts) -> void + def initialize: (Hash[untyped, untyped] opts) -> void def until: () { () -> untyped } -> untyped From bf8a1020e58accacf90e7b30351c123ba3f3e603 Mon Sep 17 00:00:00 2001 From: aguspe Date: Wed, 13 Mar 2024 22:35:14 +0100 Subject: [PATCH 34/41] Add driver to ignore files --- rb/Steepfile | 4 +++- rb/lib/selenium/webdriver/common/driver.rb | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/rb/Steepfile b/rb/Steepfile index 29b2d7d407a86..bb5cdb3fac71b 100644 --- a/rb/Steepfile +++ b/rb/Steepfile @@ -55,7 +55,9 @@ target :lib do # Cannot override last error on line 71 'lib/selenium/webdriver/common/wait.rb', # Cannot override params on line 83 - 'lib/selenium/webdriver/bidi/log_inspector.rb' + 'lib/selenium/webdriver/bidi/log_inspector.rb', + # Kwargs issue on line 74 + 'lib/selenium/webdriver/common/driver.rb' ) # Standard libraries used in the project diff --git a/rb/lib/selenium/webdriver/common/driver.rb b/rb/lib/selenium/webdriver/common/driver.rb index 7a835d06ebf84..6a816cb67b301 100644 --- a/rb/lib/selenium/webdriver/common/driver.rb +++ b/rb/lib/selenium/webdriver/common/driver.rb @@ -71,7 +71,7 @@ def for(browser, opts = {}) def initialize(bridge: nil, listener: nil, **opts) @devtools = nil @bidi = nil - bridge ||= create_bridge(caps: opts[:caps], url: opts[:url], http_client: opts[:http_client]) + bridge ||= create_bridge(**opts) add_extensions(bridge.browser) @bridge = listener ? Support::EventFiringBridge.new(bridge, listener) : bridge end From 4c0baa3accc192b019e539ab741d42c7a24f2243 Mon Sep 17 00:00:00 2001 From: aguspe Date: Wed, 13 Mar 2024 22:35:32 +0100 Subject: [PATCH 35/41] Revert "95 problems in 43 files" This reverts commit 655491f056aca08955c4a18bddb8155026566662. --- rb/Gemfile.lock | 5 +++++ rb/sig/gems/rexml/document.rbs | 8 -------- rb/sig/gems/rexml/xpath.rbs | 6 ------ rb/sig/lib/selenium/webdriver/common/zipper.rbs | 2 +- 4 files changed, 6 insertions(+), 15 deletions(-) delete mode 100644 rb/sig/gems/rexml/document.rbs delete mode 100644 rb/sig/gems/rexml/xpath.rbs diff --git a/rb/Gemfile.lock b/rb/Gemfile.lock index 0f11976a2f74b..ac793a8dcc2d6 100644 --- a/rb/Gemfile.lock +++ b/rb/Gemfile.lock @@ -51,9 +51,11 @@ GEM i18n (1.14.1) concurrent-ruby (~> 1.0) io-console (0.7.2) + io-console (0.7.2-java) irb (1.11.2) rdoc reline (>= 0.4.2) + jar-dependencies (0.4.1) json (2.7.1) json (2.7.1-java) language_server-protocol (3.17.0.3) @@ -69,6 +71,8 @@ GEM racc psych (5.1.2) stringio + psych (5.1.2-java) + jar-dependencies (>= 0.1.7) public_suffix (5.0.4) racc (1.7.3) racc (1.7.3-java) @@ -145,6 +149,7 @@ GEM terminal-table (>= 2, < 4) stringio (3.1.0) strscan (3.1.0) + strscan (3.1.0-java) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) tzinfo (2.0.6) diff --git a/rb/sig/gems/rexml/document.rbs b/rb/sig/gems/rexml/document.rbs deleted file mode 100644 index 9f486197fc6b6..0000000000000 --- a/rb/sig/gems/rexml/document.rbs +++ /dev/null @@ -1,8 +0,0 @@ -module REXML - class Document - def initialize: (untyped element) -> void - - def root: () -> untyped - end -end - diff --git a/rb/sig/gems/rexml/xpath.rbs b/rb/sig/gems/rexml/xpath.rbs deleted file mode 100644 index 00540b8633893..0000000000000 --- a/rb/sig/gems/rexml/xpath.rbs +++ /dev/null @@ -1,6 +0,0 @@ -module REXML - class XPath - def self.first: (untyped element, untyped path) -> untyped - end -end - diff --git a/rb/sig/lib/selenium/webdriver/common/zipper.rbs b/rb/sig/lib/selenium/webdriver/common/zipper.rbs index 090f02a7d49f3..0988f7bb50f52 100644 --- a/rb/sig/lib/selenium/webdriver/common/zipper.rbs +++ b/rb/sig/lib/selenium/webdriver/common/zipper.rbs @@ -1,7 +1,7 @@ module Selenium module WebDriver module Zipper - EXTENSIONS: Array[String] + EXTENSIONS: ::Array[".zip" | ".xpi"] def self.unzip: (untyped path) -> untyped From 7b8f791d638bfe0519860f1641c88ec96ec4b33b Mon Sep 17 00:00:00 2001 From: aguspe Date: Wed, 13 Mar 2024 22:47:47 +0100 Subject: [PATCH 36/41] Revert changes --- rb/lib/selenium/webdriver/firefox/driver.rb | 1 - rb/lib/selenium/webdriver/safari/options.rb | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/rb/lib/selenium/webdriver/firefox/driver.rb b/rb/lib/selenium/webdriver/firefox/driver.rb index d8de991be5858..717eea5ba711c 100644 --- a/rb/lib/selenium/webdriver/firefox/driver.rb +++ b/rb/lib/selenium/webdriver/firefox/driver.rb @@ -55,7 +55,6 @@ def devtools_url end uri = URI("http://#{capabilities['moz:debuggerAddress']}") - response = Net::HTTP.get(uri.hostname, '/json/version', uri.port) JSON.parse(response)['webSocketDebuggerUrl'] diff --git a/rb/lib/selenium/webdriver/safari/options.rb b/rb/lib/selenium/webdriver/safari/options.rb index ac86ff8ae9459..352132648207f 100644 --- a/rb/lib/selenium/webdriver/safari/options.rb +++ b/rb/lib/selenium/webdriver/safari/options.rb @@ -22,6 +22,8 @@ module WebDriver module Safari class Options < WebDriver::Options attr_accessor :options + + # @see https://developer.apple.com/documentation/webkit/about_webdriver_for_safari CAPABILITIES = {automatic_inspection: 'safari:automaticInspection', automatic_profiling: 'safari:automaticProfiling'}.freeze BROWSER = Selenium::WebDriver::Safari.technology_preview? ? 'Safari Technology Preview' : 'safari' From 6bd47e22590e2bb6dc6f0f431c758df8ba3b27a7 Mon Sep 17 00:00:00 2001 From: aguspe Date: Wed, 13 Mar 2024 22:53:43 +0100 Subject: [PATCH 37/41] Resto REXML and update ignore --- rb/Steepfile | 6 ++++-- rb/sig/gems/rexml/document.rbs | 7 +++++++ rb/sig/gems/rexml/xpath.rbs | 5 +++++ 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 rb/sig/gems/rexml/document.rbs create mode 100644 rb/sig/gems/rexml/xpath.rbs diff --git a/rb/Steepfile b/rb/Steepfile index bb5cdb3fac71b..2d43128f88d4c 100644 --- a/rb/Steepfile +++ b/rb/Steepfile @@ -1,7 +1,7 @@ target :lib do signature 'sig', '.gem_rbs_collection/rubyzip' # Signature directory check 'lib' # Directory name - # Total amount of errors ignore 61 in 27 files + # Total amount of errors ignore 63 in 29 files ignore( # Ignore line 166 due to UDP RBS issue 'lib/selenium/webdriver/common/platform.rb', @@ -57,7 +57,9 @@ target :lib do # Cannot override params on line 83 'lib/selenium/webdriver/bidi/log_inspector.rb', # Kwargs issue on line 74 - 'lib/selenium/webdriver/common/driver.rb' + 'lib/selenium/webdriver/common/driver.rb', + # issue with the Zipper RBS library on line 54 + 'lib/selenium/webdriver/firefox/extension.rb' ) # Standard libraries used in the project diff --git a/rb/sig/gems/rexml/document.rbs b/rb/sig/gems/rexml/document.rbs new file mode 100644 index 0000000000000..f8d9b4975827b --- /dev/null +++ b/rb/sig/gems/rexml/document.rbs @@ -0,0 +1,7 @@ +module REXML + class Document + def initialize: (untyped element) -> void + + def root: () -> untyped + end +end diff --git a/rb/sig/gems/rexml/xpath.rbs b/rb/sig/gems/rexml/xpath.rbs new file mode 100644 index 0000000000000..0a390e81d4c32 --- /dev/null +++ b/rb/sig/gems/rexml/xpath.rbs @@ -0,0 +1,5 @@ +module REXML + class XPath + def self.first: (untyped element, untyped path) -> untyped + end +end From 39d71143c4a89a836b7ef3ec733888b9fad4ef1f Mon Sep 17 00:00:00 2001 From: aguspe Date: Sat, 16 Mar 2024 00:14:37 +0100 Subject: [PATCH 38/41] Update profile constant --- rb/lib/selenium/webdriver/firefox/profile.rb | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/rb/lib/selenium/webdriver/firefox/profile.rb b/rb/lib/selenium/webdriver/firefox/profile.rb index 9415763a2b716..d1628af4bb61d 100644 --- a/rb/lib/selenium/webdriver/firefox/profile.rb +++ b/rb/lib/selenium/webdriver/firefox/profile.rb @@ -24,7 +24,10 @@ class Profile include ProfileHelper VALID_PREFERENCE_TYPES = [TrueClass, FalseClass, Integer, Float, String].freeze - WEBDRIVER_PREFS = [] + WEBDRIVER_PREFS = { + :port => 'webdriver_firefox_port', + :log_file => 'webdriver.log.file' + } DEFAULT_PREFERENCES = { 'browser.newtabpage.enabled' => false, @@ -36,8 +39,8 @@ class Profile LOCK_FILES = %w[.parentlock parent.lock lock].freeze - attr_reader :name, :log_file - attr_writer :secure_ssl, :load_no_focus_lib + attr_reader :name, :log_file + attr_writer :secure_ssl, :load_no_focus_lib class << self def ini @@ -163,7 +166,7 @@ def install_extensions(directory) destination = File.join(directory, 'extensions') @extensions.each do |name, extension| - WebDriver.logger.debug({extension: name}.inspect, id: :firefox_profile) + WebDriver.logger.debug({ extension: name }.inspect, id: :firefox_profile) extension.write_to(destination) end end @@ -224,7 +227,9 @@ def write_prefs(prefs, path) end end end - end # Profile + end + + # Profile end # Firefox end # WebDriver end # Selenium From ac6e53961d7459bd619a4b683bee5286b35ae277 Mon Sep 17 00:00:00 2001 From: aguspe Date: Sun, 17 Mar 2024 00:34:09 +0100 Subject: [PATCH 39/41] Remove autogenerated code, remove commments and refactoring --- rb/sig/lib/selenium/devtools.rbs | 1 - .../devtools/support/cdp_client_generator.rbs | 3 +- rb/sig/lib/selenium/server.rbs | 12 ++--- .../support/nightly_version_generator.rbs | 2 +- .../webdriver/bidi/browsing_context.rbs | 2 +- .../selenium/webdriver/bidi/log_inspector.rbs | 8 ++-- .../lib/selenium/webdriver/chrome/driver.rbs | 4 +- .../lib/selenium/webdriver/chrome/options.rbs | 4 +- .../lib/selenium/webdriver/chrome/service.rbs | 6 +-- .../selenium/webdriver/chromium/driver.rbs | 3 +- .../selenium/webdriver/chromium/options.rbs | 4 +- .../selenium/webdriver/chromium/profile.rbs | 2 +- .../webdriver/common/action_builder.rbs | 4 +- .../webdriver/common/child_process.rbs | 8 ++-- .../driver_extensions/has_log_events.rbs | 2 +- .../lib/selenium/webdriver/common/error.rbs | 10 ++--- .../selenium/webdriver/common/file_reaper.rbs | 4 +- .../webdriver/common/html5/local_storage.rbs | 3 -- .../common/interactions/interactions.rbs | 10 ++--- .../webdriver/common/interactions/pause.rbs | 2 +- .../common/interactions/pointer_cancel.rbs | 4 +- .../common/interactions/pointer_move.rbs | 6 +-- .../common/interactions/pointer_press.rbs | 4 +- .../webdriver/common/interactions/scroll.rbs | 2 +- .../common/interactions/wheel_actions.rbs | 45 ------------------- rb/sig/lib/selenium/webdriver/common/keys.rbs | 2 +- .../webdriver/common/local_driver.rbs | 2 +- .../selenium/webdriver/common/platform.rbs | 8 ++-- .../webdriver/common/profile_helper.rbs | 4 +- .../lib/selenium/webdriver/common/proxy.rbs | 6 +-- .../webdriver/common/selenium_manager.rbs | 8 ---- .../webdriver/common/service_manager.rbs | 16 +++---- .../selenium/webdriver/common/socket_lock.rbs | 2 +- .../webdriver/common/socket_poller.rbs | 4 +- .../virtual_authenticator_options.rbs | 6 +-- .../webdriver/common/websocket_connection.rbs | 13 +++--- .../lib/selenium/webdriver/common/zipper.rbs | 2 +- rb/sig/lib/selenium/webdriver/devtools.rbs | 2 +- .../devtools/network_interceptor.rbs | 2 +- .../webdriver/devtools/pinned_script.rbs | 6 +-- .../selenium/webdriver/devtools/request.rbs | 2 +- rb/sig/lib/selenium/webdriver/edge/driver.rbs | 2 +- .../lib/selenium/webdriver/edge/options.rbs | 4 +- .../lib/selenium/webdriver/edge/service.rbs | 6 +-- .../lib/selenium/webdriver/firefox/driver.rbs | 4 +- .../selenium/webdriver/firefox/extension.rbs | 6 +-- .../selenium/webdriver/firefox/options.rbs | 4 +- .../selenium/webdriver/firefox/profile.rbs | 10 ++--- .../webdriver/firefox/profiles_ini.rbs | 3 +- rb/sig/lib/selenium/webdriver/ie/driver.rbs | 4 +- rb/sig/lib/selenium/webdriver/ie/options.rbs | 8 ++-- rb/sig/lib/selenium/webdriver/ie/service.rbs | 6 +-- .../webdriver/remote/capabilities.rbs | 6 +-- .../selenium/webdriver/remote/http/common.rbs | 10 ++--- .../webdriver/remote/http/default.rbs | 9 +--- .../lib/selenium/webdriver/safari/driver.rbs | 4 +- .../lib/selenium/webdriver/safari/service.rbs | 6 +-- .../lib/selenium/webdriver/support/color.rbs | 18 ++++---- .../selenium/webdriver/support/escaper.rbs | 2 +- .../lib/selenium/webdriver/support/guards.rbs | 6 +-- .../webdriver/support/guards/guard.rbs | 5 --- .../webdriver/support/relative_locator.rbs | 4 +- .../lib/selenium/webdriver/support/select.rbs | 2 +- rb/sig/lib/selenium/webdriver/version.rbs | 2 +- 64 files changed, 145 insertions(+), 226 deletions(-) diff --git a/rb/sig/lib/selenium/devtools.rbs b/rb/sig/lib/selenium/devtools.rbs index 0110a6ca515cf..46dab49dd30dd 100644 --- a/rb/sig/lib/selenium/devtools.rbs +++ b/rb/sig/lib/selenium/devtools.rbs @@ -6,7 +6,6 @@ module Selenium private - # Try to load up to 2 versions back def self.load_older_version: () -> untyped def self.load_old_version: (untyped version) -> untyped diff --git a/rb/sig/lib/selenium/devtools/support/cdp_client_generator.rbs b/rb/sig/lib/selenium/devtools/support/cdp_client_generator.rbs index 6dddf605c48f8..4999f692c928b 100644 --- a/rb/sig/lib/selenium/devtools/support/cdp_client_generator.rbs +++ b/rb/sig/lib/selenium/devtools/support/cdp_client_generator.rbs @@ -14,12 +14,11 @@ module Selenium @version: untyped - # Input JSON files are generated from PDL tasks. DOMAIN_TEMPLATE_PATH: untyped LOADER_TEMPLATE_PATH: untyped - RESERVED_KEYWORDS: ::Array["end"] + RESERVED_KEYWORDS: Array[String] def call: (output_dir: untyped, version: untyped, **untyped opts) -> untyped diff --git a/rb/sig/lib/selenium/server.rbs b/rb/sig/lib/selenium/server.rbs index e97d08163389a..4ae361debc94b 100644 --- a/rb/sig/lib/selenium/server.rbs +++ b/rb/sig/lib/selenium/server.rbs @@ -31,9 +31,9 @@ module Selenium CL_RESET: untyped - def self.get: (?::Symbol required_version, ?::Hash[untyped, untyped] opts) -> untyped + def self.get: (?Symbol required_version, ?Hash[untyped, untyped] opts) -> untyped - def self.download: (?::Symbol required_version) -> untyped + def self.download: (?Symbol required_version) -> untyped def self.latest: () -> untyped @@ -55,13 +55,13 @@ module Selenium attr_accessor log: untyped - def initialize: (untyped jar, ?::Hash[untyped, untyped] opts) -> void + def initialize: (untyped jar, ?Hash[untyped, untyped] opts) -> void def start: () -> untyped def stop: () -> untyped - def webdriver_url: () -> ::String + def webdriver_url: () -> String def <<: (untyped arg) -> untyped @@ -71,9 +71,9 @@ module Selenium def process: () -> untyped - def poll_for_service: () -> (nil | untyped) + def poll_for_service: () -> nil? - def poll_for_shutdown: () -> (nil | untyped) + def poll_for_shutdown: () -> nil? def socket: () -> untyped end diff --git a/rb/sig/lib/selenium/support/nightly_version_generator.rbs b/rb/sig/lib/selenium/support/nightly_version_generator.rbs index 4d784559d3e95..2070cd7767720 100644 --- a/rb/sig/lib/selenium/support/nightly_version_generator.rbs +++ b/rb/sig/lib/selenium/support/nightly_version_generator.rbs @@ -1,7 +1,7 @@ module Selenium module Support class NightlyVersionGenerator - REGEXP: ::Regexp + REGEXP: Regexp def self.call: (untyped version_file, untyped version_suffix) -> untyped end diff --git a/rb/sig/lib/selenium/webdriver/bidi/browsing_context.rbs b/rb/sig/lib/selenium/webdriver/bidi/browsing_context.rbs index c03ce4e37a198..a690a38221634 100644 --- a/rb/sig/lib/selenium/webdriver/bidi/browsing_context.rbs +++ b/rb/sig/lib/selenium/webdriver/bidi/browsing_context.rbs @@ -8,7 +8,7 @@ module Selenium attr_accessor id: untyped - READINESS_STATE: { none: "none", interactive: "interactive", complete: "complete" } + READINESS_STATE: Hash[Symbol, String] def initialize: (driver: untyped, ?browsing_context_id: untyped?, ?type: untyped?, ?reference_context: untyped?) -> void diff --git a/rb/sig/lib/selenium/webdriver/bidi/log_inspector.rbs b/rb/sig/lib/selenium/webdriver/bidi/log_inspector.rbs index a6e1bf86452a1..565ec3aa46142 100644 --- a/rb/sig/lib/selenium/webdriver/bidi/log_inspector.rbs +++ b/rb/sig/lib/selenium/webdriver/bidi/log_inspector.rbs @@ -6,7 +6,7 @@ module Selenium EVENTS: Hash[Symbol, String] - LOG_LEVEL: { DEBUG: "debug", ERROR: "error", INFO: "info", WARNING: "warning" } + LOG_LEVEL: Hash[Symbol, String] def initialize: (untyped driver, ?untyped? browsing_context_ids) -> void @@ -16,7 +16,7 @@ module Selenium def on_javascript_exception: () { () -> untyped } -> untyped - def on_log: (?untyped? filter_by) { (untyped) -> untyped } -> (nil | untyped) + def on_log: (?untyped? filter_by) { (untyped) -> untyped } -> untyped? private @@ -24,9 +24,9 @@ module Selenium def check_valid_filter: (untyped filter_by) -> (nil | untyped) - def console_log_events: (untyped params, untyped filter_by) { (untyped) -> untyped } -> (nil | untyped) + def console_log_events: (untyped params, untyped filter_by) { (untyped) -> untyped } -> untyped? - def javascript_log_events: (untyped params, untyped filter_by) { (untyped) -> untyped } -> (nil | untyped) + def javascript_log_events: (untyped params, untyped filter_by) { (untyped) -> untyped } -> untyped? end end end diff --git a/rb/sig/lib/selenium/webdriver/chrome/driver.rbs b/rb/sig/lib/selenium/webdriver/chrome/driver.rbs index 49d1c53af9030..92653102f9a90 100644 --- a/rb/sig/lib/selenium/webdriver/chrome/driver.rbs +++ b/rb/sig/lib/selenium/webdriver/chrome/driver.rbs @@ -6,11 +6,11 @@ module Selenium def initialize: (?options: untyped?, ?service: untyped?, ?url: untyped?, **untyped opts) -> void - def browser: () -> :chrome + def browser: () -> Symbol private - def devtools_address: () -> ::String + def devtools_address: () -> String end end end diff --git a/rb/sig/lib/selenium/webdriver/chrome/options.rbs b/rb/sig/lib/selenium/webdriver/chrome/options.rbs index 281d33ea09135..eae4c2feab36f 100644 --- a/rb/sig/lib/selenium/webdriver/chrome/options.rbs +++ b/rb/sig/lib/selenium/webdriver/chrome/options.rbs @@ -2,9 +2,9 @@ module Selenium module WebDriver module Chrome class Options < Chromium::Options - KEY: "goog:chromeOptions" + KEY: String - BROWSER: "chrome" + BROWSER: String private diff --git a/rb/sig/lib/selenium/webdriver/chrome/service.rbs b/rb/sig/lib/selenium/webdriver/chrome/service.rbs index 93850710820b6..a94d9c8d4900c 100644 --- a/rb/sig/lib/selenium/webdriver/chrome/service.rbs +++ b/rb/sig/lib/selenium/webdriver/chrome/service.rbs @@ -4,11 +4,11 @@ module Selenium class Service < WebDriver::Service @log: untyped - DEFAULT_PORT: 9515 + DEFAULT_PORT: Integer - EXECUTABLE: "chromedriver" + EXECUTABLE: String - SHUTDOWN_SUPPORTED: true + SHUTDOWN_SUPPORTED: bool def log: () -> untyped end diff --git a/rb/sig/lib/selenium/webdriver/chromium/driver.rbs b/rb/sig/lib/selenium/webdriver/chromium/driver.rbs index bdfd23269f205..32353772c8251 100644 --- a/rb/sig/lib/selenium/webdriver/chromium/driver.rbs +++ b/rb/sig/lib/selenium/webdriver/chromium/driver.rbs @@ -4,8 +4,7 @@ module Selenium class Driver < WebDriver::Driver include _Driver - EXTENSIONS: ::Array[untyped] - + EXTENSIONS: Array[untyped] end end end diff --git a/rb/sig/lib/selenium/webdriver/chromium/options.rbs b/rb/sig/lib/selenium/webdriver/chromium/options.rbs index 68141ea91a493..9d0262127ce75 100644 --- a/rb/sig/lib/selenium/webdriver/chromium/options.rbs +++ b/rb/sig/lib/selenium/webdriver/chromium/options.rbs @@ -36,9 +36,9 @@ module Selenium def add_emulation: (**untyped opts) -> untyped - def enable_android: (?package: ::String, ?serial_number: untyped?, ?use_running_app: untyped?, ?activity: untyped?) -> untyped + def enable_android: (?package: String, ?serial_number: untyped?, ?use_running_app: untyped?, ?activity: untyped?) -> untyped - def process_browser_options: (untyped browser_options) -> (nil | untyped) + def process_browser_options: (untyped browser_options) -> untyped? def binary_path: () -> untyped diff --git a/rb/sig/lib/selenium/webdriver/chromium/profile.rbs b/rb/sig/lib/selenium/webdriver/chromium/profile.rbs index b76512c7fa251..f74507161c993 100644 --- a/rb/sig/lib/selenium/webdriver/chromium/profile.rbs +++ b/rb/sig/lib/selenium/webdriver/chromium/profile.rbs @@ -36,7 +36,7 @@ module Selenium def prefs: () -> untyped - def read_model_prefs: () -> (::Hash[untyped, untyped] | untyped) + def read_model_prefs: () -> (Hash[untyped, untyped] | untyped) def prefs_file_for: (untyped dir) -> untyped end diff --git a/rb/sig/lib/selenium/webdriver/common/action_builder.rbs b/rb/sig/lib/selenium/webdriver/common/action_builder.rbs index 1d8fd39b3a27a..7f1f95fa71db6 100644 --- a/rb/sig/lib/selenium/webdriver/common/action_builder.rbs +++ b/rb/sig/lib/selenium/webdriver/common/action_builder.rbs @@ -39,13 +39,13 @@ module Selenium def perform: () -> nil - def clear_all_actions: () -> Array[::Selenium::WebDriver::Interactions::InputDevice] + def clear_all_actions: () -> Array[Selenium::WebDriver::Interactions::InputDevice] def release_actions: () -> untyped private - def tick: (*Interactions::InputDevice action_devices) -> (nil | Array[Interactions::InputDevice]) + def tick: (*Interactions::InputDevice action_devices) -> Array[Interactions::InputDevice]? def add_input: (Interactions::InputDevice | Symbol | interned device) -> Interactions::InputDevice end diff --git a/rb/sig/lib/selenium/webdriver/common/child_process.rbs b/rb/sig/lib/selenium/webdriver/common/child_process.rbs index 5240914702b9b..69785847b71eb 100644 --- a/rb/sig/lib/selenium/webdriver/common/child_process.rbs +++ b/rb/sig/lib/selenium/webdriver/common/child_process.rbs @@ -13,11 +13,11 @@ module Selenium TimeoutError: untyped - SIGTERM: "TERM" + SIGTERM: String - SIGKILL: "KILL" + SIGKILL: String - POLL_INTERVAL: ::Float + POLL_INTERVAL: Float attr_accessor detach: untyped @@ -31,7 +31,7 @@ module Selenium def start: () -> untyped - def stop: (?::Integer timeout) -> untyped + def stop: (?Integer timeout) -> untyped def alive?: () -> untyped diff --git a/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_log_events.rbs b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_log_events.rbs index 90ce390f49d95..2b3ffbb073208 100644 --- a/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_log_events.rbs +++ b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_log_events.rbs @@ -12,7 +12,7 @@ module Selenium include Atoms - KINDS: ::Array[:console | :exception | :mutation] + KINDS: Array[Symbol] def on_log_event: (untyped kind) { () -> untyped } -> (nil | untyped) diff --git a/rb/sig/lib/selenium/webdriver/common/error.rbs b/rb/sig/lib/selenium/webdriver/common/error.rbs index b989b389e6f74..cf084eaa6a4c3 100644 --- a/rb/sig/lib/selenium/webdriver/common/error.rbs +++ b/rb/sig/lib/selenium/webdriver/common/error.rbs @@ -3,15 +3,15 @@ module Selenium module Error def self.for_error: (untyped error) -> untyped - SUPPORT_MSG: "For documentation on this error, please visit:" + SUPPORT_MSG: String - ERROR_URL: "https://www.selenium.dev/documentation/webdriver/troubleshooting/errors" + ERROR_URL: String class WebDriverError < StandardError end class NoSuchElementError < WebDriverError - def initialize: (?::String msg) -> void + def initialize: (?String msg) -> void end class NoSuchFrameError < WebDriverError @@ -21,7 +21,7 @@ module Selenium end class StaleElementReferenceError < WebDriverError - def initialize: (?::String msg) -> void + def initialize: (?String msg) -> void end class DetachedShadowRootError < WebDriverError @@ -98,7 +98,7 @@ module Selenium end class NoSuchDriverError < WebDriverError - def initialize: (?::String msg) -> void + def initialize: (?String msg) -> void end end end diff --git a/rb/sig/lib/selenium/webdriver/common/file_reaper.rbs b/rb/sig/lib/selenium/webdriver/common/file_reaper.rbs index 84d4d3191f161..2b23277ec6542 100644 --- a/rb/sig/lib/selenium/webdriver/common/file_reaper.rbs +++ b/rb/sig/lib/selenium/webdriver/common/file_reaper.rbs @@ -13,9 +13,9 @@ module Selenium def self.<<: (untyped file) -> untyped - def self.reap: (untyped file) -> (nil | untyped) + def self.reap: (untyped file) -> untyped? - def self.reap!: () -> (true | false) + def self.reap!: () -> bool end end end diff --git a/rb/sig/lib/selenium/webdriver/common/html5/local_storage.rbs b/rb/sig/lib/selenium/webdriver/common/html5/local_storage.rbs index 3e8095c118608..4c3fe90b16c0e 100644 --- a/rb/sig/lib/selenium/webdriver/common/html5/local_storage.rbs +++ b/rb/sig/lib/selenium/webdriver/common/html5/local_storage.rbs @@ -6,9 +6,6 @@ module Selenium include SharedWebStorage - # - # @api private - # def initialize: (untyped bridge) -> void def []: (untyped key) -> untyped diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/interactions.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/interactions.rbs index 66dfcde4cabcb..6268f4f803fd2 100644 --- a/rb/sig/lib/selenium/webdriver/common/interactions/interactions.rbs +++ b/rb/sig/lib/selenium/webdriver/common/interactions/interactions.rbs @@ -1,17 +1,17 @@ module Selenium module WebDriver module Interactions - KEY: :key + KEY: Symbol - POINTER: :pointer + POINTER: Symbol - NONE: :none + NONE: Symbol - WHEEL: :wheel + WHEEL: Symbol def self.key: (?untyped? name) -> untyped - def self.pointer: (?::Symbol kind, ?name: untyped?) -> untyped + def self.pointer: (?Symbol kind, ?name: untyped?) -> untyped def self.mouse: (?name: untyped?) -> untyped diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/pause.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/pause.rbs index d18984d8fba09..08fe06dead86d 100644 --- a/rb/sig/lib/selenium/webdriver/common/interactions/pause.rbs +++ b/rb/sig/lib/selenium/webdriver/common/interactions/pause.rbs @@ -8,7 +8,7 @@ module Selenium def initialize: (untyped source, ?untyped? duration) -> void - def assert_source: (untyped source) -> (untyped | nil) + def assert_source: (untyped source) -> untyped? def encode: () -> untyped end diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/pointer_cancel.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/pointer_cancel.rbs index af938515e35aa..567b10ccf25ed 100644 --- a/rb/sig/lib/selenium/webdriver/common/interactions/pointer_cancel.rbs +++ b/rb/sig/lib/selenium/webdriver/common/interactions/pointer_cancel.rbs @@ -6,9 +6,9 @@ module Selenium def initialize: (untyped source) -> void - def assert_source: (untyped source) -> (untyped | nil) + def assert_source: (untyped source) -> untyped? - def encode: () -> { type: untyped } + def encode: () -> Hash[Symbol, untyped] end end end diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/pointer_move.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/pointer_move.rbs index bbc3b6bd39ea3..dbaac9737a23e 100644 --- a/rb/sig/lib/selenium/webdriver/common/interactions/pointer_move.rbs +++ b/rb/sig/lib/selenium/webdriver/common/interactions/pointer_move.rbs @@ -16,11 +16,11 @@ module Selenium include PointerEventProperties - VIEWPORT: :viewport + VIEWPORT: Symbol - POINTER: :pointer + POINTER: Symbol - ORIGINS: ::Array[untyped] + ORIGINS: Array[untyped] def initialize: (untyped source, untyped duration, untyped x, untyped y, **untyped opts) -> void diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/pointer_press.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/pointer_press.rbs index 52d163e6b7ecd..65282108b03ea 100644 --- a/rb/sig/lib/selenium/webdriver/common/interactions/pointer_press.rbs +++ b/rb/sig/lib/selenium/webdriver/common/interactions/pointer_press.rbs @@ -14,7 +14,7 @@ module Selenium BUTTONS: untyped - DIRECTIONS: { down: :pointerDown, up: :pointerUp } + DIRECTIONS: Hash[Symbol, Symbol] def initialize: (untyped source, untyped direction, untyped button, **untyped opts) -> void @@ -22,7 +22,7 @@ module Selenium private - def assert_source: (untyped source) -> (untyped | nil) + def assert_source: (untyped source) -> untyped? def assert_button: (untyped button) -> untyped diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/scroll.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/scroll.rbs index e1ff908fc9499..2bae225339d54 100644 --- a/rb/sig/lib/selenium/webdriver/common/interactions/scroll.rbs +++ b/rb/sig/lib/selenium/webdriver/common/interactions/scroll.rbs @@ -18,7 +18,7 @@ module Selenium def initialize: (source: untyped, ?origin: Symbol, ?duration: Float, **untyped opts) -> void - def assert_source: (untyped source) -> (untyped | nil) + def assert_source: (untyped source) -> untyped? def encode: () -> Hash[String, untyped] end diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/wheel_actions.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/wheel_actions.rbs index b4d0dd2ca6183..91128affcc9f3 100644 --- a/rb/sig/lib/selenium/webdriver/common/interactions/wheel_actions.rbs +++ b/rb/sig/lib/selenium/webdriver/common/interactions/wheel_actions.rbs @@ -10,55 +10,10 @@ module Selenium def default_scroll_duration: () -> untyped - # - # If the element is outside the viewport, scrolls the bottom of the element to the bottom of the viewport. - # - # @example Scroll to element - # el = driver.find_element(id: "some_id") - # driver.action.scroll_to(element).perform - # - # @param [Object] Which element to scroll into the viewport. - # @return [Selenium::WebDriver::WheelActions] A self reference. def scroll_to: (untyped element, ?device: untyped?) -> untyped - # - # Scrolls by provided amounts with the origin in the top left corner of the viewport. - # - # @example Scroll viewport by a specified amount - # el = driver.find_element(id: "some_id") - # driver.action.scroll_by(100, 200).perform - # - # @param [Integer] delta_x Distance along X axis to scroll using the wheel. A negative value scrolls left. - # @param [Integer] delta_y Distance along Y axis to scroll using the wheel. A negative value scrolls up. - # @return [Selenium::WebDriver::WheelActions] A self reference. def scroll_by: (untyped delta_x, untyped delta_y, ?device: untyped?) -> untyped - # - # Scrolls by provided amount based on a provided origin. - # - # The scroll origin is either the center of an element or the upper left of the viewport plus any offsets. - # If the origin is an element, and the element is not in the viewport, the bottom of the element will first - # be scrolled to the bottom of the viewport. - # - # @example Scroll from element by a specified amount - # el = driver.find_element(id: "some_id") - # origin = WheelActions::ScrollOrigin.element(el) - # driver.action.scroll_from(origin, 0, 200).perform - # - # @example Scroll from element by a specified amount with an offset - # el = driver.find_element(id: "some_id") - # origin = WheelActions::ScrollOrigin.element(el, 10, 10) - # driver.action.scroll_from(origin, 100, 200).perform - # - # @example Scroll viewport by a specified amount with an offset - # origin = WheelActions::ScrollOrigin.viewport(10, 10) - # driver.action.scroll_from(origin, 0, 200).perform - # - # @param [ScrollOrigin] scroll_origin Where scroll originates (viewport or element center) plus provided offsets. - # @param [Integer] delta_x Distance along X axis to scroll using the wheel. A negative value scrolls left. - # @param [Integer] delta_y Distance along Y axis to scroll using the wheel. A negative value scrolls up. - # @return [Selenium::WebDriver::WheelActions] A self reference. - # @raise [Error::MoveTargetOutOfBoundsError] If the origin with offset is outside the viewport. def scroll_from: (untyped scroll_origin, untyped delta_x, untyped delta_y, ?device: untyped?) -> untyped private diff --git a/rb/sig/lib/selenium/webdriver/common/keys.rbs b/rb/sig/lib/selenium/webdriver/common/keys.rbs index b8d830e930e20..9cf2b197a8a3b 100644 --- a/rb/sig/lib/selenium/webdriver/common/keys.rbs +++ b/rb/sig/lib/selenium/webdriver/common/keys.rbs @@ -1,7 +1,7 @@ module Selenium module WebDriver module Keys - KEYS: { null: ::String, cancel: ::String, help: ::String, backspace: ::String, tab: ::String, clear: ::String, return: ::String, enter: ::String, shift: ::String, left_shift: ::String, control: ::String, left_control: ::String, alt: ::String, left_alt: ::String, pause: ::String, escape: ::String, space: ::String, page_up: ::String, page_down: ::String, end: ::String, home: ::String, left: ::String, arrow_left: ::String, up: ::String, arrow_up: ::String, right: ::String, arrow_right: ::String, down: ::String, arrow_down: ::String, insert: ::String, delete: ::String, semicolon: ::String, equals: ::String, numpad0: ::String, numpad1: ::String, numpad2: ::String, numpad3: ::String, numpad4: ::String, numpad5: ::String, numpad6: ::String, numpad7: ::String, numpad8: ::String, numpad9: ::String, multiply: ::String, add: ::String, separator: ::String, subtract: ::String, decimal: ::String, divide: ::String, f1: ::String, f2: ::String, f3: ::String, f4: ::String, f5: ::String, f6: ::String, f7: ::String, f8: ::String, f9: ::String, f10: ::String, f11: ::String, f12: ::String, meta: ::String, command: ::String, left_meta: ::String, zenkaku_hankaku: ::String, right_shift: ::String, right_control: ::String, right_alt: ::String, right_meta: ::String, numpad_page_up: ::String, numpad_page_down: ::String, numpad_end: ::String, numpad_home: ::String, numpad_left: ::String, numpad_up: ::String, numpad_right: ::String, numpad_down: ::String, numpad_insert: ::String, numpad_delete: ::String } + KEYS: Hash[Symbol, String] def self.[]: (untyped key) -> untyped diff --git a/rb/sig/lib/selenium/webdriver/common/local_driver.rbs b/rb/sig/lib/selenium/webdriver/common/local_driver.rbs index 7aecc6e07d2d1..ef1ac98c8feb9 100644 --- a/rb/sig/lib/selenium/webdriver/common/local_driver.rbs +++ b/rb/sig/lib/selenium/webdriver/common/local_driver.rbs @@ -3,7 +3,7 @@ module Selenium module LocalDriver include _Driver - def initialize_local_driver: (untyped options, untyped service, untyped url) -> ::Array[untyped] + def initialize_local_driver: (untyped options, untyped service, untyped url) -> Array[untyped] def process_options: (untyped options, untyped service) -> untyped end diff --git a/rb/sig/lib/selenium/webdriver/common/platform.rbs b/rb/sig/lib/selenium/webdriver/common/platform.rbs index d3b6040f47e77..294c6a5110aec 100644 --- a/rb/sig/lib/selenium/webdriver/common/platform.rbs +++ b/rb/sig/lib/selenium/webdriver/common/platform.rbs @@ -14,7 +14,7 @@ module Selenium def self?.os: () -> untyped - def self?.ci: () -> (:travis | :jenkins | :appveyor | :github | nil) + def self?.ci: () -> Symbol? def self?.jruby?: () -> untyped @@ -34,7 +34,7 @@ module Selenium def self?.null_device: () -> untyped - def self?.wrap_in_quotes_if_necessary: (untyped str) -> (::String | untyped) + def self?.wrap_in_quotes_if_necessary: (untyped str) -> (String | untyped) def self?.cygwin_path: (untyped path, **untyped opts) -> untyped @@ -44,9 +44,9 @@ module Selenium def self?.make_writable: (untyped file) -> untyped - def self?.assert_file: (untyped path) -> (nil | untyped) + def self?.assert_file: (untyped path) -> untyped? - def self?.assert_executable: (untyped path) -> (nil | untyped) + def self?.assert_executable: (untyped path) -> untyped? def self?.exit_hook: () { () -> untyped } -> untyped diff --git a/rb/sig/lib/selenium/webdriver/common/profile_helper.rbs b/rb/sig/lib/selenium/webdriver/common/profile_helper.rbs index 6333b19464dee..e6d952c6d4eb4 100644 --- a/rb/sig/lib/selenium/webdriver/common/profile_helper.rbs +++ b/rb/sig/lib/selenium/webdriver/common/profile_helper.rbs @@ -9,7 +9,7 @@ module Selenium def encoded: () -> untyped - def as_json: (*untyped) -> ::Hash[::String, untyped] + def as_json: (*untyped) -> Hash[String, untyped] def to_json: (*untyped) -> untyped @@ -17,7 +17,7 @@ module Selenium def create_tmp_copy: (untyped directory) -> untyped - def verify_model: (untyped model) -> (nil | untyped) + def verify_model: (untyped model) -> untyped? module ClassMethods def from_json: (untyped json) -> untyped diff --git a/rb/sig/lib/selenium/webdriver/common/proxy.rbs b/rb/sig/lib/selenium/webdriver/common/proxy.rbs index d0caaba987009..7b6156691e04a 100644 --- a/rb/sig/lib/selenium/webdriver/common/proxy.rbs +++ b/rb/sig/lib/selenium/webdriver/common/proxy.rbs @@ -25,11 +25,11 @@ module Selenium @type: untyped - TYPES: { direct: "DIRECT", manual: "MANUAL", pac: "PAC", auto_detect: "AUTODETECT", system: "SYSTEM" } + TYPES: Hash[Symbol, String] - ALLOWED: { type: "proxyType", ftp: "ftpProxy", http: "httpProxy", no_proxy: "noProxy", pac: "proxyAutoconfigUrl", ssl: "sslProxy", auto_detect: "autodetect", socks: "socksProxy", socks_username: "socksUsername", socks_password: "socksPassword", socks_version: "socksVersion" } + ALLOWED: Hash[Symbol, String] - def self.json_create: (untyped data) -> (nil | untyped) + def self.json_create: (untyped data) -> untyped? def initialize: (?::Hash[untyped, untyped] opts) -> void diff --git a/rb/sig/lib/selenium/webdriver/common/selenium_manager.rbs b/rb/sig/lib/selenium/webdriver/common/selenium_manager.rbs index 7355c8c27917b..df526c798dbe0 100644 --- a/rb/sig/lib/selenium/webdriver/common/selenium_manager.rbs +++ b/rb/sig/lib/selenium/webdriver/common/selenium_manager.rbs @@ -1,10 +1,5 @@ module Selenium module WebDriver - # - # Wrapper for getting information from the Selenium Manager binaries. - # This implementation is still in beta, and may change. - # @api private - # class SeleniumManager include _Platform include Open3 @@ -17,15 +12,12 @@ module Selenium def self.bin_path: () -> untyped - # @param [Options] options browser options. - # @return [String] the path to the correct driver. def self.driver_path: (untyped options) -> untyped private def self.generate_command: (untyped binary, untyped options) -> untyped - # @return [String] the path to the correct selenium manager def self.binary: () -> untyped def self.validate_location: (untyped location) -> untyped diff --git a/rb/sig/lib/selenium/webdriver/common/service_manager.rbs b/rb/sig/lib/selenium/webdriver/common/service_manager.rbs index dc72e595f64d5..d677aa1e58fdc 100644 --- a/rb/sig/lib/selenium/webdriver/common/service_manager.rbs +++ b/rb/sig/lib/selenium/webdriver/common/service_manager.rbs @@ -1,11 +1,5 @@ module Selenium module WebDriver - # - # Base class implementing default behavior of service_manager object, - # responsible for starting and stopping driver implementations. - # - # @api private - # class ServiceManager @executable_path: untyped @@ -25,11 +19,11 @@ module Selenium @socket_lock: untyped - START_TIMEOUT: 20 + START_TIMEOUT: Integer - SOCKET_LOCK_TIMEOUT: 45 + SOCKET_LOCK_TIMEOUT: Integer - STOP_TIMEOUT: 20 + STOP_TIMEOUT: Integer def initialize: (untyped config) -> void @@ -57,9 +51,9 @@ module Selenium def process_exited?: () -> untyped - def connect_until_stable: () -> (nil | untyped) + def connect_until_stable: () -> untyped? - def cannot_connect_error_text: () -> ::String + def cannot_connect_error_text: () -> String def socket_lock: () -> untyped end diff --git a/rb/sig/lib/selenium/webdriver/common/socket_lock.rbs b/rb/sig/lib/selenium/webdriver/common/socket_lock.rbs index 09c595c768c66..4a806f52f805e 100644 --- a/rb/sig/lib/selenium/webdriver/common/socket_lock.rbs +++ b/rb/sig/lib/selenium/webdriver/common/socket_lock.rbs @@ -13,7 +13,7 @@ module Selenium private - def lock: () -> (nil | untyped) + def lock: () -> untyped? def current_time: () -> untyped diff --git a/rb/sig/lib/selenium/webdriver/common/socket_poller.rbs b/rb/sig/lib/selenium/webdriver/common/socket_poller.rbs index aff2a40bbcc11..631b443064a31 100644 --- a/rb/sig/lib/selenium/webdriver/common/socket_poller.rbs +++ b/rb/sig/lib/selenium/webdriver/common/socket_poller.rbs @@ -23,15 +23,13 @@ module Selenium CONNECTED_ERRORS: Array[singleton(::Errno::EISCONN) | singleton(::Errno::EINVAL) | singleton(::Errno::EALREADY)] - # we use a plain TCPSocket here since JRuby has issues closing socket - # see https://github.com/jruby/jruby/issues/5709 def listening?: () -> untyped def socket_writable?: (untyped sock) -> untyped def conn_completed?: (untyped sock) -> untyped - def with_timeout: () { () -> untyped } -> (true | false) + def with_timeout: () { () -> untyped } -> bool def current_time: () -> untyped end diff --git a/rb/sig/lib/selenium/webdriver/common/virtual_authenticator/virtual_authenticator_options.rbs b/rb/sig/lib/selenium/webdriver/common/virtual_authenticator/virtual_authenticator_options.rbs index 652c9c22449e6..6d58c1771928f 100644 --- a/rb/sig/lib/selenium/webdriver/common/virtual_authenticator/virtual_authenticator_options.rbs +++ b/rb/sig/lib/selenium/webdriver/common/virtual_authenticator/virtual_authenticator_options.rbs @@ -13,9 +13,9 @@ module Selenium @user_verified: untyped - PROTOCOL: { ctap2: "ctap2", u2f: "ctap1/u2f" } + PROTOCOL: Hash[Symbol, String] - TRANSPORT: { ble: "ble", usb: "usb", nfc: "nfc", internal: "internal" } + TRANSPORT: Hash[Symbol, String] attr_accessor protocol: untyped @@ -39,7 +39,7 @@ module Selenium def initialize: (**untyped opts) -> void - def as_json: (*untyped) -> ::Hash[::String, untyped] + def as_json: (*untyped) -> Hash[String, untyped] end end end diff --git a/rb/sig/lib/selenium/webdriver/common/websocket_connection.rbs b/rb/sig/lib/selenium/webdriver/common/websocket_connection.rbs index ddc35cf26118b..411f09d91e948 100644 --- a/rb/sig/lib/selenium/webdriver/common/websocket_connection.rbs +++ b/rb/sig/lib/selenium/webdriver/common/websocket_connection.rbs @@ -25,13 +25,13 @@ module Selenium @id: untyped - CONNECTION_ERRORS: ::Array[untyped] + CONNECTION_ERRORS: Array[untyped] - RESPONSE_WAIT_TIMEOUT: 30 + RESPONSE_WAIT_TIMEOUT: Integer - RESPONSE_WAIT_INTERVAL: ::Float + RESPONSE_WAIT_INTERVAL: Float - MAX_LOG_MESSAGE_SIZE: 9999 + MAX_LOG_MESSAGE_SIZE: Integer def initialize: (url: untyped) -> void @@ -43,9 +43,6 @@ module Selenium private - # We should be thread-safe to use the hash without synchronization - # because its keys are WebSocket message identifiers and they should be - # unique within a devtools session. def messages: () -> untyped def process_handshake: () -> untyped @@ -54,7 +51,7 @@ module Selenium def incoming_frame: () -> untyped - def process_frame: (untyped frame) -> (::Hash[untyped, untyped] | untyped) + def process_frame: (untyped frame) -> (Hash[untyped, untyped] | untyped) def callback_thread: (untyped params) { (untyped) -> untyped } -> untyped diff --git a/rb/sig/lib/selenium/webdriver/common/zipper.rbs b/rb/sig/lib/selenium/webdriver/common/zipper.rbs index 0988f7bb50f52..090f02a7d49f3 100644 --- a/rb/sig/lib/selenium/webdriver/common/zipper.rbs +++ b/rb/sig/lib/selenium/webdriver/common/zipper.rbs @@ -1,7 +1,7 @@ module Selenium module WebDriver module Zipper - EXTENSIONS: ::Array[".zip" | ".xpi"] + EXTENSIONS: Array[String] def self.unzip: (untyped path) -> untyped diff --git a/rb/sig/lib/selenium/webdriver/devtools.rbs b/rb/sig/lib/selenium/webdriver/devtools.rbs index 088e3e8224bfb..44db3c460745f 100644 --- a/rb/sig/lib/selenium/webdriver/devtools.rbs +++ b/rb/sig/lib/selenium/webdriver/devtools.rbs @@ -16,7 +16,7 @@ module Selenium def send_cmd: (untyped method, **untyped params) -> untyped - def method_missing: (untyped method, *untyped _args) -> (nil | untyped) + def method_missing: (untyped method, *untyped _args) -> untyped? def respond_to_missing?: (untyped method, *untyped _args) -> untyped diff --git a/rb/sig/lib/selenium/webdriver/devtools/network_interceptor.rbs b/rb/sig/lib/selenium/webdriver/devtools/network_interceptor.rbs index c37ab73053bbb..0e3333c40400f 100644 --- a/rb/sig/lib/selenium/webdriver/devtools/network_interceptor.rbs +++ b/rb/sig/lib/selenium/webdriver/devtools/network_interceptor.rbs @@ -28,7 +28,7 @@ module Selenium def cancelled_requests: () -> untyped - def track_cancelled_request: (untyped data) -> (nil | untyped) + def track_cancelled_request: (untyped data) -> untyped? def request_paused: (untyped data) { () -> untyped } -> untyped diff --git a/rb/sig/lib/selenium/webdriver/devtools/pinned_script.rbs b/rb/sig/lib/selenium/webdriver/devtools/pinned_script.rbs index a5c99e3dc4bde..59416ef9f151d 100644 --- a/rb/sig/lib/selenium/webdriver/devtools/pinned_script.rbs +++ b/rb/sig/lib/selenium/webdriver/devtools/pinned_script.rbs @@ -14,11 +14,11 @@ module Selenium def initialize: (untyped script) -> void - def callable: () -> ::String + def callable: () -> String - def to_json: (*untyped) -> ::String + def to_json: (*untyped) -> String - def remove: () -> ::String + def remove: () -> String end end end diff --git a/rb/sig/lib/selenium/webdriver/devtools/request.rbs b/rb/sig/lib/selenium/webdriver/devtools/request.rbs index e96456a5999ee..885928373d01d 100644 --- a/rb/sig/lib/selenium/webdriver/devtools/request.rbs +++ b/rb/sig/lib/selenium/webdriver/devtools/request.rbs @@ -28,7 +28,7 @@ module Selenium def ==: (untyped other) -> untyped - def inspect: () -> ::String + def inspect: () -> String end end end diff --git a/rb/sig/lib/selenium/webdriver/edge/driver.rbs b/rb/sig/lib/selenium/webdriver/edge/driver.rbs index 26ed6fd59a2aa..3f0886323a0ab 100644 --- a/rb/sig/lib/selenium/webdriver/edge/driver.rbs +++ b/rb/sig/lib/selenium/webdriver/edge/driver.rbs @@ -10,7 +10,7 @@ module Selenium private - def devtools_address: () -> ::String + def devtools_address: () -> String end end end diff --git a/rb/sig/lib/selenium/webdriver/edge/options.rbs b/rb/sig/lib/selenium/webdriver/edge/options.rbs index b4939c9f17a24..eac25a8adaccd 100644 --- a/rb/sig/lib/selenium/webdriver/edge/options.rbs +++ b/rb/sig/lib/selenium/webdriver/edge/options.rbs @@ -2,9 +2,9 @@ module Selenium module WebDriver module Edge class Options < Chromium::Options - KEY: "ms:edgeOptions" + KEY: String - BROWSER: "MicrosoftEdge" + BROWSER: String def webview2!: () -> untyped diff --git a/rb/sig/lib/selenium/webdriver/edge/service.rbs b/rb/sig/lib/selenium/webdriver/edge/service.rbs index d16910ee237be..9723e6548efed 100644 --- a/rb/sig/lib/selenium/webdriver/edge/service.rbs +++ b/rb/sig/lib/selenium/webdriver/edge/service.rbs @@ -4,11 +4,11 @@ module Selenium class Service < WebDriver::Service @log: untyped - DEFAULT_PORT: 9515 + DEFAULT_PORT: Integer - EXECUTABLE: "msedgedriver" + EXECUTABLE: String - SHUTDOWN_SUPPORTED: true + SHUTDOWN_SUPPORTED: bool def log: () -> untyped end diff --git a/rb/sig/lib/selenium/webdriver/firefox/driver.rbs b/rb/sig/lib/selenium/webdriver/firefox/driver.rbs index 714c2de970ae3..7dd993e287aaf 100644 --- a/rb/sig/lib/selenium/webdriver/firefox/driver.rbs +++ b/rb/sig/lib/selenium/webdriver/firefox/driver.rbs @@ -2,13 +2,13 @@ module Selenium module WebDriver module Firefox class Driver < WebDriver::Driver - EXTENSIONS: ::Array[untyped] + EXTENSIONS: Array[untyped] include LocalDriver def initialize: (?options: untyped?, ?service: untyped?, ?url: untyped?, **untyped opts) -> void - def browser: () -> :firefox + def browser: () -> Symbol private diff --git a/rb/sig/lib/selenium/webdriver/firefox/extension.rbs b/rb/sig/lib/selenium/webdriver/firefox/extension.rbs index 3560de88730c6..0a4979c72b63c 100644 --- a/rb/sig/lib/selenium/webdriver/firefox/extension.rbs +++ b/rb/sig/lib/selenium/webdriver/firefox/extension.rbs @@ -6,7 +6,7 @@ module Selenium @should_reap_root: untyped - NAMESPACE: "http://www.mozilla.org/2004/em-rdf#" + NAMESPACE: String def initialize: (untyped path) -> void @@ -18,9 +18,9 @@ module Selenium def read_id: (untyped directory) -> untyped - def read_id_from_install_rdf: (untyped directory) -> (nil | untyped) + def read_id_from_install_rdf: (untyped directory) -> untyped? - def read_id_from_manifest_json: (untyped directory) -> (nil | untyped) + def read_id_from_manifest_json: (untyped directory) -> untyped? def applications_gecko_id: (untyped manifest) -> untyped diff --git a/rb/sig/lib/selenium/webdriver/firefox/options.rbs b/rb/sig/lib/selenium/webdriver/firefox/options.rbs index 914cb204fb1ff..d4087e414024c 100644 --- a/rb/sig/lib/selenium/webdriver/firefox/options.rbs +++ b/rb/sig/lib/selenium/webdriver/firefox/options.rbs @@ -8,11 +8,11 @@ module Selenium attr_accessor debugger_address: untyped - KEY: "moz:firefoxOptions" + KEY: String CAPABILITIES: Hash[Symbol, String] - BROWSER: "firefox" + BROWSER: String attr_reader profile: untyped diff --git a/rb/sig/lib/selenium/webdriver/firefox/profile.rbs b/rb/sig/lib/selenium/webdriver/firefox/profile.rbs index 119f88bc34249..58b936249a5c0 100644 --- a/rb/sig/lib/selenium/webdriver/firefox/profile.rbs +++ b/rb/sig/lib/selenium/webdriver/firefox/profile.rbs @@ -16,11 +16,11 @@ module Selenium include ProfileHelper - VALID_PREFERENCE_TYPES: ::Array[untyped] + VALID_PREFERENCE_TYPES: Array[untyped] - DEFAULT_PREFERENCES: ::Hash[::String, false | "about:blank"] + DEFAULT_PREFERENCES: Hash[String, bool | String] - LOCK_FILES: ::Array[".parentlock" | "parent.lock" | "lock"] + LOCK_FILES: Array[String] attr_reader name: untyped @@ -54,11 +54,11 @@ module Selenium private - def set_manual_proxy_preference: (untyped key, untyped value) -> (nil | untyped) + def set_manual_proxy_preference: (untyped key, untyped value) -> untyped? def install_extensions: (untyped directory) -> untyped - def read_model_prefs: () -> (::Hash[untyped, untyped] | untyped) + def read_model_prefs: () -> (Hash[untyped, untyped] | untyped) def delete_extensions_cache: (untyped directory) -> untyped diff --git a/rb/sig/lib/selenium/webdriver/firefox/profiles_ini.rbs b/rb/sig/lib/selenium/webdriver/firefox/profiles_ini.rbs index a2a1712643c87..09c93bd8bd597 100644 --- a/rb/sig/lib/selenium/webdriver/firefox/profiles_ini.rbs +++ b/rb/sig/lib/selenium/webdriver/firefox/profiles_ini.rbs @@ -1,7 +1,6 @@ module Selenium module WebDriver module Firefox - # @api private class ProfilesIni @ini_path: untyped @@ -17,7 +16,7 @@ module Selenium def parse: () -> untyped - def path_for: (untyped name, untyped is_relative, untyped path) -> (nil | untyped) + def path_for: (untyped name, untyped is_relative, untyped path) -> untyped? end end end diff --git a/rb/sig/lib/selenium/webdriver/ie/driver.rbs b/rb/sig/lib/selenium/webdriver/ie/driver.rbs index 9332cd4ab9ce7..53e9dbec58810 100644 --- a/rb/sig/lib/selenium/webdriver/ie/driver.rbs +++ b/rb/sig/lib/selenium/webdriver/ie/driver.rbs @@ -2,13 +2,13 @@ module Selenium module WebDriver module IE class Driver < WebDriver::Driver - EXTENSIONS: ::Array[untyped] + EXTENSIONS: Array[untyped] include LocalDriver def initialize: (?options: untyped?, ?service: untyped?, ?url: untyped?, **untyped opts) -> void - def browser: () -> :internet_explorer + def browser: () -> Symbol end end end diff --git a/rb/sig/lib/selenium/webdriver/ie/options.rbs b/rb/sig/lib/selenium/webdriver/ie/options.rbs index f28be8d158b88..da1a303265adf 100644 --- a/rb/sig/lib/selenium/webdriver/ie/options.rbs +++ b/rb/sig/lib/selenium/webdriver/ie/options.rbs @@ -4,15 +4,15 @@ module Selenium class Options < WebDriver::Options @args: untyped - KEY: "se:ieOptions" + KEY: String - SCROLL_TOP: 0 + SCROLL_TOP: Integer - SCROLL_BOTTOM: 1 + SCROLL_BOTTOM: Integer CAPABILITIES: Hash[Symbol, String] - BROWSER: "internet explorer" + BROWSER: String attr_reader args: untyped diff --git a/rb/sig/lib/selenium/webdriver/ie/service.rbs b/rb/sig/lib/selenium/webdriver/ie/service.rbs index d64651f359a52..94f9d492a292f 100644 --- a/rb/sig/lib/selenium/webdriver/ie/service.rbs +++ b/rb/sig/lib/selenium/webdriver/ie/service.rbs @@ -2,11 +2,11 @@ module Selenium module WebDriver module IE class Service < WebDriver::Service - DEFAULT_PORT: 5555 + DEFAULT_PORT: Integer - EXECUTABLE: "IEDriverServer" + EXECUTABLE: String - SHUTDOWN_SUPPORTED: true + SHUTDOWN_SUPPORTED: bool end end end diff --git a/rb/sig/lib/selenium/webdriver/remote/capabilities.rbs b/rb/sig/lib/selenium/webdriver/remote/capabilities.rbs index 35b9b0c80994a..d562c1ee76dc1 100644 --- a/rb/sig/lib/selenium/webdriver/remote/capabilities.rbs +++ b/rb/sig/lib/selenium/webdriver/remote/capabilities.rbs @@ -4,7 +4,7 @@ module Selenium class Capabilities @capabilities: untyped - KNOWN: ::Array[:browser_name | :browser_version | :platform_name | :accept_insecure_certs | :page_load_strategy | :proxy | :set_window_rect | :timeouts | :unhandled_prompt_behavior | :strict_file_interactability | :web_socket_url | :remote_session_id] + KNOWN: Array[Symbol] def self.always_match: (untyped capabilities) -> untyped @@ -16,7 +16,7 @@ module Selenium private - def self.process_timeouts: (untyped caps, untyped timeouts) -> (nil | untyped) + def self.process_timeouts: (untyped caps, untyped timeouts) -> untyped? public @@ -52,7 +52,7 @@ module Selenium def to_json: (*untyped) -> untyped - def ==: (untyped other) -> (false | untyped) + def ==: (untyped other) -> (bool | untyped) alias eql? == diff --git a/rb/sig/lib/selenium/webdriver/remote/http/common.rbs b/rb/sig/lib/selenium/webdriver/remote/http/common.rbs index 282c4592aa044..3e1e2ecc26be3 100644 --- a/rb/sig/lib/selenium/webdriver/remote/http/common.rbs +++ b/rb/sig/lib/selenium/webdriver/remote/http/common.rbs @@ -3,17 +3,17 @@ module Selenium module Remote module Http class Common - MAX_REDIRECTS: 20 + MAX_REDIRECTS: Integer - CONTENT_TYPE: "application/json" + CONTENT_TYPE: String - DEFAULT_HEADERS: ::Hash[::String, untyped | ::String] + DEFAULT_HEADERS: Hash[String, untyped] attr_writer server_url: untyped - def quit_errors: () -> ::Array[untyped] + def quit_errors: () -> Array[untyped] - def close: () -> nil + def close: () -> untyped def call: (untyped verb, untyped url, untyped command_hash) -> untyped diff --git a/rb/sig/lib/selenium/webdriver/remote/http/default.rbs b/rb/sig/lib/selenium/webdriver/remote/http/default.rbs index 0507fb559c886..7fb7a41c9ac7a 100644 --- a/rb/sig/lib/selenium/webdriver/remote/http/default.rbs +++ b/rb/sig/lib/selenium/webdriver/remote/http/default.rbs @@ -18,11 +18,6 @@ module Selenium attr_accessor read_timeout: untyped - # Initializes object. - # Warning: Setting {#open_timeout} to non-nil values will cause a separate thread to spawn. - # Debuggers that freeze the process will not be able to evaluate any operations if that happens. - # @param [Numeric] open_timeout - Open timeout to apply to HTTP client. - # @param [Numeric] read_timeout - Read timeout (seconds) to apply to HTTP client. def initialize: (?open_timeout: untyped?, ?read_timeout: untyped?) -> void def close: () -> untyped @@ -33,7 +28,7 @@ module Selenium def start: (untyped http) -> untyped - MAX_RETRIES: 3 + MAX_RETRIES: Integer def request: (untyped verb, untyped url, untyped headers, untyped payload, ?::Integer redirects) -> untyped @@ -45,7 +40,7 @@ module Selenium def proxy: () -> untyped - def use_proxy?: () -> (false | untyped) + def use_proxy?: () -> untyped end end end diff --git a/rb/sig/lib/selenium/webdriver/safari/driver.rbs b/rb/sig/lib/selenium/webdriver/safari/driver.rbs index ffa1b4a9bfc1e..5d26b33854dc2 100644 --- a/rb/sig/lib/selenium/webdriver/safari/driver.rbs +++ b/rb/sig/lib/selenium/webdriver/safari/driver.rbs @@ -2,13 +2,13 @@ module Selenium module WebDriver module Safari class Driver < WebDriver::Driver - EXTENSIONS: ::Array[untyped] + EXTENSIONS: Array[untyped] include LocalDriver def initialize: (?options: untyped?, ?service: untyped?, ?url: untyped?, **untyped opts) -> void - def browser: () -> :safari + def browser: () -> Symbol end end end diff --git a/rb/sig/lib/selenium/webdriver/safari/service.rbs b/rb/sig/lib/selenium/webdriver/safari/service.rbs index fb4e8acc5e03a..e75e317682014 100644 --- a/rb/sig/lib/selenium/webdriver/safari/service.rbs +++ b/rb/sig/lib/selenium/webdriver/safari/service.rbs @@ -2,11 +2,11 @@ module Selenium module WebDriver module Safari class Service < WebDriver::Service - DEFAULT_PORT: 7050 + DEFAULT_PORT: Integer - EXECUTABLE: "safaridriver" + EXECUTABLE: String - SHUTDOWN_SUPPORTED: false + SHUTDOWN_SUPPORTED: bool def initialize: (?path: untyped?, ?port: untyped?, ?log: untyped?, ?args: untyped?) -> void diff --git a/rb/sig/lib/selenium/webdriver/support/color.rbs b/rb/sig/lib/selenium/webdriver/support/color.rbs index 8a540a9c3b3ac..6d9c03ea294aa 100644 --- a/rb/sig/lib/selenium/webdriver/support/color.rbs +++ b/rb/sig/lib/selenium/webdriver/support/color.rbs @@ -10,21 +10,21 @@ module Selenium @alpha: untyped - RGB_PATTERN: ::Regexp + RGB_PATTERN: Regexp - RGB_PCT_PATTERN: ::Regexp + RGB_PCT_PATTERN: Regexp - RGBA_PATTERN: ::Regexp + RGBA_PATTERN: Regexp - RGBA_PCT_PATTERN: ::Regexp + RGBA_PCT_PATTERN: Regexp - HEX_PATTERN: ::Regexp + HEX_PATTERN: Regexp - HEX3_PATTERN: ::Regexp + HEX3_PATTERN: Regexp - HSL_PATTERN: ::Regexp + HSL_PATTERN: Regexp - HSLA_PATTERN: ::Regexp + HSLA_PATTERN: Regexp attr_reader red: untyped @@ -42,7 +42,7 @@ module Selenium def initialize: (String red, String green, String blue, Float | Integer | String ?alpha, *untyped args) -> void - def ==: (untyped other) -> (bool | untyped) + def ==: (untyped other) -> untyped alias eql? == diff --git a/rb/sig/lib/selenium/webdriver/support/escaper.rbs b/rb/sig/lib/selenium/webdriver/support/escaper.rbs index 8eaaf635109a5..6c91f6d65a094 100644 --- a/rb/sig/lib/selenium/webdriver/support/escaper.rbs +++ b/rb/sig/lib/selenium/webdriver/support/escaper.rbs @@ -2,7 +2,7 @@ module Selenium module WebDriver module Support module Escaper - def self.escape: (untyped str) -> ::String + def self.escape: (untyped str) -> String end end end diff --git a/rb/sig/lib/selenium/webdriver/support/guards.rbs b/rb/sig/lib/selenium/webdriver/support/guards.rbs index 189ededf30be3..2f7c90896426d 100644 --- a/rb/sig/lib/selenium/webdriver/support/guards.rbs +++ b/rb/sig/lib/selenium/webdriver/support/guards.rbs @@ -12,19 +12,19 @@ module Selenium @messages: untyped - GUARD_TYPES: ::Array[:except | :only | :exclude | :exclusive | :flaky] + GUARD_TYPES: Array[Symbol] attr_reader messages: untyped attr_accessor bug_tracker: untyped - def initialize: (untyped example, ?bug_tracker: ::String, ?conditions: untyped?) -> void + def initialize: (untyped example, ?bug_tracker: String, ?conditions: untyped?) -> void def add_condition: (untyped name, ?untyped? condition) { () -> untyped } -> untyped def add_message: (untyped name, untyped message) -> untyped - def disposition: () -> (::Array[:skip | untyped] | ::Array[:skip | untyped] | ::Array[:pending | untyped] | nil) + def disposition: () -> Array[untyped]? def satisfied?: (untyped guard) -> untyped diff --git a/rb/sig/lib/selenium/webdriver/support/guards/guard.rbs b/rb/sig/lib/selenium/webdriver/support/guards/guard.rbs index 957d44d1155a9..d5e312b9ee43f 100644 --- a/rb/sig/lib/selenium/webdriver/support/guards/guard.rbs +++ b/rb/sig/lib/selenium/webdriver/support/guards/guard.rbs @@ -25,17 +25,12 @@ module Selenium def message: () -> untyped - # Bug is present on all configurations specified def except?: () -> untyped - # Bug is present on all configurations not specified def only?: () -> untyped - # Bug is present on all configurations specified, but test can not be run because it breaks other tests, - # or it is flaky and unreliable def exclude?: () -> untyped - # Test only applies to configurations specified def exclusive?: () -> untyped end end diff --git a/rb/sig/lib/selenium/webdriver/support/relative_locator.rbs b/rb/sig/lib/selenium/webdriver/support/relative_locator.rbs index 99973b9ba12ee..e84b3d9127f10 100644 --- a/rb/sig/lib/selenium/webdriver/support/relative_locator.rbs +++ b/rb/sig/lib/selenium/webdriver/support/relative_locator.rbs @@ -6,11 +6,11 @@ module Selenium @root: untyped - KEYS: ::Array["above" | "below" | "left" | "right" | "near" | "distance"] + KEYS: Array[String] def initialize: (untyped locator) -> void - def as_json: () -> { relative: { root: untyped, filters: untyped } } + def as_json: () -> Hash[Symbol, untyped] end end end diff --git a/rb/sig/lib/selenium/webdriver/support/select.rbs b/rb/sig/lib/selenium/webdriver/support/select.rbs index eb93a8eb5eda0..d6372ca21871e 100644 --- a/rb/sig/lib/selenium/webdriver/support/select.rbs +++ b/rb/sig/lib/selenium/webdriver/support/select.rbs @@ -40,7 +40,7 @@ module Selenium def select_option: (untyped option) -> untyped - def deselect_option: (untyped option) -> (untyped | nil) + def deselect_option: (untyped option) -> untyped? def select_options: (untyped opts) -> untyped diff --git a/rb/sig/lib/selenium/webdriver/version.rbs b/rb/sig/lib/selenium/webdriver/version.rbs index e865429d316b6..f03fa7d1cf26c 100644 --- a/rb/sig/lib/selenium/webdriver/version.rbs +++ b/rb/sig/lib/selenium/webdriver/version.rbs @@ -1,5 +1,5 @@ module Selenium module WebDriver - VERSION: "4.16.0.nightly" + VERSION: String end end From 166587636fee78a6a42acfc43df5c09d153422aa Mon Sep 17 00:00:00 2001 From: aguspe Date: Sun, 17 Mar 2024 17:46:10 +0100 Subject: [PATCH 40/41] Remove steep related rubocop errors --- rb/Steepfile | 2 ++ rb/lib/selenium/webdriver/firefox/profile.rb | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/rb/Steepfile b/rb/Steepfile index 2d43128f88d4c..f1e8fd9bdeeb5 100644 --- a/rb/Steepfile +++ b/rb/Steepfile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + target :lib do signature 'sig', '.gem_rbs_collection/rubyzip' # Signature directory check 'lib' # Directory name diff --git a/rb/lib/selenium/webdriver/firefox/profile.rb b/rb/lib/selenium/webdriver/firefox/profile.rb index d1628af4bb61d..f018c5e2c7541 100644 --- a/rb/lib/selenium/webdriver/firefox/profile.rb +++ b/rb/lib/selenium/webdriver/firefox/profile.rb @@ -25,9 +25,9 @@ class Profile VALID_PREFERENCE_TYPES = [TrueClass, FalseClass, Integer, Float, String].freeze WEBDRIVER_PREFS = { - :port => 'webdriver_firefox_port', - :log_file => 'webdriver.log.file' - } + port: 'webdriver_firefox_port', + log_file: 'webdriver.log.file' + }.freeze DEFAULT_PREFERENCES = { 'browser.newtabpage.enabled' => false, @@ -166,7 +166,7 @@ def install_extensions(directory) destination = File.join(directory, 'extensions') @extensions.each do |name, extension| - WebDriver.logger.debug({ extension: name }.inspect, id: :firefox_profile) + WebDriver.logger.debug({extension: name}.inspect, id: :firefox_profile) extension.write_to(destination) end end From 15c9d0efe69e46f1a81e72549b2d6df235750bcb Mon Sep 17 00:00:00 2001 From: aguspe Date: Sun, 17 Mar 2024 17:56:07 +0100 Subject: [PATCH 41/41] Updated ignore and solved rubocop issues --- rb/Steepfile | 10 ++++++++-- rb/lib/selenium/webdriver/firefox/profiles_ini.rb | 4 ++-- rb/lib/selenium/webdriver/remote/http/default.rb | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/rb/Steepfile b/rb/Steepfile index f1e8fd9bdeeb5..d663fa219ec72 100644 --- a/rb/Steepfile +++ b/rb/Steepfile @@ -1,9 +1,10 @@ # frozen_string_literal: true +# rubocop:disable Metrics/BlockLength -- Disable due to the steep configuration not matching rubocop expectations target :lib do signature 'sig', '.gem_rbs_collection/rubyzip' # Signature directory check 'lib' # Directory name - # Total amount of errors ignore 63 in 29 files + # Total amount of errors ignore 66 in 31 files ignore( # Ignore line 166 due to UDP RBS issue 'lib/selenium/webdriver/common/platform.rb', @@ -61,7 +62,11 @@ target :lib do # Kwargs issue on line 74 'lib/selenium/webdriver/common/driver.rb', # issue with the Zipper RBS library on line 54 - 'lib/selenium/webdriver/firefox/extension.rb' + 'lib/selenium/webdriver/firefox/extension.rb', + # Ignored due to return of last match in line 57 and 59 + 'lib/selenium/webdriver/firefox/profiles_ini.rb', + # Ignored due to error on line 100 of response being nillable + 'lib/selenium/webdriver/remote/http/default.rb' ) # Standard libraries used in the project @@ -80,3 +85,4 @@ target :lib do 'zlib' ) end +# rubocop:enable Metrics/BlockLength diff --git a/rb/lib/selenium/webdriver/firefox/profiles_ini.rb b/rb/lib/selenium/webdriver/firefox/profiles_ini.rb index e9e955cd606d4..5050e31a2d905 100644 --- a/rb/lib/selenium/webdriver/firefox/profiles_ini.rb +++ b/rb/lib/selenium/webdriver/firefox/profiles_ini.rb @@ -54,9 +54,9 @@ def parse when /^Name=(.+)$/ name = Regexp.last_match(1)&.strip when /^IsRelative=(.+)$/ - is_relative = Regexp.last_match(1)&.strip == '1' + is_relative = Regexp.last_match(1).strip == '1' when /^Path=(.+)$/ - path = Regexp.last_match(1)&.strip + path = Regexp.last_match(1).strip p = path_for(name, is_relative, path) @profile_paths[name] = p if p end diff --git a/rb/lib/selenium/webdriver/remote/http/default.rb b/rb/lib/selenium/webdriver/remote/http/default.rb index 554a02f61d713..2677eefc2de15 100644 --- a/rb/lib/selenium/webdriver/remote/http/default.rb +++ b/rb/lib/selenium/webdriver/remote/http/default.rb @@ -97,7 +97,7 @@ def request(verb, url, headers, payload, redirects = 0) WebDriver.logger.debug("Redirect to #{response['Location']}; times: #{redirects}") raise Error::WebDriverError, 'too many redirects' if redirects >= MAX_REDIRECTS - request(:get, URI.parse(response['Location'].to_s), DEFAULT_HEADERS.dup, nil, redirects + 1) + request(:get, URI.parse(response['Location']), DEFAULT_HEADERS.dup, nil, redirects + 1) else WebDriver.logger.debug(" <<< #{response.instance_variable_get(:@header).inspect}", id: :header) create_response response.code, response.body, response.content_type