Skip to content

Commit

Permalink
[rb] Add RBS type support for BiDi related classes (#14611)
Browse files Browse the repository at this point in the history
  • Loading branch information
aguspe authored Oct 18, 2024
1 parent 62f6f69 commit 1b64798
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 1 deletion.
6 changes: 5 additions & 1 deletion rb/sig/lib/selenium/webdriver/bidi.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@ module Selenium

def initialize: (url: String) -> void

def add_callback: -> Integer

def close: () -> nil

def callbacks: () -> Hash[untyped, untyped]

def remove_callback: -> Array[Integer]

def session: () -> Session

def send_cmd: (untyped method, **untyped params) -> untyped
def send_cmd: (String method, **untyped params) -> untyped

def error_message: (Hash[String,String] message) -> String
end
Expand Down
27 changes: 27 additions & 0 deletions rb/sig/lib/selenium/webdriver/bidi/log_handler.rbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module Selenium
module WebDriver
class BiDi
class LogHandler
@bidi: BiDi

@log_entry_subscribed: bool

ConsoleLogEntry: Struct

JavaScriptLogEntry: Struct

def initialize: (BiDi bidi) -> void

def add_message_handler: (String type) { (untyped) -> untyped } -> Integer

def remove_message_handler: (Integer id) -> false

private

def subscribe_log_entry: () -> false

def unsubscribe_log_entry: () -> false
end
end
end
end
11 changes: 11 additions & 0 deletions rb/sig/lib/selenium/webdriver/bidi/struct.rbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module Selenium
module WebDriver
class BiDi
class Struct < ::Struct
def self.new: (*untyped args) { (?) -> untyped } -> void

def self.camel_to_snake: (String camel_str) -> String
end
end
end
end
17 changes: 17 additions & 0 deletions rb/sig/lib/selenium/webdriver/remote/bidi_bridge.rbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module Selenium
module WebDriver
module Remote
class BiDiBridge < Bridge
@bidi: untyped

attr_reader bidi: untyped

def create_session: (Hash[Symbol, String] capabilities) -> BiDi

def quit: () -> nil

def close: () -> nil
end
end
end
end
2 changes: 2 additions & 0 deletions rb/sig/lib/selenium/webdriver/remote/bridge.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ module Selenium

def initialize: (url: String | URI, ?http_client: untyped?) -> void

def bidi: -> WebDriver::Error::WebDriverError

def cancel_fedcm_dialog: -> nil

def click_fedcm_dialog_button: -> nil
Expand Down
19 changes: 19 additions & 0 deletions rb/sig/lib/selenium/webdriver/remote/bridge/locator_converter.rbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module Selenium
module WebDriver
module Remote
class Bridge
class LocatorConverter
ESCAPE_CSS_REGEXP: Regexp

UNICODE_CODE_POINT: Integer

def convert: (String | Symbol how, String what) -> Array[String]

private

def escape_css: (String string) -> String
end
end
end
end
end

0 comments on commit 1b64798

Please sign in to comment.