Skip to content

Commit 1b64798

Browse files
authored
[rb] Add RBS type support for BiDi related classes (#14611)
1 parent 62f6f69 commit 1b64798

File tree

6 files changed

+81
-1
lines changed

6 files changed

+81
-1
lines changed

rb/sig/lib/selenium/webdriver/bidi.rbs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,17 @@ module Selenium
77

88
def initialize: (url: String) -> void
99

10+
def add_callback: -> Integer
11+
1012
def close: () -> nil
1113

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

16+
def remove_callback: -> Array[Integer]
17+
1418
def session: () -> Session
1519

16-
def send_cmd: (untyped method, **untyped params) -> untyped
20+
def send_cmd: (String method, **untyped params) -> untyped
1721

1822
def error_message: (Hash[String,String] message) -> String
1923
end
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
module Selenium
2+
module WebDriver
3+
class BiDi
4+
class LogHandler
5+
@bidi: BiDi
6+
7+
@log_entry_subscribed: bool
8+
9+
ConsoleLogEntry: Struct
10+
11+
JavaScriptLogEntry: Struct
12+
13+
def initialize: (BiDi bidi) -> void
14+
15+
def add_message_handler: (String type) { (untyped) -> untyped } -> Integer
16+
17+
def remove_message_handler: (Integer id) -> false
18+
19+
private
20+
21+
def subscribe_log_entry: () -> false
22+
23+
def unsubscribe_log_entry: () -> false
24+
end
25+
end
26+
end
27+
end
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module Selenium
2+
module WebDriver
3+
class BiDi
4+
class Struct < ::Struct
5+
def self.new: (*untyped args) { (?) -> untyped } -> void
6+
7+
def self.camel_to_snake: (String camel_str) -> String
8+
end
9+
end
10+
end
11+
end
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module Selenium
2+
module WebDriver
3+
module Remote
4+
class BiDiBridge < Bridge
5+
@bidi: untyped
6+
7+
attr_reader bidi: untyped
8+
9+
def create_session: (Hash[Symbol, String] capabilities) -> BiDi
10+
11+
def quit: () -> nil
12+
13+
def close: () -> nil
14+
end
15+
end
16+
end
17+
end

rb/sig/lib/selenium/webdriver/remote/bridge.rbs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ module Selenium
3232

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

35+
def bidi: -> WebDriver::Error::WebDriverError
36+
3537
def cancel_fedcm_dialog: -> nil
3638

3739
def click_fedcm_dialog_button: -> nil
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module Selenium
2+
module WebDriver
3+
module Remote
4+
class Bridge
5+
class LocatorConverter
6+
ESCAPE_CSS_REGEXP: Regexp
7+
8+
UNICODE_CODE_POINT: Integer
9+
10+
def convert: (String | Symbol how, String what) -> Array[String]
11+
12+
private
13+
14+
def escape_css: (String string) -> String
15+
end
16+
end
17+
end
18+
end
19+
end

0 commit comments

Comments
 (0)