Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rb] Add RBS type support for BiDi related classes #14611

Merged
merged 3 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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