From b9ef666b6c430ecf9ae3ef94470cc375555bc570 Mon Sep 17 00:00:00 2001 From: Agustin Pequeno <33221555+aguspe@users.noreply.github.com> Date: Mon, 20 Nov 2023 23:52:11 +0100 Subject: [PATCH] Add RBS files to Ruby (#12844) Co-authored-by: aguspe --- .gitignore | 1 + rb/Gemfile | 1 + rb/Gemfile.lock | 118 ++++++-- rb/Steepfile | 4 + rb/lib/selenium/webdriver/common/logger.rb | 8 +- rb/rbs_collection.lock.yaml | 82 ++++++ rb/rbs_collection.yaml | 24 ++ rb/sig/lib/selenium/devtools/version.rbs | 5 + rb/sig/lib/selenium/webdriver.rbs | 34 +++ rb/sig/lib/selenium/webdriver/atoms.rbs | 11 + rb/sig/lib/selenium/webdriver/chrome.rbs | 13 + .../selenium/webdriver/chrome/features.rbs | 13 + rb/sig/lib/selenium/webdriver/chromium.rbs | 6 + .../selenium/webdriver/chromium/features.rbs | 39 +++ .../webdriver/common/action_builder.rbs | 53 ++++ .../lib/selenium/webdriver/common/driver.rbs | 73 +++++ .../common/driver_extensions/has_casting.rbs | 19 ++ .../driver_extensions/has_launching.rbs | 9 + .../lib/selenium/webdriver/common/element.rbs | 88 ++++++ .../common/interactions/input_device.rbs | 27 ++ .../common/interactions/interaction.rbs | 13 + .../common/interactions/key_actions.rbs | 17 ++ .../common/interactions/key_input.rbs | 20 ++ .../common/interactions/pointer_actions.rbs | 41 +++ .../common/interactions/pointer_input.rbs | 29 ++ .../common/interactions/scroll_origin.rbs | 25 ++ .../interactions/typing_interaction.rbs | 21 ++ .../common/interactions/wheel_input.rbs | 13 + .../lib/selenium/webdriver/common/logger.rbs | 35 +++ .../lib/selenium/webdriver/common/manager.rbs | 39 +++ .../selenium/webdriver/common/navigation.rbs | 15 ++ .../webdriver/common/search_context.rbs | 15 ++ .../selenium/webdriver/common/shadow_root.rbs | 33 +++ .../webdriver/common/takes_screenshot.rbs | 9 + .../webdriver/common/target_locator.rbs | 21 ++ .../selenium/webdriver/common/timeouts.rbs | 25 ++ .../virtual_authenticator.rbs | 31 +++ .../lib/selenium/webdriver/common/window.rbs | 31 +++ .../selenium/webdriver/devtools/response.rbs | 31 +++ rb/sig/lib/selenium/webdriver/edge.rbs | 11 + .../lib/selenium/webdriver/edge/features.rbs | 13 + rb/sig/lib/selenium/webdriver/firefox.rbs | 21 ++ .../selenium/webdriver/firefox/features.rbs | 21 ++ rb/sig/lib/selenium/webdriver/remote.rbs | 8 + .../lib/selenium/webdriver/remote/bridge.rbs | 253 ++++++++++++++++++ .../selenium/webdriver/remote/response.rbs | 31 +++ rb/sig/lib/selenium/webdriver/safari.rbs | 21 ++ .../selenium/webdriver/safari/features.rbs | 17 ++ .../support/abstract_event_listener.rbs | 43 +++ 49 files changed, 1502 insertions(+), 29 deletions(-) create mode 100644 rb/Steepfile create mode 100644 rb/rbs_collection.lock.yaml create mode 100644 rb/rbs_collection.yaml create mode 100644 rb/sig/lib/selenium/devtools/version.rbs create mode 100644 rb/sig/lib/selenium/webdriver.rbs create mode 100644 rb/sig/lib/selenium/webdriver/atoms.rbs create mode 100644 rb/sig/lib/selenium/webdriver/chrome.rbs create mode 100644 rb/sig/lib/selenium/webdriver/chrome/features.rbs create mode 100644 rb/sig/lib/selenium/webdriver/chromium.rbs create mode 100644 rb/sig/lib/selenium/webdriver/chromium/features.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/action_builder.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/driver.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/driver_extensions/has_casting.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/driver_extensions/has_launching.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/element.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/interactions/input_device.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/interactions/interaction.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/interactions/key_actions.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/interactions/key_input.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/interactions/pointer_actions.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/interactions/pointer_input.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/interactions/scroll_origin.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/interactions/typing_interaction.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/interactions/wheel_input.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/logger.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/manager.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/navigation.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/search_context.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/shadow_root.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/takes_screenshot.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/target_locator.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/timeouts.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/virtual_authenticator/virtual_authenticator.rbs create mode 100644 rb/sig/lib/selenium/webdriver/common/window.rbs create mode 100644 rb/sig/lib/selenium/webdriver/devtools/response.rbs create mode 100644 rb/sig/lib/selenium/webdriver/edge.rbs create mode 100644 rb/sig/lib/selenium/webdriver/edge/features.rbs create mode 100644 rb/sig/lib/selenium/webdriver/firefox.rbs create mode 100644 rb/sig/lib/selenium/webdriver/firefox/features.rbs create mode 100644 rb/sig/lib/selenium/webdriver/remote.rbs create mode 100644 rb/sig/lib/selenium/webdriver/remote/bridge.rbs create mode 100644 rb/sig/lib/selenium/webdriver/remote/response.rbs create mode 100644 rb/sig/lib/selenium/webdriver/safari.rbs create mode 100644 rb/sig/lib/selenium/webdriver/safari/features.rbs create mode 100644 rb/sig/lib/selenium/webdriver/support/abstract_event_listener.rbs diff --git a/.gitignore b/.gitignore index 7fd0f01369dbf..7495f1322efa8 100644 --- a/.gitignore +++ b/.gitignore @@ -108,6 +108,7 @@ GTAGS /rb/.idea rb/bin/ rb/lib/selenium/devtools/v1* +rb/.gem_rbs_collection/ .sonar/ .idea/sonarIssues.xml .idea/inspectionProfiles/profiles_settings.xml diff --git a/rb/Gemfile b/rb/Gemfile index 9710e18d99655..6607147e6e870 100644 --- a/rb/Gemfile +++ b/rb/Gemfile @@ -6,3 +6,4 @@ Dir["#{__dir__}/*.gemspec"].each do |spec| end gem 'debug', '~> 1.7', require: false, platforms: %i[mri mingw x64_mingw] +gem 'steep', '~> 1.5.0', require: false, platforms: %i[mri mingw x64_mingw] diff --git a/rb/Gemfile.lock b/rb/Gemfile.lock index c6537d4cb4811..0f4bd72dc42d9 100644 --- a/rb/Gemfile.lock +++ b/rb/Gemfile.lock @@ -11,36 +11,78 @@ PATH GEM remote: https://rubygems.org/ specs: - addressable (2.8.4) + abbrev (0.1.1) + activesupport (7.1.2) + base64 + bigdecimal + concurrent-ruby (~> 1.0, >= 1.0.2) + connection_pool (>= 2.2.5) + drb + i18n (>= 1.6, < 2) + minitest (>= 5.1) + mutex_m + tzinfo (~> 2.0) + addressable (2.8.5) public_suffix (>= 2.0.2, < 6.0) ast (2.4.2) + base64 (0.2.0) + bigdecimal (3.1.4) + concurrent-ruby (1.2.2) + connection_pool (2.4.1) crack (0.4.5) rexml + csv (3.2.8) debug (1.8.0) irb (>= 1.5.0) reline (>= 0.3.1) diff-lcs (1.5.0) + drb (2.2.0) + ruby2_keywords + ffi (1.16.3) + fileutils (1.7.2) hashdiff (1.0.1) + i18n (1.14.1) + concurrent-ruby (~> 1.0) io-console (0.6.0) - irb (1.7.0) - reline (>= 0.3.0) + io-console (0.6.0-java) + irb (1.9.0) + rdoc + reline (>= 0.3.8) + jar-dependencies (0.4.1) json (2.6.3) json (2.6.3-java) language_server-protocol (3.17.0.3) + listen (3.8.0) + rb-fsevent (~> 0.10, >= 0.10.3) + rb-inotify (~> 0.9, >= 0.9.10) + logger (1.6.0) + minitest (5.20.0) + mutex_m (0.2.0) parallel (1.23.0) - parser (3.2.2.3) + parser (3.2.2.4) ast (~> 2.4.1) racc - public_suffix (5.0.1) - racc (1.7.1) - racc (1.7.1-java) - rack (2.2.7) + psych (5.1.1.1) + stringio + psych (5.1.1.1-java) + jar-dependencies (>= 0.1.7) + public_suffix (5.0.4) + racc (1.7.3) + racc (1.7.3-java) + rack (2.2.8) rainbow (3.1.1) - rake (13.0.6) - regexp_parser (2.8.1) - reline (0.3.5) + rake (13.1.0) + rb-fsevent (0.11.2) + rb-inotify (0.10.1) + ffi (~> 1.0) + rbs (3.3.0) + abbrev + rdoc (6.6.0) + psych (>= 4.0.0) + regexp_parser (2.8.2) + reline (0.4.0) io-console (~> 0.5) - rexml (3.2.5) + rexml (3.2.6) rspec (3.12.0) rspec-core (~> 3.12.0) rspec-expectations (~> 3.12.0) @@ -50,38 +92,61 @@ GEM rspec-expectations (3.12.3) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) - rspec-mocks (3.12.5) + rspec-mocks (3.12.6) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) rspec-support (3.12.1) - rubocop (1.54.0) + rubocop (1.57.2) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 3.2.2.3) + parser (>= 3.2.2.4) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.28.0, < 2.0) + rubocop-ast (>= 1.28.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.29.0) + rubocop-ast (1.30.0) parser (>= 3.2.1.0) - rubocop-capybara (2.18.0) + rubocop-capybara (2.19.0) rubocop (~> 1.41) - rubocop-factory_bot (2.23.1) + rubocop-factory_bot (2.24.0) rubocop (~> 1.33) - rubocop-performance (1.18.0) + rubocop-performance (1.19.1) rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) - rubocop-rspec (2.22.0) - rubocop (~> 1.33) + rubocop-rspec (2.25.0) + rubocop (~> 1.40) rubocop-capybara (~> 2.17) rubocop-factory_bot (~> 2.22) ruby-progressbar (1.13.0) + ruby2_keywords (0.0.5) rubyzip (2.3.2) - unicode-display_width (2.4.2) - webmock (3.18.1) + securerandom (0.3.0) + steep (1.6.0) + activesupport (>= 5.1) + concurrent-ruby (>= 1.1.10) + csv (>= 3.0.9) + fileutils (>= 1.1.0) + json (>= 2.1.0) + language_server-protocol (>= 3.15, < 4.0) + listen (~> 3.0) + logger (>= 1.3.0) + parser (>= 3.1) + rainbow (>= 2.2.2, < 4.0) + rbs (>= 3.1.0) + securerandom (>= 0.1) + strscan (>= 1.0.0) + terminal-table (>= 2, < 4) + stringio (3.0.9) + strscan (3.0.7) + terminal-table (3.0.2) + unicode-display_width (>= 1.1.1, < 3) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + unicode-display_width (2.5.0) + webmock (3.19.1) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) @@ -92,6 +157,8 @@ GEM PLATFORMS java ruby + universal-java-1.8 + universal-java-17 universal-java-18 x64-mingw32 @@ -105,9 +172,10 @@ DEPENDENCIES rubocop-rspec (~> 2.16) selenium-devtools! selenium-webdriver! + steep (~> 1.6.0) webmock (~> 3.5) webrick (~> 1.7) yard (~> 0.9.11) BUNDLED WITH - 2.2.34 + 2.4.10 diff --git a/rb/Steepfile b/rb/Steepfile new file mode 100644 index 0000000000000..df470e013c4fa --- /dev/null +++ b/rb/Steepfile @@ -0,0 +1,4 @@ +target :lib do + signature 'sig' # Signature directory + check 'lib' # Directory name +end diff --git a/rb/lib/selenium/webdriver/common/logger.rb b/rb/lib/selenium/webdriver/common/logger.rb index 1c5fee17fe74d..50c902dfb7504 100644 --- a/rb/lib/selenium/webdriver/common/logger.rb +++ b/rb/lib/selenium/webdriver/common/logger.rb @@ -112,7 +112,7 @@ def allow(ids) # Overrides default #debug to skip ignored messages by provided id # # @param [String] message - # @param [Symbol, Array] id + # @param [Symbol, Array] id # @yield see #deprecate # def debug(message, id: [], &block) @@ -123,7 +123,7 @@ def debug(message, id: [], &block) # Used to supply information of general interest # # @param [String] message - # @param [Symbol, Array] id + # @param [Symbol, Array] id # @yield see #deprecate # def info(message, id: [], &block) @@ -134,7 +134,7 @@ def info(message, id: [], &block) # Used to supply information that suggests an error occurred # # @param [String] message - # @param [Symbol, Array] id + # @param [Symbol, Array] id # @yield see #deprecate # def error(message, id: [], &block) @@ -145,7 +145,7 @@ def error(message, id: [], &block) # Used to supply information that suggests action be taken by user # # @param [String] message - # @param [Symbol, Array] id + # @param [Symbol, Array] id # @yield see #deprecate # def warn(message, id: [], &block) diff --git a/rb/rbs_collection.lock.yaml b/rb/rbs_collection.lock.yaml new file mode 100644 index 0000000000000..e0f5305ca074a --- /dev/null +++ b/rb/rbs_collection.lock.yaml @@ -0,0 +1,82 @@ +--- +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: ast + version: '2.4' + source: + type: git + name: ruby/gem_rbs_collection + revision: 8149bc3fc0f720d935dc0592dc8886e03052f65f + remote: https://github.com/ruby/gem_rbs_collection.git + repo_dir: gems +- name: base64 + version: '0' + source: + type: stdlib +- name: cgi + version: '0' + source: + type: stdlib +- name: json + version: '0' + source: + type: stdlib +- name: logger + version: '0' + source: + type: stdlib +- name: monitor + version: '0' + source: + type: stdlib +- name: optparse + version: '0' + source: + type: stdlib +- name: parallel + version: '1.20' + source: + type: git + name: ruby/gem_rbs_collection + revision: 8149bc3fc0f720d935dc0592dc8886e03052f65f + remote: https://github.com/ruby/gem_rbs_collection.git + repo_dir: gems +- name: rack + version: '2.2' + source: + type: git + name: ruby/gem_rbs_collection + revision: 8149bc3fc0f720d935dc0592dc8886e03052f65f + remote: https://github.com/ruby/gem_rbs_collection.git + repo_dir: gems +- name: rainbow + version: '3.0' + source: + type: git + name: ruby/gem_rbs_collection + revision: 8149bc3fc0f720d935dc0592dc8886e03052f65f + remote: https://github.com/ruby/gem_rbs_collection.git + repo_dir: gems +- name: tempfile + version: '0' + source: + type: stdlib +- name: uri + version: '0' + source: + type: stdlib +- name: yard + version: '0.9' + source: + type: git + name: ruby/gem_rbs_collection + revision: 8149bc3fc0f720d935dc0592dc8886e03052f65f + remote: https://github.com/ruby/gem_rbs_collection.git + repo_dir: gems +gemfile_lock_path: Gemfile.lock diff --git a/rb/rbs_collection.yaml b/rb/rbs_collection.yaml new file mode 100644 index 0000000000000..05b2db098349d --- /dev/null +++ b/rb/rbs_collection.yaml @@ -0,0 +1,24 @@ +# Download sources +sources: + - type: git + name: ruby/gem_rbs_collection + remote: https://github.com/ruby/gem_rbs_collection.git + revision: main + repo_dir: gems + +# You can specify local directories as sources also. +# - type: local +# path: path/to/your/local/repository + +# A directory to install the downloaded RBSs +path: .gem_rbs_collection + +gems: + # Skip loading rbs gem's RBS. + # It's unnecessary if you don't use rbs as a library. + - name: rbs + ignore: true + - name: steep + ignore: true + - name: selenium-webdriver + ignore: true diff --git a/rb/sig/lib/selenium/devtools/version.rbs b/rb/sig/lib/selenium/devtools/version.rbs new file mode 100644 index 0000000000000..6a76744ce4b66 --- /dev/null +++ b/rb/sig/lib/selenium/devtools/version.rbs @@ -0,0 +1,5 @@ +module Selenium + module DevTools + VERSION: String + end +end diff --git a/rb/sig/lib/selenium/webdriver.rbs b/rb/sig/lib/selenium/webdriver.rbs new file mode 100644 index 0000000000000..63e1f3bc11f91 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver.rbs @@ -0,0 +1,34 @@ +module Selenium + module WebDriver + class Point + attr_reader x: Integer + attr_reader y: Integer + + def initialize: (Integer x, Integer y) -> void + end + + class Dimension + attr_reader width: Integer + attr_reader height: Integer + + def initialize: (Integer width, Integer height) -> void + end + + class Rectangle + attr_reader x: Integer + attr_reader y: Integer + attr_reader width: Integer + attr_reader height: Integer + + def initialize: (Integer x, Integer y, Integer width, Integer height) -> void + end + + @root: String + + def self.root: () -> String + + def self.for: (*String args) -> WebDriver::Driver + + def self.logger: (**String | Symbol opts) -> WebDriver::Logger + end +end diff --git a/rb/sig/lib/selenium/webdriver/atoms.rbs b/rb/sig/lib/selenium/webdriver/atoms.rbs new file mode 100644 index 0000000000000..0382de4bfd8d6 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/atoms.rbs @@ -0,0 +1,11 @@ +module Selenium + module WebDriver + module Atoms + private + + def read_atom: (Symbol function) -> String + + def execute_atom: (Symbol function_name, *untyped arguments) -> untyped + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/chrome.rbs b/rb/sig/lib/selenium/webdriver/chrome.rbs new file mode 100644 index 0000000000000..f1d605c834bb9 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/chrome.rbs @@ -0,0 +1,13 @@ +module Selenium + module WebDriver + module Chrome + self.@path: String + + @path: String + + def self.path=: (String path) -> String + + def self.path: () -> String? + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/chrome/features.rbs b/rb/sig/lib/selenium/webdriver/chrome/features.rbs new file mode 100644 index 0000000000000..71803ec58b589 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/chrome/features.rbs @@ -0,0 +1,13 @@ +module Selenium + module WebDriver + module Chrome + module Features + include WebDriver::Chromium::Features + + CHROME_COMMANDS: Hash[Symbol, Array[Symbol | String]] + + def commands: (Symbol command) -> Array[Symbol | String] + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/chromium.rbs b/rb/sig/lib/selenium/webdriver/chromium.rbs new file mode 100644 index 0000000000000..bb350c68a76f6 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/chromium.rbs @@ -0,0 +1,6 @@ +module Selenium + module WebDriver + module Chromium + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/chromium/features.rbs b/rb/sig/lib/selenium/webdriver/chromium/features.rbs new file mode 100644 index 0000000000000..1442a25f92b97 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/chromium/features.rbs @@ -0,0 +1,39 @@ +module Selenium + module WebDriver + module Chromium + module Features + CHROMIUM_COMMANDS: Hash[Symbol, Array[Symbol | String]] + + def commands: (Symbol command) -> Array[Symbol | String] + + def launch_app: (String id) -> String + + def cast_sinks: () -> Array[String] + + def cast_sink_to_use=: (String name) -> untyped + + def cast_issue_message: () -> String + + def start_cast_tab_mirroring: (String name) -> untyped + + def start_cast_desktop_mirroring: (String name) -> untyped + + def stop_casting: (String name) -> untyped + + def set_permission: (String name, String value) -> untyped + + def network_conditions: () -> Hash[untyped, untyped] + + def network_conditions=: (Hash[Symbol | String, Integer | bool] conditions) -> untyped + + def delete_network_conditions: () -> untyped + + def send_command: (Hash[String | Symbol, untyped] command_params) -> untyped + + def available_log_types: () -> Array[Symbol] + + def log: (untyped type) -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/action_builder.rbs b/rb/sig/lib/selenium/webdriver/common/action_builder.rbs new file mode 100644 index 0000000000000..fecf0e2a94201 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/action_builder.rbs @@ -0,0 +1,53 @@ +module Selenium + module WebDriver + class ActionBuilder + @bridge: Remote::Bridge + + @duration: Integer + + @async: bool + + @devices: Array[Interactions::InputDevice] + + include KeyActions + + include PointerActions + + include WheelActions + + attr_reader devices: Array[Interactions::InputDevice] + + 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_key_input: (String name) -> Interactions::KeyInput + + def add_wheel_input: (String name) -> Interactions::WheelInput + + def device: (?name: String?, ?type: String?) -> Selenium::WebDriver::Interactions::InputDevice? + + def pointer_inputs: () -> Array[Interactions::InputDevice] + + def key_inputs: () -> Array[Interactions::InputDevice] + + def wheel_inputs: () -> Array[Interactions::InputDevice] + + def pause: (?device: Interactions::InputDevice?, ?duration: Float) -> self + + def pauses: (?device: Interactions::InputDevice?, ?number: Integer?, ?duration: Float) -> self + + def perform: () -> nil + + def clear_all_actions: () -> [] + + def release_actions: () -> untyped + + private + + def tick: (*Interactions::InputDevice action_devices) -> (nil | Array[Interactions::InputDevice]) + + def add_input: (Interactions::InputDevice | Symbol 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 new file mode 100644 index 0000000000000..8fd17389f9ba8 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/driver.rbs @@ -0,0 +1,73 @@ +module Selenium + module WebDriver + class Driver + include SearchContext + + include TakesScreenshot + + def self.for: (Symbol browser, ?::Hash[Symbol, untyped] opts) -> Driver + + def initialize: (?bridge: Remote::Bridge? bridge, ?listener: Support::AbstractEventListener? listener, **untyped opts) -> void + + def inspect: () -> String + + def status: () -> Hash[untyped, untyped] + + def navigate: () -> Navigation + + def switch_to: () -> TargetLocator + + def manage: () -> Manager + + def action: (**untyped opts) -> ActionBuilder + + def get: (String url) -> untyped + + def current_url: () -> String + + def title: () -> String + + def page_source: () -> String + + def quit: () -> WebDriver::Remote::Response? + + def close: () -> WebDriver::Remote::Response? + + def window_handles: () -> Array[String] + + def window_handle: () -> String + + def execute_script: (String script, *untyped args) -> untyped + + def execute_async_script: (String script, *untyped args) -> untyped + + def add_virtual_authenticator: (untyped options) -> VirtualAuthenticator + + alias first find_element + + alias all find_elements + + alias script execute_script + + def []: (String | Hash[untyped, untyped] sel) -> Element + + def browser: () -> Symbol + + def capabilities: () -> untyped + + def ref: () -> ::Array[:driver | nil] + + private + + attr_reader bridge: Remote::Bridge + + def create_bridge: (caps: untyped caps, url: String url, ?http_client: untyped? http_client) -> untyped + + def service_url: (untyped service) -> untyped + + def screenshot: () -> untyped + + def add_extensions: (Symbol browser) -> untyped + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_casting.rbs b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_casting.rbs new file mode 100644 index 0000000000000..be13c0624a13f --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_casting.rbs @@ -0,0 +1,19 @@ +module Selenium + module WebDriver + module DriverExtensions + module HasCasting + def cast_sinks: () -> Array[String] + + def cast_sink_to_use=: (String name) -> untyped + + def start_cast_tab_mirroring: (String name) -> untyped + + def start_cast_desktop_mirroring: (String name) -> untyped + + def cast_issue_message: () -> String + + def stop_casting: (String name) -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_launching.rbs b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_launching.rbs new file mode 100644 index 0000000000000..760f160a0d1bd --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_launching.rbs @@ -0,0 +1,9 @@ +module Selenium + module WebDriver + module DriverExtensions + module HasLaunching + def launch_app: (String id) -> String + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/element.rbs b/rb/sig/lib/selenium/webdriver/common/element.rbs new file mode 100644 index 0000000000000..1867302ae2c5c --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/element.rbs @@ -0,0 +1,88 @@ +module Selenium + module WebDriver + class Element + ELEMENT_KEY: ::String + + include SearchContext + + include TakesScreenshot + + def initialize: (Remote::Bridge bridge, String id) -> void + + def inspect: () -> untyped + + def ==: (untyped other) -> bool + + alias eql? == + + def hash: () -> Integer + + def click: () -> untyped + + def tag_name: () -> untyped + + def attribute: (String name) -> String? + + def dom_attribute: (String name) -> String? + + def property: (String name) -> String? + + def aria_role: () -> String + + def accessible_name: () -> String + + def text: () -> String + + def send_keys: (*untyped args) -> untyped + + alias send_key send_keys + + def clear: () -> bool + + def enabled?: () -> bool + + def selected?: () -> bool + + def displayed?: () -> bool + + def submit: () -> untyped + + def css_value: (String prop) -> untyped + + alias style css_value + + def location: () -> WebDriver::Point + + def rect: () -> WebDriver::Rectangle + + def location_once_scrolled_into_view: () -> WebDriver::Point + + def size: () -> WebDriver::Dimension + + def shadow_root: () -> WebDriver::ShadowRoot + + alias first find_element + + alias all find_elements + + # + # element['class'] or element[:class] #=> "someclass" + # + alias [] attribute + + def ref: () -> ::Array[:element | untyped] + + def to_json: () -> untyped + + def as_json: () -> untyped + + private + + attr_reader bridge: Remote::Bridge + + def selectable?: () -> bool + + def screenshot: () -> untyped + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/input_device.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/input_device.rbs new file mode 100644 index 0000000000000..153405f4f6edb --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/interactions/input_device.rbs @@ -0,0 +1,27 @@ +module Selenium + module WebDriver + module Interactions + class InputDevice + @name: String + + @actions: Array[Interaction] + + attr_reader name: String + + attr_reader actions: Array[untyped] + + attr_reader type: String + + def initialize: (?String? name) -> void + + def add_action: (Interaction action) -> Array[Interaction] + + def clear_actions: () -> [] + + def create_pause: (Integer duration) -> Array[Interaction] + + def encode: () -> ({ type: String, id: String, actions: Array[untyped] } | nil) + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/interaction.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/interaction.rbs new file mode 100644 index 0000000000000..9ae432c6f7a01 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/interactions/interaction.rbs @@ -0,0 +1,13 @@ +module Selenium + module WebDriver + module Interactions + class Interaction + attr_reader type: untyped + + def initialize: (untyped source) -> void + + def assert_source: (untyped _source) -> untyped + end + end + end +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 new file mode 100644 index 0000000000000..56125a973160d --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/interactions/key_actions.rbs @@ -0,0 +1,17 @@ +module Selenium + module WebDriver + module KeyActions + def key_down: (*Symbol | String | Element args, ?device: Symbol | String?) -> self + + def key_up: (*Symbol | String | Element args, ?device: Symbol | String?) -> self + + def send_keys: (*Symbol | String | Element args, ?device: Symbol | String?) -> self + + private + + def key_action: (*Symbol | String | Element args, ?action: Symbol | String?, ?device: Symbol | String?) -> self + + def key_input: (?Symbol | String? name) -> untyped + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/key_input.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/key_input.rbs new file mode 100644 index 0000000000000..8bdbaabbed3c2 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/interactions/key_input.rbs @@ -0,0 +1,20 @@ +module Selenium + module WebDriver + module Interactions + class KeyInput < InputDevice + @type: untyped + + SUBTYPES: { down: :keyDown, up: :keyUp, pause: :pause } + + def initialize: (?untyped? name) -> void + + def create_key_down: (untyped key) -> untyped + + def create_key_up: (untyped key) -> untyped + + class TypingInteraction < Interactions::TypingInteraction + end + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/pointer_actions.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/pointer_actions.rbs new file mode 100644 index 0000000000000..e5d64f4e1e073 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/interactions/pointer_actions.rbs @@ -0,0 +1,41 @@ +module Selenium + module WebDriver + module PointerActions + @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_up: (?Symbol button, ?device: String | Symbol?, **Symbol | String opts) -> self + + def move_to: (Element element, ?Integer? right_by, ?Integer? down_by, **Symbol | String opts) -> self + + def move_by: (Integer right_by, Integer down_by, ?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) -> self + + def click_and_hold: (?Element ?element, ?button: Symbol?, ?device: Symbol | String?) -> self + + def release: (?button: Symbol?, ?device: Symbol | String?) -> self + + def click: (?Element ?element, ?button: Symbol?, ?device: Symbol | String?) -> self + + def double_click: (?Element? element, ?device: Symbol | String?) -> self + + def context_click: (?Element? element, ?device: Symbol | String?) -> self + + def drag_and_drop: (Element source, Element target, ?device: Symbol | String?) -> self + + def drag_and_drop_by: (Element source, Integer right_by, Integer down_by, ?device: Symbol | String?) -> self + + private + + def button_action: (Symbol button, Symbol action, ?device: Symbol | String?, **Symbol | String opts) -> self + + def pointer_input: (?Symbol | String? name) -> Interactions::InputDevice + end + end +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 new file mode 100644 index 0000000000000..fe94f36fec3c8 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/interactions/pointer_input.rbs @@ -0,0 +1,29 @@ +module Selenium + module WebDriver + module Interactions + class PointerInput < InputDevice + @kind: untyped + + @type: untyped + + KIND: { mouse: :mouse, pen: :pen, touch: :touch } + + attr_reader kind: untyped + + def initialize: (untyped kind, ?name: untyped?) -> void + + def encode: () -> untyped + + def assert_kind: (untyped pointer) -> untyped + + def create_pointer_move: (?duration: ::Integer, ?x: ::Integer, ?y: ::Integer, ?origin: untyped?, **untyped opts) -> untyped + + def create_pointer_down: (untyped button, **untyped opts) -> untyped + + def create_pointer_up: (untyped button, **untyped opts) -> untyped + + def create_pointer_cancel: () -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/scroll_origin.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/scroll_origin.rbs new file mode 100644 index 0000000000000..99fdffbb909aa --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/interactions/scroll_origin.rbs @@ -0,0 +1,25 @@ +module Selenium + module WebDriver + module WheelActions + class ScrollOrigin + @origin: untyped + + @x_offset: Integer + + @y_offset: Integer + + def self.element: (Element element, ?::Integer x_offset, ?::Integer y_offset) -> untyped + + def self.viewport: (?::Integer x_offset, ?::Integer y_offset) -> ScrollOrigin + + attr_reader origin: untyped + + attr_reader x_offset: Integer + + attr_reader y_offset: Integer + + def initialize: (untyped origin, Integer x_offset, Integer y_offset) -> void + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/typing_interaction.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/typing_interaction.rbs new file mode 100644 index 0000000000000..54ecfb4582042 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/interactions/typing_interaction.rbs @@ -0,0 +1,21 @@ +module Selenium + module WebDriver + module Interactions + class TypingInteraction < Interaction + @type: untyped + + @key: untyped + + attr_reader type: untyped + + def initialize: (untyped source, untyped type, untyped key) -> void + + def assert_source: (untyped source) -> (untyped | nil) + + def assert_type: (untyped type) -> untyped + + def encode: () -> { type: untyped, value: untyped } + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/wheel_input.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/wheel_input.rbs new file mode 100644 index 0000000000000..f63726dc643d7 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/interactions/wheel_input.rbs @@ -0,0 +1,13 @@ +module Selenium + module WebDriver + module Interactions + class WheelInput < InputDevice + @type: untyped + + def initialize: (?untyped? name) -> void + + def create_scroll: (**untyped opts) -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/logger.rbs b/rb/sig/lib/selenium/webdriver/common/logger.rbs new file mode 100644 index 0000000000000..386c971a5b924 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/logger.rbs @@ -0,0 +1,35 @@ +module Selenium + module WebDriver + class Logger + extend Forwardable + + def initialize: (?::String progname, ?default_level: Symbol? default_level, ?ignored: bool? ignored, ?allowed: bool? allowed) -> void + + def level=: (Symbol level) -> untyped + + def output=: (String io) -> IO + + def io: () -> IO + + def ignore: (*Symbol ids) -> untyped + + def allow: (*Symbol ids) -> untyped + + def debug: (String message, ?id: Symbol | Array[Symbol] id) { () -> untyped } -> untyped + + def info: (String message, ?id: Symbol | Array[Symbol] id) { () -> untyped } -> untyped + + def error: (String message, ?id: Symbol | Array[Symbol] id) { () -> untyped } -> untyped + + def warn: (String message, ?id: Symbol | Array[Symbol] id) { () -> untyped } -> untyped + + def deprecate: (String old, ?String? new, ?id: Symbol | Array[Symbol] id, ?reference: ::String reference) { () -> untyped } -> (nil | untyped) + + private + + def create_logger: (String name, level: Symbol level) -> untyped + + def discard_or_log: (Symbol level, String message, Symbol | Array[Symbol] id) { () -> untyped } -> (nil | untyped) + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/manager.rbs b/rb/sig/lib/selenium/webdriver/common/manager.rbs new file mode 100644 index 0000000000000..2c040a329ada1 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/manager.rbs @@ -0,0 +1,39 @@ +module Selenium + module WebDriver + class Manager + attr_reader bridge: untyped + + @timeouts: Timeouts + + @window: Window + + def initialize: (Remote::Bridge bridge) -> void + + def add_cookie: (?Hash[Symbol, untyped] opts) -> untyped + + def cookie_named: (String name) -> Hash[untyped, untyped]? + + def delete_cookie: (String name) -> String + + def delete_all_cookies: () -> untyped + + def all_cookies: () -> Array[Hash[untyped, untyped]] + + def timeouts: () -> Timeouts + + def window: () -> Window + + private + + SECONDS_PER_DAY: ::Float + + def datetime_at: (Integer int) -> Date + + def seconds_from: (Time | DateTime | Numeric obj) -> (Time | Date | Numeric) + + def strip_port: (String str) -> (Array[String] | nil) + + def convert_cookie: (untyped cookie) -> { name: untyped, value: untyped, path: untyped, domain: untyped, expires: untyped, same_site: untyped, http_only: untyped, secure: untyped } + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/navigation.rbs b/rb/sig/lib/selenium/webdriver/common/navigation.rbs new file mode 100644 index 0000000000000..4c31e52a3fe7c --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/navigation.rbs @@ -0,0 +1,15 @@ +module Selenium + module WebDriver + class Navigation + def initialize: (untyped bridge) -> void + + def to: (String url) -> untyped + + def back: () -> untyped + + def forward: () -> untyped + + def refresh: () -> untyped + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/search_context.rbs b/rb/sig/lib/selenium/webdriver/common/search_context.rbs new file mode 100644 index 0000000000000..36b4b4e1f45dd --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/search_context.rbs @@ -0,0 +1,15 @@ +module Selenium + module WebDriver + module SearchContext + FINDERS: untyped + + def find_element: (*untyped args) -> untyped + + def find_elements: (*untyped args) -> untyped + + private + + def extract_args: (untyped args) -> untyped + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/shadow_root.rbs b/rb/sig/lib/selenium/webdriver/common/shadow_root.rbs new file mode 100644 index 0000000000000..3ad30b84f72c1 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/shadow_root.rbs @@ -0,0 +1,33 @@ +module Selenium + module WebDriver + class ShadowRoot + @bridge: untyped + + @id: untyped + + ROOT_KEY: String + + include SearchContext + + def initialize: (untyped bridge, untyped id) -> void + + def inspect: () -> untyped + + def ==: (untyped other) -> untyped + + alias eql? == + + def hash: () -> untyped + + def ref: () -> ::Array[:shadow_root | untyped] + + def to_json: () -> untyped + + def as_json: () -> ::Hash[untyped, untyped] + + private + + attr_reader bridge: untyped + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/takes_screenshot.rbs b/rb/sig/lib/selenium/webdriver/common/takes_screenshot.rbs new file mode 100644 index 0000000000000..3623848c69596 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/takes_screenshot.rbs @@ -0,0 +1,9 @@ +module Selenium + module WebDriver + 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 + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/target_locator.rbs b/rb/sig/lib/selenium/webdriver/common/target_locator.rbs new file mode 100644 index 0000000000000..8f648f245c3c5 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/target_locator.rbs @@ -0,0 +1,21 @@ +module Selenium + module WebDriver + class TargetLocator + def initialize: (untyped bridge) -> void + + def frame: (String id) -> void + + def parent_frame: () -> void + + def new_window: (?::Symbol `type`) { (untyped) -> untyped } -> untyped + + def window: (untyped id) { () -> untyped } -> untyped + + def active_element: () -> Element + + def default_content: () -> void + + def alert: () -> void + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/timeouts.rbs b/rb/sig/lib/selenium/webdriver/common/timeouts.rbs new file mode 100644 index 0000000000000..70419cdb86dc8 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/timeouts.rbs @@ -0,0 +1,25 @@ +module Selenium + module WebDriver + class Timeouts + attr_reader bridge: untyped + + def initialize: (untyped bridge) -> void + + def implicit_wait: () -> Float + + def implicit_wait=: (Float seconds) -> void + + def script: () -> Float + + alias script_timeout script + + def script=: (Float seconds) -> void + + alias script_timeout= script= + + def page_load: () -> Float + + def page_load=: (Float seconds) -> void + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/virtual_authenticator/virtual_authenticator.rbs b/rb/sig/lib/selenium/webdriver/common/virtual_authenticator/virtual_authenticator.rbs new file mode 100644 index 0000000000000..a20c31dd63544 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/virtual_authenticator/virtual_authenticator.rbs @@ -0,0 +1,31 @@ +module Selenium + module WebDriver + class VirtualAuthenticator + @id: untyped + + @bridge: untyped + + @options: untyped + + @valid: untyped + + attr_reader options: untyped + + def initialize: (untyped bridge, untyped authenticator_id, untyped options) -> void + + def add_credential: (untyped credential) -> untyped + + def credentials: () -> untyped + + def remove_credential: (untyped credential_id) -> untyped + + def remove_all_credentials: () -> untyped + + def user_verified=: (untyped verified) -> untyped + + def remove!: () -> untyped + + def valid?: () -> untyped + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/common/window.rbs b/rb/sig/lib/selenium/webdriver/common/window.rbs new file mode 100644 index 0000000000000..69a06fbbf985f --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/common/window.rbs @@ -0,0 +1,31 @@ +module Selenium + module WebDriver + class Window + attr_reader bridge: untyped + + def initialize: (untyped bridge) -> void + + def size=: (Dimension dimension) -> untyped + + def size: () -> Dimension + + def position=: (Point point) -> untyped + + def position: () -> Point + + def rect=: (Rectangle rectangle) -> untyped + + def rect: () -> Rectangle + + def resize_to: (Integer width, Integer height) -> untyped + + def move_to: (Integer x, Integer y) -> untyped + + def maximize: () -> untyped + + def minimize: () -> untyped + + def full_screen: () -> untyped + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/devtools/response.rbs b/rb/sig/lib/selenium/webdriver/devtools/response.rbs new file mode 100644 index 0000000000000..5e1ccf28a2aa6 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/devtools/response.rbs @@ -0,0 +1,31 @@ +module Selenium + module WebDriver + class DevTools + class Response + @id: untyped + + @code: untyped + + @body: untyped + + @headers: untyped + + attr_accessor code: untyped + + attr_accessor body: untyped + + attr_accessor headers: untyped + + attr_reader id: untyped + + def self.from: (untyped id, untyped encoded_body, untyped params) -> untyped + + def initialize: (id: untyped, code: untyped, body: untyped, headers: untyped) -> void + + def ==: (untyped other) -> untyped + + def inspect: () -> ::String + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/edge.rbs b/rb/sig/lib/selenium/webdriver/edge.rbs new file mode 100644 index 0000000000000..fea64d68b81e6 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/edge.rbs @@ -0,0 +1,11 @@ +module Selenium + module WebDriver + module Edge + self.@path: untyped + + def self.path=: (untyped path) -> untyped + + def self.path: () -> untyped + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/edge/features.rbs b/rb/sig/lib/selenium/webdriver/edge/features.rbs new file mode 100644 index 0000000000000..be01c16cf4ea7 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/edge/features.rbs @@ -0,0 +1,13 @@ +module Selenium + module WebDriver + module Edge + module Features + include WebDriver::Chromium::Features + + EDGE_COMMANDS: Hash[Symbol, Array[Symbol | String]] + + def commands: (untyped command) -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/firefox.rbs b/rb/sig/lib/selenium/webdriver/firefox.rbs new file mode 100644 index 0000000000000..9d25371c0f786 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/firefox.rbs @@ -0,0 +1,21 @@ +module Selenium + module WebDriver + module Firefox + self.@path: untyped + + DEFAULT_PORT: Integer + + DEFAULT_SECURE_SSL: bool + + DEFAULT_ASSUME_UNTRUSTED_ISSUER: bool + + DEFAULT_LOAD_NO_FOCUS_LIB: bool + + DEVTOOLS_VERSION: Integer + + def self.path=: (untyped path) -> untyped + + def self.path: () -> untyped + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/firefox/features.rbs b/rb/sig/lib/selenium/webdriver/firefox/features.rbs new file mode 100644 index 0000000000000..8957c9215b0ab --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/firefox/features.rbs @@ -0,0 +1,21 @@ +module Selenium + module WebDriver + module Firefox + module Features + FIREFOX_COMMANDS: Hash[Symbol, Array[Symbol | String]] + + def commands: (untyped command) -> untyped + + def install_addon: (untyped path, untyped temporary) -> untyped + + def uninstall_addon: (untyped id) -> untyped + + def full_screenshot: () -> untyped + + def context=: (untyped context) -> untyped + + def context: () -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/remote.rbs b/rb/sig/lib/selenium/webdriver/remote.rbs new file mode 100644 index 0000000000000..65d8807f1dcb0 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/remote.rbs @@ -0,0 +1,8 @@ +module Selenium + module WebDriver + module Remote + module Http + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/remote/bridge.rbs b/rb/sig/lib/selenium/webdriver/remote/bridge.rbs new file mode 100644 index 0000000000000..936c06ca4b54e --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/remote/bridge.rbs @@ -0,0 +1,253 @@ +module Selenium + module WebDriver + module Remote + class Bridge + @http: untyped + + @file_detector: untyped + + @session_id: untyped + + @capabilities: untyped + + @browser: untyped + + @manage: untyped + + @escaper: untyped + + include Atoms + + PORT: Integer + + attr_accessor http: untyped + + attr_accessor file_detector: untyped + + attr_reader capabilities: untyped + + def initialize: (url: String | URI, ?http_client: untyped?) -> void + + def create_session: (untyped capabilities) -> untyped + + extend WebDriver::Chrome::Features + + extend WebDriver::Firefox::Features + + extend WebDriver::Edge::Features + + extend WebDriver::Safari::Features + + def session_id: () -> untyped + + def browser: () -> untyped + + def status: () -> untyped + + def get: (untyped url) -> untyped + + def timeouts: () -> untyped + + def timeouts=: (untyped timeouts) -> untyped + + def accept_alert: () -> untyped + + def dismiss_alert: () -> untyped + + def alert=: (untyped keys) -> untyped + + def alert_text: () -> untyped + + def go_back: () -> untyped + + def go_forward: () -> untyped + + def url: () -> untyped + + def title: () -> untyped + + def page_source: () -> untyped + + def new_window: (untyped type) -> untyped + + def switch_to_window: (untyped name) -> untyped + + def switch_to_frame: (untyped id) -> untyped + + def switch_to_parent_frame: () -> untyped + + def switch_to_default_content: () -> untyped + + QUIT_ERRORS: ::Array[untyped] + + def quit: () -> untyped + + def close: () -> untyped + + def refresh: () -> untyped + + def window_handles: () -> untyped + + def window_handle: () -> untyped + + def resize_window: (untyped width, untyped height, ?::Symbol handle) -> untyped + + def window_size: (?::Symbol handle) -> untyped + + def minimize_window: () -> untyped + + def maximize_window: (?::Symbol handle) -> untyped + + def full_screen_window: () -> untyped + + def reposition_window: (untyped x, untyped y) -> untyped + + def window_position: () -> untyped + + def set_window_rect: (?x: untyped?, ?y: untyped?, ?width: untyped?, ?height: untyped?) -> untyped + + def window_rect: () -> untyped + + def screenshot: () -> untyped + + def element_screenshot: (untyped element) -> untyped + + def local_storage_item: (untyped key, ?untyped? value) -> untyped + + def remove_local_storage_item: (untyped key) -> untyped + + def local_storage_keys: () -> untyped + + def clear_local_storage: () -> untyped + + def local_storage_size: () -> untyped + + def session_storage_item: (untyped key, ?untyped? value) -> untyped + + def remove_session_storage_item: (untyped key) -> untyped + + def session_storage_keys: () -> untyped + + def clear_session_storage: () -> untyped + + def session_storage_size: () -> untyped + + def execute_script: (untyped script, *untyped args) -> untyped + + def execute_async_script: (untyped script, *untyped args) -> untyped + + def manage: () -> untyped + + def add_cookie: (untyped cookie) -> untyped + + def delete_cookie: (untyped name) -> untyped + + def cookie: (untyped name) -> untyped + + def cookies: () -> untyped + + def delete_all_cookies: () -> untyped + + def action: (?async: bool, ?devices: untyped, ?duration: ::Integer) -> untyped + + alias actions action + + def send_actions: (untyped data) -> untyped + + def release_actions: () -> untyped + + def print_page: (?::Hash[untyped, untyped] options) -> untyped + + def click_element: (untyped element) -> untyped + + def send_keys_to_element: (untyped element, untyped keys) -> untyped + + def upload: (untyped local_file) -> untyped + + def clear_element: (untyped element) -> untyped + + def submit_element: (untyped element) -> untyped + + def element_tag_name: (untyped element) -> untyped + + def element_attribute: (untyped element, untyped name) -> untyped + + def element_dom_attribute: (untyped element, untyped name) -> untyped + + def element_property: (untyped element, untyped name) -> untyped + + def element_aria_role: (untyped element) -> untyped + + def element_aria_label: (untyped element) -> untyped + + def element_value: (untyped element) -> untyped + + def element_text: (untyped element) -> untyped + + def element_location: (untyped element) -> untyped + + def element_rect: (untyped element) -> untyped + + def element_location_once_scrolled_into_view: (untyped element) -> untyped + + def element_size: (untyped element) -> untyped + + def element_enabled?: (untyped element) -> untyped + + def element_selected?: (untyped element) -> untyped + + def element_displayed?: (untyped element) -> untyped + + def element_value_of_css_property: (untyped element, untyped prop) -> untyped + + def active_element: () -> untyped + + alias switch_to_active_element active_element + + def find_element_by: (untyped how, untyped what, ?untyped parent_ref) -> untyped + + def find_elements_by: (untyped how, untyped what, ?untyped parent_ref) -> untyped + + def shadow_root: (untyped element) -> untyped + + def add_virtual_authenticator: (untyped options) -> untyped + + def remove_virtual_authenticator: (untyped id) -> untyped + + def add_credential: (untyped credential, untyped id) -> untyped + + def credentials: (untyped authenticator_id) -> untyped + + def remove_credential: (untyped credential_id, untyped authenticator_id) -> untyped + + def remove_all_credentials: (untyped authenticator_id) -> untyped + + def user_verified: (untyped verified, untyped authenticator_id) -> untyped + + private + + def execute: (untyped command, ?::Hash[untyped, untyped] opts, ?untyped? command_hash) -> untyped + + def escaper: () -> untyped + + def commands: (untyped command) -> untyped + + def unwrap_script_result: (untyped arg) -> untyped + + def element_id_from: (untyped id) -> untyped + + def shadow_root_id_from: (untyped id) -> untyped + + def prepare_capabilities_payload: (untyped capabilities) -> { capabilities: untyped } + + def convert_locator: (untyped how, untyped what) -> ::Array[untyped] + + ESCAPE_CSS_REGEXP: ::Regexp + + UNICODE_CODE_POINT: 30 + + def escape_css: (untyped string) -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/remote/response.rbs b/rb/sig/lib/selenium/webdriver/remote/response.rbs new file mode 100644 index 0000000000000..92a6c08abcedb --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/remote/response.rbs @@ -0,0 +1,31 @@ +module Selenium + module WebDriver + module Remote + class Response + @code: String + + @payload: Hash[untyped, untyped] + + attr_reader code: String + + attr_reader payload: Hash[untyped, untyped] + + def initialize: (String code, ?Hash[untyped, untyped]? payload) -> void + + def error: () -> (nil | untyped) + + def []: (untyped key) -> untyped + + private + + def assert_ok: () -> (nil | untyped) + + def add_backtrace: (untyped ex, untyped server_trace) -> (nil | untyped) + + def backtrace_from_remote: (untyped server_trace) -> Array[untyped] + + def process_error: () -> (nil | ::Array[untyped]) + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/safari.rbs b/rb/sig/lib/selenium/webdriver/safari.rbs new file mode 100644 index 0000000000000..80bfbd7a4b4a1 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/safari.rbs @@ -0,0 +1,21 @@ +module Selenium + module WebDriver + module Safari + self.@use_technology_preview: untyped + + self.@path: untyped + + attr_accessor self.use_technology_preview: untyped + + def self.technology_preview: () -> String + + def self.technology_preview!: () -> untyped + + def self.technology_preview?: () -> untyped + + def self.path=: (untyped path) -> untyped + + def self.path: () -> untyped + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/safari/features.rbs b/rb/sig/lib/selenium/webdriver/safari/features.rbs new file mode 100644 index 0000000000000..e4dc1c06ed25e --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/safari/features.rbs @@ -0,0 +1,17 @@ +module Selenium + module WebDriver + module Safari + module Features + SAFARI_COMMANDS: Hash[Symbol, Array[Symbol | String]] + + def commands: (untyped command) -> untyped + + def permissions: () -> untyped + + def permissions=: (untyped permissions) -> untyped + + def attach_debugger: () -> untyped + end + end + end +end diff --git a/rb/sig/lib/selenium/webdriver/support/abstract_event_listener.rbs b/rb/sig/lib/selenium/webdriver/support/abstract_event_listener.rbs new file mode 100644 index 0000000000000..3f985831b6501 --- /dev/null +++ b/rb/sig/lib/selenium/webdriver/support/abstract_event_listener.rbs @@ -0,0 +1,43 @@ +module Selenium + module WebDriver + module Support + class AbstractEventListener + def before_navigate_to: (untyped url, untyped driver) -> nil + + def after_navigate_to: (untyped url, untyped driver) -> nil + + def before_navigate_back: (untyped driver) -> nil + + def after_navigate_back: (untyped driver) -> nil + + def before_navigate_forward: (untyped driver) -> nil + + def after_navigate_forward: (untyped driver) -> nil + + def before_find: (untyped by, untyped what, untyped driver) -> nil + + def after_find: (untyped by, untyped what, untyped driver) -> nil + + def before_click: (untyped element, untyped driver) -> nil + + def after_click: (untyped element, untyped driver) -> nil + + def before_change_value_of: (untyped element, untyped driver) -> nil + + def after_change_value_of: (untyped element, untyped driver) -> nil + + def before_execute_script: (untyped script, untyped driver) -> nil + + def after_execute_script: (untyped script, untyped driver) -> nil + + def before_quit: (untyped driver) -> nil + + def after_quit: (untyped driver) -> nil + + def before_close: (untyped driver) -> nil + + def after_close: (untyped driver) -> nil + end + end + end +end