puppeteer-bidi 0.0.1.beta1 → 0.0.1.beta2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CLAUDE.md +44 -0
- data/README.md +8 -1
- data/Steepfile +36 -0
- data/lib/puppeteer/bidi/async_utils.rb +1 -0
- data/lib/puppeteer/bidi/browser.rb +43 -24
- data/lib/puppeteer/bidi/browser_context.rb +13 -4
- data/lib/puppeteer/bidi/browser_launcher.rb +1 -0
- data/lib/puppeteer/bidi/connection.rb +26 -9
- data/lib/puppeteer/bidi/core/browser.rb +15 -14
- data/lib/puppeteer/bidi/core/browsing_context.rb +64 -46
- data/lib/puppeteer/bidi/core/disposable.rb +10 -3
- data/lib/puppeteer/bidi/core/errors.rb +18 -1
- data/lib/puppeteer/bidi/core/event_emitter.rb +18 -9
- data/lib/puppeteer/bidi/core/navigation.rb +4 -3
- data/lib/puppeteer/bidi/core/realm.rb +29 -26
- data/lib/puppeteer/bidi/core/request.rb +33 -29
- data/lib/puppeteer/bidi/core/session.rb +14 -11
- data/lib/puppeteer/bidi/core/user_context.rb +17 -16
- data/lib/puppeteer/bidi/core/user_prompt.rb +8 -7
- data/lib/puppeteer/bidi/core.rb +1 -0
- data/lib/puppeteer/bidi/deserializer.rb +1 -0
- data/lib/puppeteer/bidi/element_handle.rb +52 -52
- data/lib/puppeteer/bidi/errors.rb +1 -0
- data/lib/puppeteer/bidi/file_chooser.rb +1 -0
- data/lib/puppeteer/bidi/frame.rb +70 -70
- data/lib/puppeteer/bidi/http_response.rb +1 -0
- data/lib/puppeteer/bidi/injected_source.rb +1 -0
- data/lib/puppeteer/bidi/js_handle.rb +23 -23
- data/lib/puppeteer/bidi/keyboard.rb +24 -13
- data/lib/puppeteer/bidi/lazy_arg.rb +1 -0
- data/lib/puppeteer/bidi/mouse.rb +31 -18
- data/lib/puppeteer/bidi/page.rb +87 -87
- data/lib/puppeteer/bidi/query_handler.rb +3 -0
- data/lib/puppeteer/bidi/realm.rb +70 -6
- data/lib/puppeteer/bidi/serializer.rb +1 -0
- data/lib/puppeteer/bidi/target.rb +27 -0
- data/lib/puppeteer/bidi/timeout_settings.rb +1 -0
- data/lib/puppeteer/bidi/transport.rb +1 -0
- data/lib/puppeteer/bidi/version.rb +1 -1
- data/lib/puppeteer/bidi/wait_task.rb +1 -0
- data/lib/puppeteer/bidi.rb +13 -4
- data/sig/_external.rbs +134 -0
- data/sig/_supplementary.rbs +20 -0
- data/sig/puppeteer/bidi/async_utils.rbs +68 -0
- data/sig/puppeteer/bidi/browser.rbs +34 -27
- data/sig/puppeteer/bidi/browser_context.rbs +39 -0
- data/sig/puppeteer/bidi/browser_launcher.rbs +45 -0
- data/sig/puppeteer/bidi/connection.rbs +67 -0
- data/sig/puppeteer/bidi/core/browser.rbs +79 -0
- data/sig/puppeteer/bidi/core/browsing_context.rbs +210 -0
- data/sig/puppeteer/bidi/core/disposable.rbs +42 -0
- data/sig/puppeteer/bidi/core/errors.rbs +65 -0
- data/sig/puppeteer/bidi/core/event_emitter.rbs +50 -0
- data/sig/puppeteer/bidi/core/navigation.rbs +37 -0
- data/sig/puppeteer/bidi/core/realm.rbs +132 -0
- data/sig/puppeteer/bidi/core/request.rbs +120 -0
- data/sig/puppeteer/bidi/core/session.rbs +65 -0
- data/sig/puppeteer/bidi/core/user_context.rbs +72 -0
- data/sig/puppeteer/bidi/core/user_prompt.rbs +52 -0
- data/sig/puppeteer/bidi/core.rbs +9 -0
- data/sig/puppeteer/bidi/deserializer.rbs +28 -0
- data/sig/puppeteer/bidi/element_handle.rbs +52 -52
- data/sig/puppeteer/bidi/errors.rbs +34 -0
- data/sig/puppeteer/bidi/file_chooser.rbs +27 -0
- data/sig/puppeteer/bidi/frame.rbs +70 -70
- data/sig/puppeteer/bidi/http_response.rbs +18 -0
- data/sig/puppeteer/bidi/injected_source.rbs +21 -0
- data/sig/puppeteer/bidi/js_handle.rbs +23 -23
- data/sig/puppeteer/bidi/keyboard.rbs +57 -0
- data/sig/puppeteer/bidi/lazy_arg.rbs +15 -0
- data/sig/puppeteer/bidi/mouse.rbs +73 -0
- data/sig/puppeteer/bidi/page.rbs +87 -87
- data/sig/puppeteer/bidi/query_handler.rbs +113 -0
- data/sig/puppeteer/bidi/realm.rbs +141 -0
- data/sig/puppeteer/bidi/serializer.rbs +31 -0
- data/sig/puppeteer/bidi/target.rbs +68 -0
- data/sig/puppeteer/bidi/timeout_settings.rbs +14 -0
- data/sig/puppeteer/bidi/transport.rbs +43 -0
- data/sig/puppeteer/bidi/wait_task.rbs +62 -0
- data/sig/puppeteer/bidi.rbs +7 -5
- metadata +35 -1
|
@@ -9,171 +9,171 @@ module Puppeteer
|
|
|
9
9
|
attr_reader browsing_context: Core::BrowsingContext
|
|
10
10
|
|
|
11
11
|
# Factory method following Puppeteer's BidiFrame.from pattern
|
|
12
|
-
# @rbs parent: Page | Frame
|
|
13
|
-
# @rbs browsing_context: Core::BrowsingContext
|
|
14
|
-
# @rbs return: Frame
|
|
12
|
+
# @rbs parent: Page | Frame -- Parent page or frame
|
|
13
|
+
# @rbs browsing_context: Core::BrowsingContext -- Associated browsing context
|
|
14
|
+
# @rbs return: Frame -- New frame instance
|
|
15
15
|
def self.from: (Page | Frame parent, Core::BrowsingContext browsing_context) -> Frame
|
|
16
16
|
|
|
17
|
-
# @rbs parent: Page | Frame
|
|
18
|
-
# @rbs browsing_context: Core::BrowsingContext
|
|
17
|
+
# @rbs parent: Page | Frame -- Parent page or frame
|
|
18
|
+
# @rbs browsing_context: Core::BrowsingContext -- Associated browsing context
|
|
19
19
|
# @rbs return: void
|
|
20
20
|
def initialize: (Page | Frame parent, Core::BrowsingContext browsing_context) -> void
|
|
21
21
|
|
|
22
|
-
# @rbs return: FrameRealm
|
|
22
|
+
# @rbs return: FrameRealm -- Main execution realm
|
|
23
23
|
def main_realm: () -> FrameRealm
|
|
24
24
|
|
|
25
|
-
# @rbs return: FrameRealm
|
|
25
|
+
# @rbs return: FrameRealm -- Isolated execution realm
|
|
26
26
|
def isolated_realm: () -> FrameRealm
|
|
27
27
|
|
|
28
28
|
# Backwards compatibility for call sites that previously accessed Frame#realm.
|
|
29
|
-
# @rbs return: FrameRealm
|
|
29
|
+
# @rbs return: FrameRealm -- Main execution realm
|
|
30
30
|
def realm: () -> FrameRealm
|
|
31
31
|
|
|
32
32
|
# Get the page that owns this frame
|
|
33
33
|
# Traverses up the parent chain until reaching a Page
|
|
34
|
-
# @rbs return: Page
|
|
34
|
+
# @rbs return: Page -- Owning page
|
|
35
35
|
def page: () -> Page
|
|
36
36
|
|
|
37
37
|
# Get the parent frame
|
|
38
|
-
# @rbs return: Frame?
|
|
38
|
+
# @rbs return: Frame? -- Parent frame or nil for main frame
|
|
39
39
|
def parent_frame: () -> Frame?
|
|
40
40
|
|
|
41
41
|
# Evaluate JavaScript in the frame context
|
|
42
|
-
# @rbs script: String
|
|
43
|
-
# @rbs *args: untyped
|
|
44
|
-
# @rbs return: untyped
|
|
42
|
+
# @rbs script: String -- JavaScript code to evaluate
|
|
43
|
+
# @rbs *args: untyped -- Arguments to pass to the script
|
|
44
|
+
# @rbs return: untyped -- Evaluation result
|
|
45
45
|
def evaluate: (String script, *untyped args) -> untyped
|
|
46
46
|
|
|
47
47
|
# Evaluate JavaScript and return a handle to the result
|
|
48
|
-
# @rbs script: String
|
|
49
|
-
# @rbs *args: untyped
|
|
50
|
-
# @rbs return: JSHandle
|
|
48
|
+
# @rbs script: String -- JavaScript code to evaluate
|
|
49
|
+
# @rbs *args: untyped -- Arguments to pass to the script
|
|
50
|
+
# @rbs return: JSHandle -- Handle to the result
|
|
51
51
|
def evaluate_handle: (String script, *untyped args) -> JSHandle
|
|
52
52
|
|
|
53
53
|
# Get the document element handle
|
|
54
|
-
# @rbs return: ElementHandle
|
|
54
|
+
# @rbs return: ElementHandle -- Document element handle
|
|
55
55
|
def document: () -> ElementHandle
|
|
56
56
|
|
|
57
57
|
# Query for an element matching the selector
|
|
58
|
-
# @rbs selector: String
|
|
59
|
-
# @rbs return: ElementHandle?
|
|
58
|
+
# @rbs selector: String -- Selector to query
|
|
59
|
+
# @rbs return: ElementHandle? -- Matching element or nil
|
|
60
60
|
def query_selector: (String selector) -> ElementHandle?
|
|
61
61
|
|
|
62
62
|
# Query for all elements matching the selector
|
|
63
|
-
# @rbs selector: String
|
|
64
|
-
# @rbs return: Array[ElementHandle]
|
|
63
|
+
# @rbs selector: String -- Selector to query
|
|
64
|
+
# @rbs return: Array[ElementHandle] -- All matching elements
|
|
65
65
|
def query_selector_all: (String selector) -> Array[ElementHandle]
|
|
66
66
|
|
|
67
67
|
# Evaluate a function on the first element matching the selector
|
|
68
|
-
# @rbs selector: String
|
|
69
|
-
# @rbs page_function: String
|
|
70
|
-
# @rbs *args: untyped
|
|
71
|
-
# @rbs return: untyped
|
|
68
|
+
# @rbs selector: String -- Selector to query
|
|
69
|
+
# @rbs page_function: String -- JavaScript function to evaluate
|
|
70
|
+
# @rbs *args: untyped -- Arguments to pass to the function
|
|
71
|
+
# @rbs return: untyped -- Evaluation result
|
|
72
72
|
def eval_on_selector: (String selector, String page_function, *untyped args) -> untyped
|
|
73
73
|
|
|
74
74
|
# Evaluate a function on all elements matching the selector
|
|
75
|
-
# @rbs selector: String
|
|
76
|
-
# @rbs page_function: String
|
|
77
|
-
# @rbs *args: untyped
|
|
78
|
-
# @rbs return: untyped
|
|
75
|
+
# @rbs selector: String -- Selector to query
|
|
76
|
+
# @rbs page_function: String -- JavaScript function to evaluate
|
|
77
|
+
# @rbs *args: untyped -- Arguments to pass to the function
|
|
78
|
+
# @rbs return: untyped -- Evaluation result
|
|
79
79
|
def eval_on_selector_all: (String selector, String page_function, *untyped args) -> untyped
|
|
80
80
|
|
|
81
81
|
# Click an element matching the selector
|
|
82
|
-
# @rbs selector: String
|
|
83
|
-
# @rbs button: String
|
|
84
|
-
# @rbs count: Integer
|
|
85
|
-
# @rbs delay: Numeric?
|
|
86
|
-
# @rbs offset: Hash[Symbol, Numeric]?
|
|
82
|
+
# @rbs selector: String -- Selector to click
|
|
83
|
+
# @rbs button: String -- Mouse button ('left', 'right', 'middle')
|
|
84
|
+
# @rbs count: Integer -- Number of clicks
|
|
85
|
+
# @rbs delay: Numeric? -- Delay between clicks in ms
|
|
86
|
+
# @rbs offset: Hash[Symbol, Numeric]? -- Click offset from element center
|
|
87
87
|
# @rbs return: void
|
|
88
88
|
def click: (String selector, ?button: String, ?count: Integer, ?delay: Numeric?, ?offset: Hash[Symbol, Numeric]?) -> void
|
|
89
89
|
|
|
90
90
|
# Type text into an element matching the selector
|
|
91
|
-
# @rbs selector: String
|
|
92
|
-
# @rbs text: String
|
|
93
|
-
# @rbs delay: Numeric
|
|
91
|
+
# @rbs selector: String -- Selector to type into
|
|
92
|
+
# @rbs text: String -- Text to type
|
|
93
|
+
# @rbs delay: Numeric -- Delay between key presses in ms
|
|
94
94
|
# @rbs return: void
|
|
95
95
|
def type: (String selector, String text, ?delay: Numeric) -> void
|
|
96
96
|
|
|
97
97
|
# Hover over an element matching the selector
|
|
98
|
-
# @rbs selector: String
|
|
98
|
+
# @rbs selector: String -- Selector to hover
|
|
99
99
|
# @rbs return: void
|
|
100
100
|
def hover: (String selector) -> void
|
|
101
101
|
|
|
102
102
|
# Get the frame URL
|
|
103
|
-
# @rbs return: String
|
|
103
|
+
# @rbs return: String -- Current URL
|
|
104
104
|
def url: () -> String
|
|
105
105
|
|
|
106
106
|
# Navigate to a URL
|
|
107
|
-
# @rbs url: String
|
|
108
|
-
# @rbs wait_until: String
|
|
109
|
-
# @rbs timeout: Numeric
|
|
110
|
-
# @rbs return: HTTPResponse?
|
|
107
|
+
# @rbs url: String -- URL to navigate to
|
|
108
|
+
# @rbs wait_until: String -- When to consider navigation complete ('load', 'domcontentloaded')
|
|
109
|
+
# @rbs timeout: Numeric -- Navigation timeout in ms
|
|
110
|
+
# @rbs return: HTTPResponse? -- Response or nil
|
|
111
111
|
def goto: (String url, ?wait_until: String, ?timeout: Numeric) -> HTTPResponse?
|
|
112
112
|
|
|
113
113
|
# Set frame content
|
|
114
|
-
# @rbs html: String
|
|
115
|
-
# @rbs wait_until: String
|
|
114
|
+
# @rbs html: String -- HTML content to set
|
|
115
|
+
# @rbs wait_until: String -- When to consider content set ('load', 'domcontentloaded')
|
|
116
116
|
# @rbs return: void
|
|
117
117
|
def set_content: (String html, ?wait_until: String) -> void
|
|
118
118
|
|
|
119
119
|
# Set frame content using document.open/write/close
|
|
120
120
|
# This is a low-level method that doesn't wait for load events
|
|
121
|
-
# @rbs content: String
|
|
121
|
+
# @rbs content: String -- HTML content to set
|
|
122
122
|
# @rbs return: void
|
|
123
123
|
def set_frame_content: (String content) -> void
|
|
124
124
|
|
|
125
125
|
# Get the frame name
|
|
126
|
-
# @rbs return: String
|
|
126
|
+
# @rbs return: String -- Frame name
|
|
127
127
|
def name: () -> String
|
|
128
128
|
|
|
129
129
|
# Check if frame is detached
|
|
130
|
-
# @rbs return: bool
|
|
130
|
+
# @rbs return: bool -- Whether frame is detached
|
|
131
131
|
def detached?: () -> bool
|
|
132
132
|
|
|
133
133
|
# Get child frames
|
|
134
134
|
# Returns cached frame instances following Puppeteer's pattern
|
|
135
|
-
# @rbs return: Array[Frame]
|
|
135
|
+
# @rbs return: Array[Frame] -- Child frames
|
|
136
136
|
def child_frames: () -> Array[Frame]
|
|
137
137
|
|
|
138
138
|
# Get the frame element (iframe/frame DOM element) for this frame
|
|
139
139
|
# Returns nil for the main frame
|
|
140
140
|
# Following Puppeteer's Frame.frameElement() implementation exactly
|
|
141
|
-
# @rbs return: ElementHandle?
|
|
141
|
+
# @rbs return: ElementHandle? -- Frame element or nil for main frame
|
|
142
142
|
def frame_element: () -> ElementHandle?
|
|
143
143
|
|
|
144
144
|
# Wait for navigation to complete
|
|
145
|
-
# @rbs timeout: Numeric
|
|
146
|
-
# @rbs wait_until: String | Array[String]
|
|
147
|
-
# @rbs &block: (-> void)?
|
|
148
|
-
# @rbs return: HTTPResponse?
|
|
145
|
+
# @rbs timeout: Numeric -- Navigation timeout in ms
|
|
146
|
+
# @rbs wait_until: String | Array[String] -- When to consider navigation complete
|
|
147
|
+
# @rbs &block: (-> void)? -- Optional block to trigger navigation
|
|
148
|
+
# @rbs return: HTTPResponse? -- Response or nil
|
|
149
149
|
def wait_for_navigation: (?timeout: Numeric, ?wait_until: String | Array[String]) ?{ (?) -> untyped } -> HTTPResponse?
|
|
150
150
|
|
|
151
151
|
# Wait for a function to return a truthy value
|
|
152
|
-
# @rbs page_function: String
|
|
153
|
-
# @rbs options: Hash[Symbol, untyped]
|
|
154
|
-
# @rbs *args: untyped
|
|
155
|
-
# @rbs &block: ((JSHandle) -> void)?
|
|
156
|
-
# @rbs return: JSHandle
|
|
152
|
+
# @rbs page_function: String -- JavaScript function to evaluate
|
|
153
|
+
# @rbs options: Hash[Symbol, untyped] -- Wait options (timeout, polling)
|
|
154
|
+
# @rbs *args: untyped -- Arguments to pass to the function
|
|
155
|
+
# @rbs &block: ((JSHandle) -> void)? -- Optional block called with result
|
|
156
|
+
# @rbs return: JSHandle -- Handle to the truthy result
|
|
157
157
|
def wait_for_function: (String page_function, ?Hash[Symbol, untyped] options, *untyped args) ?{ (?) -> untyped } -> JSHandle
|
|
158
158
|
|
|
159
159
|
# Wait for an element matching the selector to appear in the frame
|
|
160
|
-
# @rbs selector: String
|
|
161
|
-
# @rbs visible: bool?
|
|
162
|
-
# @rbs hidden: bool?
|
|
163
|
-
# @rbs timeout: Numeric?
|
|
164
|
-
# @rbs &block: ((ElementHandle?) -> void)?
|
|
165
|
-
# @rbs return: ElementHandle?
|
|
160
|
+
# @rbs selector: String -- Selector to wait for
|
|
161
|
+
# @rbs visible: bool? -- Wait for element to be visible
|
|
162
|
+
# @rbs hidden: bool? -- Wait for element to be hidden
|
|
163
|
+
# @rbs timeout: Numeric? -- Wait timeout in ms
|
|
164
|
+
# @rbs &block: ((ElementHandle?) -> void)? -- Optional block called with element
|
|
165
|
+
# @rbs return: ElementHandle? -- Element or nil if hidden
|
|
166
166
|
def wait_for_selector: (String selector, ?visible: bool?, ?hidden: bool?, ?timeout: Numeric?) ?{ (?) -> untyped } -> ElementHandle?
|
|
167
167
|
|
|
168
168
|
# Set files on an input element
|
|
169
|
-
# @rbs element: ElementHandle
|
|
170
|
-
# @rbs files: Array[String]
|
|
169
|
+
# @rbs element: ElementHandle -- Input element
|
|
170
|
+
# @rbs files: Array[String] -- File paths to set
|
|
171
171
|
# @rbs return: void
|
|
172
172
|
def set_files: (ElementHandle element, Array[String] files) -> void
|
|
173
173
|
|
|
174
174
|
# Get the frame ID (browsing context ID)
|
|
175
175
|
# Following Puppeteer's _id pattern
|
|
176
|
-
# @rbs return: String
|
|
176
|
+
# @rbs return: String -- Frame ID
|
|
177
177
|
def _id: () -> String
|
|
178
178
|
|
|
179
179
|
private
|
|
@@ -193,8 +193,8 @@ module Puppeteer
|
|
|
193
193
|
# });
|
|
194
194
|
# Note: FrameDetached is NOT emitted here - it's emitted in #initialize
|
|
195
195
|
# when the frame's own browsing context closes
|
|
196
|
-
# @rbs browsing_context: Core::BrowsingContext
|
|
197
|
-
# @rbs return: Frame
|
|
196
|
+
# @rbs browsing_context: Core::BrowsingContext -- Child browsing context
|
|
197
|
+
# @rbs return: Frame -- New child frame
|
|
198
198
|
def create_frame_target: (Core::BrowsingContext browsing_context) -> Frame
|
|
199
199
|
|
|
200
200
|
# Check if this frame is detached and raise error if so
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Generated from lib/puppeteer/bidi/http_response.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Puppeteer
|
|
4
|
+
module Bidi
|
|
5
|
+
# HTTPResponse represents a response to an HTTP request
|
|
6
|
+
class HTTPResponse
|
|
7
|
+
attr_reader url: untyped
|
|
8
|
+
|
|
9
|
+
# @param url [String] Response URL
|
|
10
|
+
# @param status [Integer] HTTP status code
|
|
11
|
+
def initialize: (url: untyped, ?status: untyped) -> untyped
|
|
12
|
+
|
|
13
|
+
# Check if the response was successful (status code 200-299)
|
|
14
|
+
# @return [Boolean] True if status code is in 2xx range
|
|
15
|
+
def ok?: () -> untyped
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Generated from lib/puppeteer/bidi/injected_source.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Puppeteer
|
|
4
|
+
module Bidi
|
|
5
|
+
# Puppeteer's injected utilities (Poller classes, Deferred, etc.)
|
|
6
|
+
# Source: https://unpkg.com/puppeteer-core@24.31.0/lib/esm/puppeteer/generated/injected.js
|
|
7
|
+
# Version: puppeteer-core@24.31.0
|
|
8
|
+
#
|
|
9
|
+
# To update this file, run:
|
|
10
|
+
# bundle exec ruby scripts/update_injected_source.rb
|
|
11
|
+
#
|
|
12
|
+
# This script provides:
|
|
13
|
+
# - RAFPoller: requestAnimationFrame-based polling
|
|
14
|
+
# - MutationPoller: MutationObserver-based polling
|
|
15
|
+
# - IntervalPoller: setInterval-based polling
|
|
16
|
+
# - Deferred: Promise wrapper
|
|
17
|
+
# - createFunction: Creates function from string
|
|
18
|
+
# - Various query selector utilities
|
|
19
|
+
PUPPETEER_INJECTED_SOURCE: untyped
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -7,27 +7,27 @@ module Puppeteer
|
|
|
7
7
|
class JSHandle
|
|
8
8
|
attr_reader realm: Core::Realm
|
|
9
9
|
|
|
10
|
-
# @rbs remote_value: Hash[String, untyped]
|
|
11
|
-
# @rbs realm: Core::Realm
|
|
10
|
+
# @rbs remote_value: Hash[String, untyped] -- BiDi RemoteValue
|
|
11
|
+
# @rbs realm: Core::Realm -- Associated realm
|
|
12
12
|
# @rbs return: void
|
|
13
13
|
def initialize: (Core::Realm realm, Hash[String, untyped] remote_value) -> void
|
|
14
14
|
|
|
15
15
|
# Factory method to create JSHandle from remote value
|
|
16
|
-
# @rbs remote_value: Hash[String, untyped]
|
|
17
|
-
# @rbs realm: Core::Realm
|
|
18
|
-
# @rbs return: JSHandle | ElementHandle
|
|
16
|
+
# @rbs remote_value: Hash[String, untyped] -- BiDi RemoteValue
|
|
17
|
+
# @rbs realm: Core::Realm -- Associated realm
|
|
18
|
+
# @rbs return: JSHandle | ElementHandle -- JSHandle or ElementHandle instance
|
|
19
19
|
def self.from: (Hash[String, untyped] remote_value, Core::Realm realm) -> (JSHandle | ElementHandle)
|
|
20
20
|
|
|
21
21
|
# Get the remote value (BiDi Script.RemoteValue)
|
|
22
|
-
# @rbs return: Hash[String, untyped]
|
|
22
|
+
# @rbs return: Hash[String, untyped] -- BiDi RemoteValue
|
|
23
23
|
def remote_value: () -> Hash[String, untyped]
|
|
24
24
|
|
|
25
25
|
# Get the remote object (alias for remote_value)
|
|
26
|
-
# @rbs return: Hash[String, untyped]
|
|
26
|
+
# @rbs return: Hash[String, untyped] -- BiDi RemoteValue
|
|
27
27
|
def remote_object: () -> Hash[String, untyped]
|
|
28
28
|
|
|
29
29
|
# Check if handle has been disposed
|
|
30
|
-
# @rbs return: bool
|
|
30
|
+
# @rbs return: bool -- Whether handle is disposed
|
|
31
31
|
def disposed?: () -> bool
|
|
32
32
|
|
|
33
33
|
# Dispose this handle by releasing the remote object
|
|
@@ -35,44 +35,44 @@ module Puppeteer
|
|
|
35
35
|
def dispose: () -> void
|
|
36
36
|
|
|
37
37
|
# Get the handle ID (handle or sharedId)
|
|
38
|
-
# @rbs return: String?
|
|
38
|
+
# @rbs return: String? -- Handle ID or nil
|
|
39
39
|
def id: () -> String?
|
|
40
40
|
|
|
41
41
|
# Evaluate JavaScript function with this handle as the first argument
|
|
42
|
-
# @rbs script: String
|
|
43
|
-
# @rbs *args: untyped
|
|
44
|
-
# @rbs return: untyped
|
|
42
|
+
# @rbs script: String -- JavaScript code to evaluate
|
|
43
|
+
# @rbs *args: untyped -- Arguments to pass to the script
|
|
44
|
+
# @rbs return: untyped -- Evaluation result
|
|
45
45
|
def evaluate: (String script, *untyped args) -> untyped
|
|
46
46
|
|
|
47
47
|
# Evaluate JavaScript function and return a handle to the result
|
|
48
|
-
# @rbs script: String
|
|
49
|
-
# @rbs *args: untyped
|
|
50
|
-
# @rbs return: JSHandle
|
|
48
|
+
# @rbs script: String -- JavaScript code to evaluate
|
|
49
|
+
# @rbs *args: untyped -- Arguments to pass to the script
|
|
50
|
+
# @rbs return: JSHandle -- Handle to the result
|
|
51
51
|
def evaluate_handle: (String script, *untyped args) -> JSHandle
|
|
52
52
|
|
|
53
53
|
# Get a property of the object
|
|
54
|
-
# @rbs property_name: String
|
|
55
|
-
# @rbs return: JSHandle
|
|
54
|
+
# @rbs property_name: String -- Property name to get
|
|
55
|
+
# @rbs return: JSHandle -- Handle to the property value
|
|
56
56
|
def get_property: (String property_name) -> JSHandle
|
|
57
57
|
|
|
58
58
|
# Get all properties of the object
|
|
59
|
-
# @rbs return: Hash[String, JSHandle]
|
|
59
|
+
# @rbs return: Hash[String, JSHandle] -- Map of property names to handles
|
|
60
60
|
def get_properties: () -> Hash[String, JSHandle]
|
|
61
61
|
|
|
62
62
|
# Convert this handle to a JSON-serializable value
|
|
63
|
-
# @rbs return: untyped
|
|
63
|
+
# @rbs return: untyped -- JSON-serializable value
|
|
64
64
|
def json_value: () -> untyped
|
|
65
65
|
|
|
66
66
|
# Convert to ElementHandle if this is an element
|
|
67
|
-
# @rbs return: ElementHandle?
|
|
67
|
+
# @rbs return: ElementHandle? -- ElementHandle or nil if not an element
|
|
68
68
|
def as_element: () -> ElementHandle?
|
|
69
69
|
|
|
70
70
|
# Check if this is a primitive value
|
|
71
|
-
# @rbs return: bool
|
|
71
|
+
# @rbs return: bool -- Whether this is a primitive value
|
|
72
72
|
def primitive_value?: () -> bool
|
|
73
73
|
|
|
74
74
|
# String representation of this handle
|
|
75
|
-
# @rbs return: String
|
|
75
|
+
# @rbs return: String -- String representation
|
|
76
76
|
def to_s: () -> String
|
|
77
77
|
|
|
78
78
|
private
|
|
@@ -82,7 +82,7 @@ module Puppeteer
|
|
|
82
82
|
def assert_not_disposed: () -> void
|
|
83
83
|
|
|
84
84
|
# Handle evaluation exceptions
|
|
85
|
-
# @rbs result: Hash[String, untyped]
|
|
85
|
+
# @rbs result: Hash[String, untyped] -- Evaluation result containing exception
|
|
86
86
|
# @rbs return: void
|
|
87
87
|
def handle_evaluation_exception: (Hash[String, untyped] result) -> void
|
|
88
88
|
end
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Generated from lib/puppeteer/bidi/keyboard.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Puppeteer
|
|
4
|
+
module Bidi
|
|
5
|
+
# Keyboard class for keyboard input operations
|
|
6
|
+
# Based on Puppeteer's BidiKeyboard implementation
|
|
7
|
+
class Keyboard
|
|
8
|
+
# @rbs page: Page -- Page instance
|
|
9
|
+
# @rbs browsing_context: Core::BrowsingContext -- Browsing context
|
|
10
|
+
# @rbs return: void
|
|
11
|
+
def initialize: (Page page, Core::BrowsingContext browsing_context) -> void
|
|
12
|
+
|
|
13
|
+
# Press key down
|
|
14
|
+
# @rbs key: String -- Key name (e.g., 'a', 'Enter', 'ArrowLeft')
|
|
15
|
+
# @rbs text: String? -- Text to insert (for CDP compatibility, not used in BiDi)
|
|
16
|
+
# @rbs commands: Array[String]? -- Commands to trigger (for CDP compatibility, not used in BiDi)
|
|
17
|
+
# @rbs return: void
|
|
18
|
+
def down: (String key, ?text: String?, ?commands: Array[String]?) -> void
|
|
19
|
+
|
|
20
|
+
# Release key
|
|
21
|
+
# @rbs key: String -- Key name
|
|
22
|
+
# @rbs return: void
|
|
23
|
+
def up: (String key) -> void
|
|
24
|
+
|
|
25
|
+
# Press and release a key
|
|
26
|
+
# @rbs key: String -- Key name
|
|
27
|
+
# @rbs delay: Numeric? -- Delay between keydown and keyup in milliseconds
|
|
28
|
+
# @rbs text: String? -- Text to insert (for CDP compatibility, not used in BiDi)
|
|
29
|
+
# @rbs commands: Array[String]? -- Commands to trigger (for CDP compatibility, not used in BiDi)
|
|
30
|
+
# @rbs return: void
|
|
31
|
+
def press: (String key, ?delay: Numeric?, ?text: String?, ?commands: Array[String]?) -> void
|
|
32
|
+
|
|
33
|
+
# Type text (types each character with keydown/keyup events)
|
|
34
|
+
# @rbs text: String -- Text to type
|
|
35
|
+
# @rbs delay: Numeric -- Delay between each character in milliseconds
|
|
36
|
+
# @rbs return: void
|
|
37
|
+
def type: (String text, ?delay: Numeric) -> void
|
|
38
|
+
|
|
39
|
+
# Send character directly (bypasses keyboard events, uses execCommand)
|
|
40
|
+
# @rbs char: String -- Character to send
|
|
41
|
+
# @rbs return: void
|
|
42
|
+
def send_character: (String char) -> void
|
|
43
|
+
|
|
44
|
+
private
|
|
45
|
+
|
|
46
|
+
# Convert key name to BiDi protocol value
|
|
47
|
+
# @rbs key: String -- Key name
|
|
48
|
+
# @rbs return: String -- BiDi key value (Unicode character or escape sequence)
|
|
49
|
+
def get_bidi_key_value: (String key) -> String
|
|
50
|
+
|
|
51
|
+
# Perform input actions via BiDi
|
|
52
|
+
# @rbs action_list: Array[Hash[Symbol, untyped]] -- List of key actions
|
|
53
|
+
# @rbs return: void
|
|
54
|
+
def perform_actions: (Array[Hash[Symbol, untyped]] action_list) -> void
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Generated from lib/puppeteer/bidi/lazy_arg.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Puppeteer
|
|
4
|
+
module Bidi
|
|
5
|
+
# LazyArg defers evaluation of expensive arguments (e.g., handles) until
|
|
6
|
+
# serialization time. Mirrors Puppeteer's LazyArg helper.
|
|
7
|
+
class LazyArg
|
|
8
|
+
def self.create: () ?{ (?) -> untyped } -> untyped
|
|
9
|
+
|
|
10
|
+
def initialize: () ?{ (?) -> untyped } -> untyped
|
|
11
|
+
|
|
12
|
+
def resolve: () -> untyped
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Generated from lib/puppeteer/bidi/mouse.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Puppeteer
|
|
4
|
+
module Bidi
|
|
5
|
+
# Mouse class for mouse input operations
|
|
6
|
+
# Based on Puppeteer's BidiMouse implementation
|
|
7
|
+
class Mouse
|
|
8
|
+
# Mouse button constants
|
|
9
|
+
LEFT: String
|
|
10
|
+
|
|
11
|
+
RIGHT: String
|
|
12
|
+
|
|
13
|
+
MIDDLE: String
|
|
14
|
+
|
|
15
|
+
BACK: String
|
|
16
|
+
|
|
17
|
+
FORWARD: String
|
|
18
|
+
|
|
19
|
+
# @rbs browsing_context: Core::BrowsingContext -- Browsing context
|
|
20
|
+
# @rbs return: void
|
|
21
|
+
def initialize: (Core::BrowsingContext browsing_context) -> void
|
|
22
|
+
|
|
23
|
+
# Move mouse to coordinates
|
|
24
|
+
# @rbs x: Numeric -- X coordinate
|
|
25
|
+
# @rbs y: Numeric -- Y coordinate
|
|
26
|
+
# @rbs steps: Integer -- Number of intermediate steps (for smooth movement)
|
|
27
|
+
# @rbs return: void
|
|
28
|
+
def move: (Numeric x, Numeric y, ?steps: Integer) -> void
|
|
29
|
+
|
|
30
|
+
# Press mouse button down
|
|
31
|
+
# @rbs button: String -- Mouse button ('left', 'right', 'middle', 'back', 'forward')
|
|
32
|
+
# @rbs return: void
|
|
33
|
+
def down: (?button: String) -> void
|
|
34
|
+
|
|
35
|
+
# Release mouse button
|
|
36
|
+
# @rbs button: String -- Mouse button
|
|
37
|
+
# @rbs return: void
|
|
38
|
+
def up: (?button: String) -> void
|
|
39
|
+
|
|
40
|
+
# Click at coordinates
|
|
41
|
+
# @rbs x: Numeric -- X coordinate
|
|
42
|
+
# @rbs y: Numeric -- Y coordinate
|
|
43
|
+
# @rbs button: String -- Mouse button
|
|
44
|
+
# @rbs count: Integer -- Number of clicks (1 for single, 2 for double, 3 for triple)
|
|
45
|
+
# @rbs delay: Numeric? -- Delay between down and up in milliseconds
|
|
46
|
+
# @rbs return: void
|
|
47
|
+
def click: (Numeric x, Numeric y, ?button: String, ?count: Integer, ?delay: Numeric?) -> void
|
|
48
|
+
|
|
49
|
+
# Scroll using mouse wheel
|
|
50
|
+
# @rbs delta_x: Numeric -- Horizontal scroll amount
|
|
51
|
+
# @rbs delta_y: Numeric -- Vertical scroll amount
|
|
52
|
+
# @rbs return: void
|
|
53
|
+
def wheel: (?delta_x: Numeric, ?delta_y: Numeric) -> void
|
|
54
|
+
|
|
55
|
+
# Reset mouse state
|
|
56
|
+
# Resets position to origin and releases all pressed buttons
|
|
57
|
+
# @rbs return: void
|
|
58
|
+
def reset: () -> void
|
|
59
|
+
|
|
60
|
+
private
|
|
61
|
+
|
|
62
|
+
# Convert mouse button name to BiDi button number
|
|
63
|
+
# @rbs button: String -- Mouse button name
|
|
64
|
+
# @rbs return: Integer -- BiDi button number
|
|
65
|
+
def button_to_bidi: (String button) -> Integer
|
|
66
|
+
|
|
67
|
+
# Perform input actions via BiDi
|
|
68
|
+
# @rbs action_list: Array[Hash[Symbol, untyped]] -- List of pointer actions
|
|
69
|
+
# @rbs return: void
|
|
70
|
+
def perform_actions: (Array[Hash[Symbol, untyped]] action_list) -> void
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|