From 30dd316b8bb4eba6c5b3c3edb4c6dabe4aed386c Mon Sep 17 00:00:00 2001 From: aguspe Date: Fri, 18 Oct 2024 16:31:04 +0200 Subject: [PATCH 1/4] Add missing methods --- .../selenium/webdriver/common/driver_finder.rbs | 15 +++++++++++++++ .../selenium/webdriver/common/search_context.rbs | 4 ++++ rb/sig/lib/selenium/webdriver/common/service.rbs | 2 ++ .../lib/selenium/webdriver/remote/http/common.rbs | 10 ++++++++++ .../selenium/webdriver/support/guards/guard.rbs | 1 + 5 files changed, 32 insertions(+) diff --git a/rb/sig/lib/selenium/webdriver/common/driver_finder.rbs b/rb/sig/lib/selenium/webdriver/common/driver_finder.rbs index d012a5ec38f3c..7b2a405d816da 100644 --- a/rb/sig/lib/selenium/webdriver/common/driver_finder.rbs +++ b/rb/sig/lib/selenium/webdriver/common/driver_finder.rbs @@ -1,7 +1,22 @@ module Selenium module WebDriver class DriverFinder + @options: untyped + + @paths: untyped + @service: untyped + def self.path: (untyped options, untyped klass) -> untyped + + def browser_path: -> untyped + + def browser_path?: -> untyped + + def driver_path: -> untyped + + private + + def paths: -> 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 index 5f8f227156cb6..c240e68d5ce5b 100644 --- a/rb/sig/lib/selenium/webdriver/common/search_context.rbs +++ b/rb/sig/lib/selenium/webdriver/common/search_context.rbs @@ -5,6 +5,10 @@ module Selenium FINDERS: untyped + attr_accessor self.extra_finders: untyped + + def self.finders: -> untyped + def find_element: (*untyped args) -> untyped def find_elements: (*untyped args) -> untyped diff --git a/rb/sig/lib/selenium/webdriver/common/service.rbs b/rb/sig/lib/selenium/webdriver/common/service.rbs index e07af9ac3e1ce..30e4513c107f4 100644 --- a/rb/sig/lib/selenium/webdriver/common/service.rbs +++ b/rb/sig/lib/selenium/webdriver/common/service.rbs @@ -53,6 +53,8 @@ module Selenium def initialize: (?path: untyped?, ?port: untyped?, ?log: untyped?, ?args: untyped?) -> void + def find_driver_path: -> untyped + def launch: () -> untyped def shutdown_supported: () -> untyped diff --git a/rb/sig/lib/selenium/webdriver/remote/http/common.rbs b/rb/sig/lib/selenium/webdriver/remote/http/common.rbs index 3e1e2ecc26be3..37397e844683c 100644 --- a/rb/sig/lib/selenium/webdriver/remote/http/common.rbs +++ b/rb/sig/lib/selenium/webdriver/remote/http/common.rbs @@ -9,6 +9,14 @@ module Selenium DEFAULT_HEADERS: Hash[String, untyped] + @common_headers: untyped + + attr_accessor self.extra_headers: untyped + + attr_writer self.user_agent: untyped + + def self.user_agent: -> untyped + attr_writer server_url: untyped def quit_errors: () -> Array[untyped] @@ -19,6 +27,8 @@ module Selenium private + def common_headers: -> untyped + def server_url: () -> untyped def request: (*untyped) -> untyped diff --git a/rb/sig/lib/selenium/webdriver/support/guards/guard.rbs b/rb/sig/lib/selenium/webdriver/support/guards/guard.rbs index d5e312b9ee43f..9b4d1729c4640 100644 --- a/rb/sig/lib/selenium/webdriver/support/guards/guard.rbs +++ b/rb/sig/lib/selenium/webdriver/support/guards/guard.rbs @@ -15,6 +15,7 @@ module Selenium attr_reader guarded: untyped + attr_reader tracker: untyped attr_reader type: untyped attr_reader messages: untyped From 04d3f5d7adc2c3b8ec58e75ea6103957900d9089 Mon Sep 17 00:00:00 2001 From: aguspe Date: Sat, 19 Oct 2024 19:25:13 +0200 Subject: [PATCH 2/4] Reduce errors to 28 --- rb/sig/lib/selenium/webdriver/bidi.rbs | 2 +- rb/sig/lib/selenium/webdriver/bidi/log_handler.rbs | 6 +++--- rb/sig/lib/selenium/webdriver/common/driver_finder.rbs | 2 ++ rb/sig/lib/selenium/webdriver/common/service.rbs | 2 +- .../lib/selenium/webdriver/common/websocket_connection.rbs | 4 ++++ rb/sig/lib/selenium/webdriver/fedcm/dialog.rbs | 2 ++ rb/sig/lib/selenium/webdriver/firefox/options.rbs | 2 ++ rb/sig/selenium/web_driver/script.rbs | 4 +++- 8 files changed, 18 insertions(+), 6 deletions(-) diff --git a/rb/sig/lib/selenium/webdriver/bidi.rbs b/rb/sig/lib/selenium/webdriver/bidi.rbs index fa6b8757f6815..42c5e1c10059a 100644 --- a/rb/sig/lib/selenium/webdriver/bidi.rbs +++ b/rb/sig/lib/selenium/webdriver/bidi.rbs @@ -13,7 +13,7 @@ module Selenium def callbacks: () -> Hash[untyped, untyped] - def remove_callback: -> Array[Integer] + def remove_callback: (untyped event, untyped id) -> untyped def session: () -> Session diff --git a/rb/sig/lib/selenium/webdriver/bidi/log_handler.rbs b/rb/sig/lib/selenium/webdriver/bidi/log_handler.rbs index 703729d9c74ec..47f94107b14ec 100644 --- a/rb/sig/lib/selenium/webdriver/bidi/log_handler.rbs +++ b/rb/sig/lib/selenium/webdriver/bidi/log_handler.rbs @@ -14,13 +14,13 @@ module Selenium def add_message_handler: (String type) { (untyped) -> untyped } -> Integer - def remove_message_handler: (Integer id) -> false + def remove_message_handler: (Integer id) -> bool private - def subscribe_log_entry: () -> false + def subscribe_log_entry: () -> bool - def unsubscribe_log_entry: () -> false + def unsubscribe_log_entry: () -> bool 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 index 7b2a405d816da..4373fec706895 100644 --- a/rb/sig/lib/selenium/webdriver/common/driver_finder.rbs +++ b/rb/sig/lib/selenium/webdriver/common/driver_finder.rbs @@ -6,6 +6,8 @@ module Selenium @paths: untyped @service: untyped + def initialize: (untyped options,untyped service) -> void + def self.path: (untyped options, untyped klass) -> untyped def browser_path: -> untyped diff --git a/rb/sig/lib/selenium/webdriver/common/service.rbs b/rb/sig/lib/selenium/webdriver/common/service.rbs index 30e4513c107f4..788728741d3e1 100644 --- a/rb/sig/lib/selenium/webdriver/common/service.rbs +++ b/rb/sig/lib/selenium/webdriver/common/service.rbs @@ -47,7 +47,7 @@ module Selenium attr_accessor args: untyped - def env_path: -> String + def env_path: -> String? alias extra_args args diff --git a/rb/sig/lib/selenium/webdriver/common/websocket_connection.rbs b/rb/sig/lib/selenium/webdriver/common/websocket_connection.rbs index 411f09d91e948..b0276a246d815 100644 --- a/rb/sig/lib/selenium/webdriver/common/websocket_connection.rbs +++ b/rb/sig/lib/selenium/webdriver/common/websocket_connection.rbs @@ -35,10 +35,14 @@ module Selenium def initialize: (url: untyped) -> void + def add_callback: (untyped event, untyped id) -> untyped + def close: () -> untyped def callbacks: () -> untyped + def remove_callback: (untyped event, untyped id) -> untyped + def send_cmd: (**untyped payload) -> untyped private diff --git a/rb/sig/lib/selenium/webdriver/fedcm/dialog.rbs b/rb/sig/lib/selenium/webdriver/fedcm/dialog.rbs index c16ef91d6c930..98e4ff81a283e 100644 --- a/rb/sig/lib/selenium/webdriver/fedcm/dialog.rbs +++ b/rb/sig/lib/selenium/webdriver/fedcm/dialog.rbs @@ -7,6 +7,8 @@ module Selenium @bridge: Remote::Bridge + def initialize: (Remote::Bridge bridge) -> void + def accounts: -> Array[Account] def cancel: -> Remote::Response? diff --git a/rb/sig/lib/selenium/webdriver/firefox/options.rbs b/rb/sig/lib/selenium/webdriver/firefox/options.rbs index d4087e414024c..4c32508309974 100644 --- a/rb/sig/lib/selenium/webdriver/firefox/options.rbs +++ b/rb/sig/lib/selenium/webdriver/firefox/options.rbs @@ -6,6 +6,8 @@ module Selenium @profile: untyped + @options: untyped + attr_accessor debugger_address: untyped KEY: String diff --git a/rb/sig/selenium/web_driver/script.rbs b/rb/sig/selenium/web_driver/script.rbs index f2dc066174df0..d2afad6f6354e 100644 --- a/rb/sig/selenium/web_driver/script.rbs +++ b/rb/sig/selenium/web_driver/script.rbs @@ -4,11 +4,13 @@ module Selenium @bidi: BiDi @log_entry_subscribed: bool + def initialize: (BiDi bidi) -> void + def add_console_message_handler: -> untyped def add_javascript_error_handler: -> untyped - def remove_console_message_handler: -> untyped + def remove_console_message_handler: (untyped id) -> untyped alias remove_javascript_error_handler remove_console_message_handler From 634006cff7af44703b62cafefbc0ff34f4bdb12e Mon Sep 17 00:00:00 2001 From: aguspe Date: Thu, 24 Oct 2024 21:59:48 +0200 Subject: [PATCH 3/4] Update bidi type --- rb/sig/lib/selenium/webdriver/bidi.rbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rb/sig/lib/selenium/webdriver/bidi.rbs b/rb/sig/lib/selenium/webdriver/bidi.rbs index 42c5e1c10059a..9f8395be94270 100644 --- a/rb/sig/lib/selenium/webdriver/bidi.rbs +++ b/rb/sig/lib/selenium/webdriver/bidi.rbs @@ -13,7 +13,7 @@ module Selenium def callbacks: () -> Hash[untyped, untyped] - def remove_callback: (untyped event, untyped id) -> untyped + def remove_callback: (String event, Integer id) -> Error::WebDriverError? def session: () -> Session From ecb25fb4fc1b0c3abd7b69d2e0ca035d67439eaa Mon Sep 17 00:00:00 2001 From: aguspe Date: Fri, 25 Oct 2024 16:02:13 +0200 Subject: [PATCH 4/4] Update types --- .../lib/selenium/webdriver/firefox/options.rbs | 2 +- .../selenium/webdriver/remote/http/common.rbs | 18 +++++++++--------- .../webdriver/support/guards/guard.rbs | 2 +- rb/sig/selenium/web_driver/script.rbs | 12 +++++------- 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/rb/sig/lib/selenium/webdriver/firefox/options.rbs b/rb/sig/lib/selenium/webdriver/firefox/options.rbs index 4c32508309974..2fcb015d6430e 100644 --- a/rb/sig/lib/selenium/webdriver/firefox/options.rbs +++ b/rb/sig/lib/selenium/webdriver/firefox/options.rbs @@ -6,7 +6,7 @@ module Selenium @profile: untyped - @options: untyped + @options: Hash[Symbol, untyped] attr_accessor debugger_address: untyped diff --git a/rb/sig/lib/selenium/webdriver/remote/http/common.rbs b/rb/sig/lib/selenium/webdriver/remote/http/common.rbs index 37397e844683c..dfafbbf8456bf 100644 --- a/rb/sig/lib/selenium/webdriver/remote/http/common.rbs +++ b/rb/sig/lib/selenium/webdriver/remote/http/common.rbs @@ -9,31 +9,31 @@ module Selenium DEFAULT_HEADERS: Hash[String, untyped] - @common_headers: untyped + @common_headers: Hash[String, untyped] - attr_accessor self.extra_headers: untyped + attr_accessor self.extra_headers: Hash[String, untyped] - attr_writer self.user_agent: untyped + attr_writer self.user_agent: String - def self.user_agent: -> untyped + def self.user_agent: -> String - attr_writer server_url: untyped + attr_writer server_url: String def quit_errors: () -> Array[untyped] - def close: () -> untyped + def close: () -> nil def call: (untyped verb, untyped url, untyped command_hash) -> untyped private - def common_headers: -> untyped + def common_headers: -> Hash[String, untyped] - def server_url: () -> untyped + def server_url: () -> String def request: (*untyped) -> untyped - def create_response: (untyped code, untyped body, untyped content_type) -> untyped + def create_response: (Integer code, Hash[String, untyped] body, String content_type) -> Remote::Response 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 index 9b4d1729c4640..70c13b3cb0312 100644 --- a/rb/sig/lib/selenium/webdriver/support/guards/guard.rbs +++ b/rb/sig/lib/selenium/webdriver/support/guards/guard.rbs @@ -15,7 +15,7 @@ module Selenium attr_reader guarded: untyped - attr_reader tracker: untyped + attr_reader tracker: String attr_reader type: untyped attr_reader messages: untyped diff --git a/rb/sig/selenium/web_driver/script.rbs b/rb/sig/selenium/web_driver/script.rbs index d2afad6f6354e..73804ed7d280a 100644 --- a/rb/sig/selenium/web_driver/script.rbs +++ b/rb/sig/selenium/web_driver/script.rbs @@ -4,19 +4,17 @@ module Selenium @bidi: BiDi @log_entry_subscribed: bool + @log_handler: BiDi::LogHandler + def initialize: (BiDi bidi) -> void - def add_console_message_handler: -> untyped + def add_console_message_handler: -> Integer - def add_javascript_error_handler: -> untyped + def add_javascript_error_handler: -> Integer - def remove_console_message_handler: (untyped id) -> untyped + def remove_console_message_handler: (Integer id) -> bool alias remove_javascript_error_handler remove_console_message_handler - - private - - def subscribe_log_entry: -> untyped end end end