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
data/sig/puppeteer/bidi/page.rbs
CHANGED
|
@@ -13,124 +13,124 @@ module Puppeteer
|
|
|
13
13
|
|
|
14
14
|
attr_reader timeout_settings: TimeoutSettings
|
|
15
15
|
|
|
16
|
-
# @rbs browser_context: BrowserContext
|
|
17
|
-
# @rbs browsing_context: Core::BrowsingContext
|
|
16
|
+
# @rbs browser_context: BrowserContext -- Parent browser context
|
|
17
|
+
# @rbs browsing_context: Core::BrowsingContext -- Associated browsing context
|
|
18
18
|
# @rbs return: void
|
|
19
19
|
def initialize: (BrowserContext browser_context, Core::BrowsingContext browsing_context) -> void
|
|
20
20
|
|
|
21
21
|
# Register an event listener
|
|
22
|
-
# @rbs event: Symbol | String
|
|
23
|
-
# @rbs &block: (untyped) -> void
|
|
22
|
+
# @rbs event: Symbol | String -- Event name
|
|
23
|
+
# @rbs &block: (untyped) -> void -- Event handler
|
|
24
24
|
# @rbs return: void
|
|
25
25
|
def on: (Symbol | String event) { (untyped) -> void } -> void
|
|
26
26
|
|
|
27
27
|
# Register a one-time event listener
|
|
28
|
-
# @rbs event: Symbol | String
|
|
29
|
-
# @rbs &block: (untyped) -> void
|
|
28
|
+
# @rbs event: Symbol | String -- Event name
|
|
29
|
+
# @rbs &block: (untyped) -> void -- Event handler
|
|
30
30
|
# @rbs return: void
|
|
31
31
|
def once: (Symbol | String event) { (untyped) -> void } -> void
|
|
32
32
|
|
|
33
33
|
# Remove an event listener
|
|
34
|
-
# @rbs event: Symbol | String
|
|
35
|
-
# @rbs &block: (untyped) -> void
|
|
34
|
+
# @rbs event: Symbol | String -- Event name
|
|
35
|
+
# @rbs &block: (untyped) -> void -- Event handler to remove
|
|
36
36
|
# @rbs return: void
|
|
37
37
|
def off: (Symbol | String event) { (untyped) -> void } -> void
|
|
38
38
|
|
|
39
39
|
# Emit an event to all registered listeners
|
|
40
|
-
# @rbs event: Symbol | String
|
|
41
|
-
# @rbs data: untyped
|
|
40
|
+
# @rbs event: Symbol | String -- Event name
|
|
41
|
+
# @rbs data: untyped -- Event data
|
|
42
42
|
# @rbs return: void
|
|
43
43
|
def emit: (Symbol | String event, ?untyped data) -> void
|
|
44
44
|
|
|
45
45
|
# Navigate to a URL
|
|
46
|
-
# @rbs url: String
|
|
47
|
-
# @rbs wait_until: String
|
|
48
|
-
# @rbs return: HTTPResponse?
|
|
46
|
+
# @rbs url: String -- URL to navigate to
|
|
47
|
+
# @rbs wait_until: String -- When to consider navigation complete ('load', 'domcontentloaded')
|
|
48
|
+
# @rbs return: HTTPResponse? -- Main response
|
|
49
49
|
def goto: (String url, ?wait_until: String) -> HTTPResponse?
|
|
50
50
|
|
|
51
51
|
# Set page content
|
|
52
|
-
# @rbs html: String
|
|
53
|
-
# @rbs wait_until: String
|
|
52
|
+
# @rbs html: String -- HTML content to set
|
|
53
|
+
# @rbs wait_until: String -- When to consider content set ('load', 'domcontentloaded')
|
|
54
54
|
# @rbs return: void
|
|
55
55
|
def set_content: (String html, ?wait_until: String) -> void
|
|
56
56
|
|
|
57
57
|
# Take a screenshot
|
|
58
|
-
# @rbs path: String?
|
|
59
|
-
# @rbs type: String
|
|
60
|
-
# @rbs full_page: bool
|
|
61
|
-
# @rbs clip: Hash[Symbol, Numeric]?
|
|
62
|
-
# @rbs capture_beyond_viewport: bool
|
|
63
|
-
# @rbs return: String
|
|
58
|
+
# @rbs path: String? -- File path to save screenshot
|
|
59
|
+
# @rbs type: String -- Image type ('png' or 'jpeg')
|
|
60
|
+
# @rbs full_page: bool -- Capture full page
|
|
61
|
+
# @rbs clip: Hash[Symbol, Numeric]? -- Clip region
|
|
62
|
+
# @rbs capture_beyond_viewport: bool -- Capture beyond viewport
|
|
63
|
+
# @rbs return: String -- Base64-encoded image data
|
|
64
64
|
def screenshot: (?path: String?, ?type: String, ?full_page: bool, ?clip: Hash[Symbol, Numeric]?, ?capture_beyond_viewport: bool) -> String
|
|
65
65
|
|
|
66
66
|
# Evaluate JavaScript in the page context
|
|
67
|
-
# @rbs script: String
|
|
68
|
-
# @rbs *args: untyped
|
|
69
|
-
# @rbs return: untyped
|
|
67
|
+
# @rbs script: String -- JavaScript code to evaluate
|
|
68
|
+
# @rbs *args: untyped -- Arguments to pass to the script
|
|
69
|
+
# @rbs return: untyped -- Result of evaluation
|
|
70
70
|
def evaluate: (String script, *untyped args) -> untyped
|
|
71
71
|
|
|
72
72
|
# Evaluate JavaScript and return a handle to the result
|
|
73
|
-
# @rbs script: String
|
|
74
|
-
# @rbs *args: untyped
|
|
75
|
-
# @rbs return: JSHandle
|
|
73
|
+
# @rbs script: String -- JavaScript code to evaluate
|
|
74
|
+
# @rbs *args: untyped -- Arguments to pass to the script
|
|
75
|
+
# @rbs return: JSHandle -- Handle to the result
|
|
76
76
|
def evaluate_handle: (String script, *untyped args) -> JSHandle
|
|
77
77
|
|
|
78
78
|
# Query for an element matching the selector
|
|
79
|
-
# @rbs selector: String
|
|
80
|
-
# @rbs return: ElementHandle?
|
|
79
|
+
# @rbs selector: String -- Selector to query
|
|
80
|
+
# @rbs return: ElementHandle? -- Matching element or nil
|
|
81
81
|
def query_selector: (String selector) -> ElementHandle?
|
|
82
82
|
|
|
83
83
|
# Query for all elements matching the selector
|
|
84
|
-
# @rbs selector: String
|
|
85
|
-
# @rbs return: Array[ElementHandle]
|
|
84
|
+
# @rbs selector: String -- Selector to query
|
|
85
|
+
# @rbs return: Array[ElementHandle] -- All matching elements
|
|
86
86
|
def query_selector_all: (String selector) -> Array[ElementHandle]
|
|
87
87
|
|
|
88
88
|
# Evaluate a function on the first element matching the selector
|
|
89
|
-
# @rbs selector: String
|
|
90
|
-
# @rbs page_function: String
|
|
91
|
-
# @rbs *args: untyped
|
|
92
|
-
# @rbs return: untyped
|
|
89
|
+
# @rbs selector: String -- Selector to query
|
|
90
|
+
# @rbs page_function: String -- JavaScript function to evaluate
|
|
91
|
+
# @rbs *args: untyped -- Arguments to pass to the function
|
|
92
|
+
# @rbs return: untyped -- Evaluation result
|
|
93
93
|
def eval_on_selector: (String selector, String page_function, *untyped args) -> untyped
|
|
94
94
|
|
|
95
95
|
# Evaluate a function on all elements matching the selector
|
|
96
|
-
# @rbs selector: String
|
|
97
|
-
# @rbs page_function: String
|
|
98
|
-
# @rbs *args: untyped
|
|
99
|
-
# @rbs return: untyped
|
|
96
|
+
# @rbs selector: String -- Selector to query
|
|
97
|
+
# @rbs page_function: String -- JavaScript function to evaluate
|
|
98
|
+
# @rbs *args: untyped -- Arguments to pass to the function
|
|
99
|
+
# @rbs return: untyped -- Evaluation result
|
|
100
100
|
def eval_on_selector_all: (String selector, String page_function, *untyped args) -> untyped
|
|
101
101
|
|
|
102
102
|
# Click an element matching the selector
|
|
103
|
-
# @rbs selector: String
|
|
104
|
-
# @rbs button: String
|
|
105
|
-
# @rbs count: Integer
|
|
106
|
-
# @rbs delay: Numeric?
|
|
107
|
-
# @rbs offset: Hash[Symbol, Numeric]?
|
|
103
|
+
# @rbs selector: String -- Selector to click
|
|
104
|
+
# @rbs button: String -- Mouse button ('left', 'right', 'middle')
|
|
105
|
+
# @rbs count: Integer -- Number of clicks
|
|
106
|
+
# @rbs delay: Numeric? -- Delay between clicks in ms
|
|
107
|
+
# @rbs offset: Hash[Symbol, Numeric]? -- Click offset from element center
|
|
108
108
|
# @rbs return: void
|
|
109
109
|
def click: (String selector, ?button: String, ?count: Integer, ?delay: Numeric?, ?offset: Hash[Symbol, Numeric]?) -> void
|
|
110
110
|
|
|
111
111
|
# Type text into an element matching the selector
|
|
112
|
-
# @rbs selector: String
|
|
113
|
-
# @rbs text: String
|
|
114
|
-
# @rbs delay: Numeric
|
|
112
|
+
# @rbs selector: String -- Selector to type into
|
|
113
|
+
# @rbs text: String -- Text to type
|
|
114
|
+
# @rbs delay: Numeric -- Delay between key presses in ms
|
|
115
115
|
# @rbs return: void
|
|
116
116
|
def type: (String selector, String text, ?delay: Numeric) -> void
|
|
117
117
|
|
|
118
118
|
# Hover over an element matching the selector
|
|
119
|
-
# @rbs selector: String
|
|
119
|
+
# @rbs selector: String -- Selector to hover
|
|
120
120
|
# @rbs return: void
|
|
121
121
|
def hover: (String selector) -> void
|
|
122
122
|
|
|
123
123
|
# Focus an element matching the selector
|
|
124
|
-
# @rbs selector: String
|
|
124
|
+
# @rbs selector: String -- Selector to focus
|
|
125
125
|
# @rbs return: void
|
|
126
126
|
def focus: (String selector) -> void
|
|
127
127
|
|
|
128
128
|
# Get the page title
|
|
129
|
-
# @rbs return: String
|
|
129
|
+
# @rbs return: String -- Page title
|
|
130
130
|
def title: () -> String
|
|
131
131
|
|
|
132
132
|
# Get the page URL
|
|
133
|
-
# @rbs return: String
|
|
133
|
+
# @rbs return: String -- Page URL
|
|
134
134
|
def url: () -> String
|
|
135
135
|
|
|
136
136
|
# Close the page
|
|
@@ -138,85 +138,85 @@ module Puppeteer
|
|
|
138
138
|
def close: () -> void
|
|
139
139
|
|
|
140
140
|
# Check if page is closed
|
|
141
|
-
# @rbs return: bool
|
|
141
|
+
# @rbs return: bool -- Whether page is closed
|
|
142
142
|
def closed?: () -> bool
|
|
143
143
|
|
|
144
144
|
# Get the main frame
|
|
145
|
-
# @rbs return: Frame
|
|
145
|
+
# @rbs return: Frame -- Main frame
|
|
146
146
|
def main_frame: () -> Frame
|
|
147
147
|
|
|
148
148
|
# Get the focused frame
|
|
149
|
-
# @rbs return: Frame
|
|
149
|
+
# @rbs return: Frame -- Focused frame
|
|
150
150
|
def focused_frame: () -> Frame
|
|
151
151
|
|
|
152
152
|
# Get all frames (main frame + all nested child frames)
|
|
153
153
|
# Following Puppeteer's pattern of returning all frames recursively
|
|
154
|
-
# @rbs return: Array[Frame]
|
|
154
|
+
# @rbs return: Array[Frame] -- All frames
|
|
155
155
|
def frames: () -> Array[Frame]
|
|
156
156
|
|
|
157
157
|
# Get the mouse instance
|
|
158
|
-
# @rbs return: Mouse
|
|
158
|
+
# @rbs return: Mouse -- Mouse instance
|
|
159
159
|
def mouse: () -> Mouse
|
|
160
160
|
|
|
161
161
|
# Get the keyboard instance
|
|
162
|
-
# @rbs return: Keyboard
|
|
162
|
+
# @rbs return: Keyboard -- Keyboard instance
|
|
163
163
|
def keyboard: () -> Keyboard
|
|
164
164
|
|
|
165
165
|
# Wait for a function to return a truthy value
|
|
166
|
-
# @rbs page_function: String
|
|
167
|
-
# @rbs options: Hash[Symbol, untyped]
|
|
168
|
-
# @rbs *args: untyped
|
|
169
|
-
# @rbs &block: ((JSHandle) -> void)?
|
|
170
|
-
# @rbs return: JSHandle
|
|
166
|
+
# @rbs page_function: String -- JavaScript function to evaluate
|
|
167
|
+
# @rbs options: Hash[Symbol, untyped] -- Wait options (timeout, polling)
|
|
168
|
+
# @rbs *args: untyped -- Arguments to pass to the function
|
|
169
|
+
# @rbs &block: ((JSHandle) -> void)? -- Optional block called with result
|
|
170
|
+
# @rbs return: JSHandle -- Handle to the truthy result
|
|
171
171
|
def wait_for_function: (String page_function, ?Hash[Symbol, untyped] options, *untyped args) ?{ (?) -> untyped } -> JSHandle
|
|
172
172
|
|
|
173
173
|
# Wait for an element matching the selector to appear in the page
|
|
174
|
-
# @rbs selector: String
|
|
175
|
-
# @rbs visible: bool?
|
|
176
|
-
# @rbs hidden: bool?
|
|
177
|
-
# @rbs timeout: Numeric?
|
|
178
|
-
# @rbs &block: ((ElementHandle?) -> void)?
|
|
179
|
-
# @rbs return: ElementHandle?
|
|
174
|
+
# @rbs selector: String -- Selector to wait for
|
|
175
|
+
# @rbs visible: bool? -- Wait for element to be visible
|
|
176
|
+
# @rbs hidden: bool? -- Wait for element to be hidden
|
|
177
|
+
# @rbs timeout: Numeric? -- Wait timeout in ms
|
|
178
|
+
# @rbs &block: ((ElementHandle?) -> void)? -- Optional block called with element
|
|
179
|
+
# @rbs return: ElementHandle? -- Element or nil if hidden
|
|
180
180
|
def wait_for_selector: (String selector, ?visible: bool?, ?hidden: bool?, ?timeout: Numeric?) ?{ (?) -> untyped } -> ElementHandle?
|
|
181
181
|
|
|
182
182
|
# Set the default timeout for waiting operations (e.g., waitForFunction).
|
|
183
|
-
# @rbs timeout: Numeric
|
|
183
|
+
# @rbs timeout: Numeric -- Timeout in ms
|
|
184
184
|
# @rbs return: void
|
|
185
185
|
def set_default_timeout: (Numeric timeout) -> void
|
|
186
186
|
|
|
187
187
|
# Get the current default timeout in milliseconds.
|
|
188
|
-
# @rbs return: Numeric
|
|
188
|
+
# @rbs return: Numeric -- Timeout in ms
|
|
189
189
|
def default_timeout: () -> Numeric
|
|
190
190
|
|
|
191
191
|
# Wait for navigation to complete
|
|
192
|
-
# @rbs timeout: Numeric
|
|
193
|
-
# @rbs wait_until: String
|
|
194
|
-
# @rbs &block: (-> void)?
|
|
195
|
-
# @rbs return: HTTPResponse?
|
|
192
|
+
# @rbs timeout: Numeric -- Navigation timeout in ms
|
|
193
|
+
# @rbs wait_until: String -- When to consider navigation complete
|
|
194
|
+
# @rbs &block: (-> void)? -- Optional block to trigger navigation
|
|
195
|
+
# @rbs return: HTTPResponse? -- Response or nil
|
|
196
196
|
def wait_for_navigation: (?timeout: Numeric, ?wait_until: String) ?{ (?) -> untyped } -> HTTPResponse?
|
|
197
197
|
|
|
198
198
|
# Wait for a file chooser to be opened
|
|
199
|
-
# @rbs timeout: Numeric?
|
|
200
|
-
# @rbs &block: (-> void)?
|
|
201
|
-
# @rbs return: FileChooser
|
|
199
|
+
# @rbs timeout: Numeric? -- Wait timeout in ms
|
|
200
|
+
# @rbs &block: (-> void)? -- Optional block to trigger file chooser
|
|
201
|
+
# @rbs return: FileChooser -- File chooser instance
|
|
202
202
|
def wait_for_file_chooser: (?timeout: Numeric?) ?{ (?) -> untyped } -> FileChooser
|
|
203
203
|
|
|
204
204
|
# Wait for network to be idle (no more than concurrency connections for idle_time)
|
|
205
205
|
# Based on Puppeteer's waitForNetworkIdle implementation
|
|
206
|
-
# @rbs idle_time: Numeric
|
|
207
|
-
# @rbs timeout: Numeric
|
|
208
|
-
# @rbs concurrency: Integer
|
|
206
|
+
# @rbs idle_time: Numeric -- Time to wait for idle in ms
|
|
207
|
+
# @rbs timeout: Numeric -- Wait timeout in ms
|
|
208
|
+
# @rbs concurrency: Integer -- Max allowed inflight requests
|
|
209
209
|
# @rbs return: void
|
|
210
210
|
def wait_for_network_idle: (?idle_time: Numeric, ?timeout: Numeric, ?concurrency: Integer) -> void
|
|
211
211
|
|
|
212
212
|
# Set viewport size
|
|
213
|
-
# @rbs width: Integer
|
|
214
|
-
# @rbs height: Integer
|
|
213
|
+
# @rbs width: Integer -- Viewport width in pixels
|
|
214
|
+
# @rbs height: Integer -- Viewport height in pixels
|
|
215
215
|
# @rbs return: void
|
|
216
216
|
def set_viewport: (width: Integer, height: Integer) -> void
|
|
217
217
|
|
|
218
218
|
# Get current viewport size
|
|
219
|
-
# @rbs return: Hash[Symbol, Integer]?
|
|
219
|
+
# @rbs return: Hash[Symbol, Integer]? -- Viewport dimensions
|
|
220
220
|
def viewport: () -> Hash[Symbol, Integer]?
|
|
221
221
|
|
|
222
222
|
alias viewport= set_viewport
|
|
@@ -224,19 +224,19 @@ module Puppeteer
|
|
|
224
224
|
alias default_timeout= set_default_timeout
|
|
225
225
|
|
|
226
226
|
# Set JavaScript enabled state
|
|
227
|
-
# @rbs enabled: bool
|
|
227
|
+
# @rbs enabled: bool -- Whether JavaScript is enabled
|
|
228
228
|
# @rbs return: void
|
|
229
229
|
def set_javascript_enabled: (bool enabled) -> void
|
|
230
230
|
|
|
231
231
|
# Check if JavaScript is enabled
|
|
232
|
-
# @rbs return: bool
|
|
232
|
+
# @rbs return: bool -- Whether JavaScript is enabled
|
|
233
233
|
def javascript_enabled?: () -> bool
|
|
234
234
|
|
|
235
235
|
private
|
|
236
236
|
|
|
237
237
|
# Recursively collect all frames starting from the given frame
|
|
238
|
-
# @rbs frame: Frame
|
|
239
|
-
# @rbs return: Array[Frame]
|
|
238
|
+
# @rbs frame: Frame -- Starting frame
|
|
239
|
+
# @rbs return: Array[Frame] -- All frames in subtree
|
|
240
240
|
def collect_frames: (Frame frame) -> Array[Frame]
|
|
241
241
|
|
|
242
242
|
# Check if this page is closed and raise error if so
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Generated from lib/puppeteer/bidi/query_handler.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Puppeteer
|
|
4
|
+
module Bidi
|
|
5
|
+
# @api private
|
|
6
|
+
class QueryHandler
|
|
7
|
+
include Singleton
|
|
8
|
+
|
|
9
|
+
QUERY_SEPARATORS: untyped
|
|
10
|
+
|
|
11
|
+
BUILTIN_QUERY_HANDLERS: untyped
|
|
12
|
+
|
|
13
|
+
class Result < Data
|
|
14
|
+
attr_reader updated_selector(): untyped
|
|
15
|
+
|
|
16
|
+
attr_reader polling(): untyped
|
|
17
|
+
|
|
18
|
+
attr_reader query_handler(): untyped
|
|
19
|
+
|
|
20
|
+
def self.new: (untyped updated_selector, untyped polling, untyped query_handler) -> instance
|
|
21
|
+
| (updated_selector: untyped, polling: untyped, query_handler: untyped) -> instance
|
|
22
|
+
|
|
23
|
+
def self.members: () -> [ :updated_selector, :polling, :query_handler ]
|
|
24
|
+
|
|
25
|
+
def members: () -> [ :updated_selector, :polling, :query_handler ]
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def get_query_handler_and_selector: (untyped selector) -> untyped
|
|
29
|
+
|
|
30
|
+
private
|
|
31
|
+
|
|
32
|
+
class SelectorAnalysis
|
|
33
|
+
attr_reader selector: untyped
|
|
34
|
+
|
|
35
|
+
def initialize: (untyped selector) -> untyped
|
|
36
|
+
|
|
37
|
+
def requires_raf_polling?: () -> untyped
|
|
38
|
+
|
|
39
|
+
private
|
|
40
|
+
|
|
41
|
+
def pseudo_class_present?: () -> untyped
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def builtin_query_handler_entries: () -> untyped
|
|
45
|
+
|
|
46
|
+
def detect_handler_from_selector: (untyped name, untyped handler, untyped selector) -> untyped
|
|
47
|
+
|
|
48
|
+
def analyze_default_query_handler: (untyped selector) -> untyped
|
|
49
|
+
|
|
50
|
+
def default_query_handler_result: (untyped selector) -> untyped
|
|
51
|
+
|
|
52
|
+
def resolve_handler_constant: (untyped const_name) -> untyped
|
|
53
|
+
|
|
54
|
+
def build_query_handler_result: (untyped handler, untyped selector, untyped handler_name) -> untyped
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
class BaseQueryHandler
|
|
58
|
+
# Query for a single element matching the selector
|
|
59
|
+
# @param element [ElementHandle] Element to query from
|
|
60
|
+
# @param selector [String] Selector to match
|
|
61
|
+
# @return [ElementHandle, nil] Found element or nil
|
|
62
|
+
def run_query_one: (untyped element, untyped selector) -> untyped
|
|
63
|
+
|
|
64
|
+
# Query for all elements matching the selector
|
|
65
|
+
# @param element [ElementHandle] Element to query from
|
|
66
|
+
# @param selector [String] Selector to match
|
|
67
|
+
# @return [Array<ElementHandle>] Array of found elements
|
|
68
|
+
def run_query_all: (untyped element, untyped selector) -> untyped
|
|
69
|
+
|
|
70
|
+
def wait_for: (untyped element_or_frame, untyped selector, ?visible: untyped, ?hidden: untyped, ?timeout: untyped, ?polling: untyped) ?{ (?) -> untyped } -> untyped
|
|
71
|
+
|
|
72
|
+
private
|
|
73
|
+
|
|
74
|
+
def query_one_script: () -> untyped
|
|
75
|
+
|
|
76
|
+
def query_all_script: () -> untyped
|
|
77
|
+
|
|
78
|
+
def wait_for_selector_script: () -> untyped
|
|
79
|
+
|
|
80
|
+
def wait_for_in_frame: (untyped frame, untyped root, untyped selector, visible: untyped, hidden: untyped, timeout: untyped, polling: untyped) ?{ (?) -> untyped } -> untyped
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
class CSSQueryHandler < BaseQueryHandler
|
|
84
|
+
private
|
|
85
|
+
|
|
86
|
+
def query_one_script: () -> untyped
|
|
87
|
+
|
|
88
|
+
def query_all_script: () -> untyped
|
|
89
|
+
|
|
90
|
+
def wait_for_selector_script: () -> untyped
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
class XPathQueryHandler < BaseQueryHandler
|
|
94
|
+
private
|
|
95
|
+
|
|
96
|
+
def query_one_script: () -> untyped
|
|
97
|
+
|
|
98
|
+
def query_all_script: () -> untyped
|
|
99
|
+
|
|
100
|
+
def wait_for_selector_script: () -> untyped
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
class TextQueryHandler < BaseQueryHandler
|
|
104
|
+
private
|
|
105
|
+
|
|
106
|
+
def query_one_script: () -> untyped
|
|
107
|
+
|
|
108
|
+
def query_all_script: () -> untyped
|
|
109
|
+
|
|
110
|
+
def wait_for_selector_script: () -> untyped
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
end
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# Generated from lib/puppeteer/bidi/realm.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Puppeteer
|
|
4
|
+
module Bidi
|
|
5
|
+
# Base realm abstraction that mirrors Puppeteer's Realm class hierarchy.
|
|
6
|
+
# Provides shared lifecycle management for WaitTask instances.
|
|
7
|
+
# https://github.com/puppeteer/puppeteer/blob/main/packages/puppeteer-core/src/api/Realm.ts
|
|
8
|
+
class Realm
|
|
9
|
+
attr_reader task_manager: TaskManager
|
|
10
|
+
|
|
11
|
+
# @rbs timeout_settings: TimeoutSettings -- Timeout settings
|
|
12
|
+
# @rbs return: void
|
|
13
|
+
def initialize: (TimeoutSettings timeout_settings) -> void
|
|
14
|
+
|
|
15
|
+
# Get the environment object (must be implemented by subclass)
|
|
16
|
+
# @rbs return: untyped -- Environment object
|
|
17
|
+
def environment: () -> untyped
|
|
18
|
+
|
|
19
|
+
# Get the page for this realm
|
|
20
|
+
# @rbs return: Page -- Page instance
|
|
21
|
+
def page: () -> Page
|
|
22
|
+
|
|
23
|
+
# Get the default timeout
|
|
24
|
+
# @rbs return: Numeric -- Default timeout in ms
|
|
25
|
+
def default_timeout: () -> Numeric
|
|
26
|
+
|
|
27
|
+
# Wait for a function to return a truthy value
|
|
28
|
+
# @rbs page_function: String -- JavaScript function to evaluate
|
|
29
|
+
# @rbs options: Hash[Symbol, untyped] -- Wait options (timeout, polling, root)
|
|
30
|
+
# @rbs *args: untyped -- Arguments to pass to the function
|
|
31
|
+
# @rbs &block: ((JSHandle) -> void)? -- Optional block called with result
|
|
32
|
+
# @rbs return: JSHandle -- Handle to the truthy result
|
|
33
|
+
def wait_for_function: (String page_function, ?Hash[Symbol, untyped] options, *untyped args) ?{ (?) -> untyped } -> JSHandle
|
|
34
|
+
|
|
35
|
+
# Dispose this realm
|
|
36
|
+
# @rbs return: void
|
|
37
|
+
def dispose: () -> void
|
|
38
|
+
|
|
39
|
+
# Check if this realm is disposed
|
|
40
|
+
# @rbs return: bool -- Whether realm is disposed
|
|
41
|
+
def disposed?: () -> bool
|
|
42
|
+
|
|
43
|
+
# Adopt a handle from another realm into this realm.
|
|
44
|
+
# Mirrors Puppeteer's BidiRealm#adoptHandle implementation.
|
|
45
|
+
# @rbs handle: JSHandle -- The handle to adopt
|
|
46
|
+
# @rbs return: JSHandle -- Handle that belongs to this realm
|
|
47
|
+
def adopt_handle: (JSHandle handle) -> JSHandle
|
|
48
|
+
|
|
49
|
+
# Transfer a handle into this realm, disposing of the original.
|
|
50
|
+
# Mirrors Puppeteer's BidiRealm#transferHandle implementation.
|
|
51
|
+
# @rbs handle: JSHandle -- Handle that may belong to another realm
|
|
52
|
+
# @rbs return: JSHandle -- Handle adopted into this realm
|
|
53
|
+
def transfer_handle: (JSHandle handle) -> JSHandle
|
|
54
|
+
|
|
55
|
+
private
|
|
56
|
+
|
|
57
|
+
# Ensure the environment is still active
|
|
58
|
+
# @rbs return: void
|
|
59
|
+
def ensure_environment_active!: () -> void
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Concrete realm that wraps the default window realm for a Frame.
|
|
63
|
+
# https://github.com/puppeteer/puppeteer/blob/main/packages/puppeteer-core/src/bidi/Realm.ts
|
|
64
|
+
class FrameRealm < Realm
|
|
65
|
+
attr_reader core_realm: Core::WindowRealm
|
|
66
|
+
|
|
67
|
+
# @rbs frame: Frame -- Frame instance
|
|
68
|
+
# @rbs core_realm: Core::WindowRealm -- Core window realm
|
|
69
|
+
# @rbs return: void
|
|
70
|
+
def initialize: (Frame frame, Core::WindowRealm core_realm) -> void
|
|
71
|
+
|
|
72
|
+
# Get the frame environment
|
|
73
|
+
# @rbs return: Frame -- Frame instance
|
|
74
|
+
def environment: () -> Frame
|
|
75
|
+
|
|
76
|
+
# Get the page
|
|
77
|
+
# @rbs return: Page -- Page instance
|
|
78
|
+
def page: () -> Page
|
|
79
|
+
|
|
80
|
+
# Evaluate JavaScript in this realm
|
|
81
|
+
# @rbs script: String -- JavaScript code to evaluate
|
|
82
|
+
# @rbs *args: untyped -- Arguments to pass to the script
|
|
83
|
+
# @rbs return: untyped -- Evaluation result
|
|
84
|
+
def evaluate: (String script, *untyped args) -> untyped
|
|
85
|
+
|
|
86
|
+
# Evaluate JavaScript and return a handle to the result
|
|
87
|
+
# @rbs script: String -- JavaScript code to evaluate
|
|
88
|
+
# @rbs *args: untyped -- Arguments to pass to the script
|
|
89
|
+
# @rbs return: JSHandle -- Handle to the result
|
|
90
|
+
def evaluate_handle: (String script, *untyped args) -> JSHandle
|
|
91
|
+
|
|
92
|
+
# Call a function in the realm
|
|
93
|
+
# @rbs function_declaration: String -- Function source code
|
|
94
|
+
# @rbs await_promise: bool -- Whether to await promise results
|
|
95
|
+
# @rbs **options: untyped -- Additional options
|
|
96
|
+
# @rbs return: Hash[String, untyped] -- Evaluation result
|
|
97
|
+
def call_function: (String function_declaration, bool await_promise, **untyped options) -> Hash[String, untyped]
|
|
98
|
+
|
|
99
|
+
# Get the Puppeteer utility handle
|
|
100
|
+
# @rbs return: JSHandle -- Puppeteer utility handle
|
|
101
|
+
def puppeteer_util: () -> JSHandle
|
|
102
|
+
|
|
103
|
+
# Get or create lazy arg for Puppeteer utility
|
|
104
|
+
# @rbs return: LazyArg -- Lazy argument for Puppeteer utility
|
|
105
|
+
def puppeteer_util_lazy_arg: () -> LazyArg
|
|
106
|
+
|
|
107
|
+
# Reset the Puppeteer utility handle
|
|
108
|
+
# @rbs return: void
|
|
109
|
+
def reset_puppeteer_util_handle!: () -> void
|
|
110
|
+
|
|
111
|
+
# Wait for a function to return a truthy value
|
|
112
|
+
# @rbs page_function: String -- JavaScript function to evaluate
|
|
113
|
+
# @rbs options: Hash[Symbol, untyped] -- Wait options
|
|
114
|
+
# @rbs *args: untyped -- Arguments to pass to the function
|
|
115
|
+
# @rbs &block: ((JSHandle) -> void)? -- Optional block called with result
|
|
116
|
+
# @rbs return: JSHandle -- Handle to the truthy result
|
|
117
|
+
def wait_for_function: (String page_function, ?Hash[Symbol, untyped] options, *untyped args) ?{ (?) -> untyped } -> JSHandle
|
|
118
|
+
|
|
119
|
+
# Dispose this realm
|
|
120
|
+
# @rbs return: void
|
|
121
|
+
def dispose: () -> void
|
|
122
|
+
|
|
123
|
+
private
|
|
124
|
+
|
|
125
|
+
# Execute script with core realm
|
|
126
|
+
# @rbs script: String -- JavaScript code
|
|
127
|
+
# @rbs args: Array[untyped] -- Arguments
|
|
128
|
+
# @rbs return: Async::Task[Hash[String, untyped]] -- Evaluation result
|
|
129
|
+
def execute_with_core: (String script, Array[untyped] args) -> Async::Task[Hash[String, untyped]]
|
|
130
|
+
|
|
131
|
+
# Handle evaluation exception from result
|
|
132
|
+
# @rbs result: Hash[String, untyped] -- Evaluation result containing exception
|
|
133
|
+
# @rbs return: void
|
|
134
|
+
def handle_evaluation_exception: (Hash[String, untyped] result) -> void
|
|
135
|
+
|
|
136
|
+
# Set up core realm event callbacks
|
|
137
|
+
# @rbs return: void
|
|
138
|
+
def setup_core_realm_callbacks: () -> void
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Generated from lib/puppeteer/bidi/serializer.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Puppeteer
|
|
4
|
+
module Bidi
|
|
5
|
+
# Serializer converts Ruby values to BiDi Script.LocalValue format
|
|
6
|
+
# Based on Puppeteer's Serializer.ts
|
|
7
|
+
class Serializer
|
|
8
|
+
# Serialize a Ruby value to BiDi LocalValue format
|
|
9
|
+
# @param value [Object] Ruby value to serialize
|
|
10
|
+
# @return [Hash] BiDi LocalValue
|
|
11
|
+
# @raise [ArgumentError] for unsupported types or circular references
|
|
12
|
+
def self.serialize: (untyped value) -> untyped
|
|
13
|
+
|
|
14
|
+
# Check if value is a complex object that might have circular references
|
|
15
|
+
private def self.complex_object?: (untyped value) -> untyped
|
|
16
|
+
|
|
17
|
+
# Check for circular references using JSON encoding
|
|
18
|
+
# This matches Puppeteer's approach
|
|
19
|
+
private def self.check_circular_reference: (untyped value) -> untyped
|
|
20
|
+
|
|
21
|
+
# Serialize a JSHandle to a BiDi reference
|
|
22
|
+
private def self.serialize_handle: (untyped handle) -> untyped
|
|
23
|
+
|
|
24
|
+
# Serialize a Float to BiDi number format, handling special values
|
|
25
|
+
private def self.serialize_number: (untyped num) -> untyped
|
|
26
|
+
|
|
27
|
+
# Extract regexp flags from Ruby Regexp
|
|
28
|
+
private def self.regexp_flags: (untyped regexp) -> untyped
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Generated from lib/puppeteer/bidi/target.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Puppeteer
|
|
4
|
+
module Bidi
|
|
5
|
+
class BrowserTarget
|
|
6
|
+
# @rbs browser: Browser
|
|
7
|
+
# @rbs return: void
|
|
8
|
+
def initialize: (Browser browser) -> void
|
|
9
|
+
|
|
10
|
+
# @rbs return: nil
|
|
11
|
+
def page: () -> nil
|
|
12
|
+
|
|
13
|
+
# @rbs return: String
|
|
14
|
+
def url: () -> String
|
|
15
|
+
|
|
16
|
+
# @rbs return: String
|
|
17
|
+
def type: () -> String
|
|
18
|
+
|
|
19
|
+
# @rbs return: Browser
|
|
20
|
+
def browser: () -> Browser
|
|
21
|
+
|
|
22
|
+
# @rbs return: BrowserContext
|
|
23
|
+
def browser_context: () -> BrowserContext
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
class PageTarget
|
|
27
|
+
# @rbs page: Page
|
|
28
|
+
# @rbs return: void
|
|
29
|
+
def initialize: (Page page) -> void
|
|
30
|
+
|
|
31
|
+
# @rbs return: Page
|
|
32
|
+
def page: () -> Page
|
|
33
|
+
|
|
34
|
+
# @rbs return: String
|
|
35
|
+
def url: () -> String
|
|
36
|
+
|
|
37
|
+
# @rbs return: String
|
|
38
|
+
def type: () -> String
|
|
39
|
+
|
|
40
|
+
# @rbs return: Browser
|
|
41
|
+
def browser: () -> Browser
|
|
42
|
+
|
|
43
|
+
# @rbs return: BrowserContext
|
|
44
|
+
def browser_context: () -> BrowserContext
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
class FrameTarget
|
|
48
|
+
# @rbs frame: Frame
|
|
49
|
+
# @rbs return: void
|
|
50
|
+
def initialize: (Frame frame) -> void
|
|
51
|
+
|
|
52
|
+
# @rbs return: Page
|
|
53
|
+
def page: () -> Page
|
|
54
|
+
|
|
55
|
+
# @rbs return: String
|
|
56
|
+
def url: () -> String
|
|
57
|
+
|
|
58
|
+
# @rbs return: String
|
|
59
|
+
def type: () -> String
|
|
60
|
+
|
|
61
|
+
# @rbs return: Browser
|
|
62
|
+
def browser: () -> Browser
|
|
63
|
+
|
|
64
|
+
# @rbs return: BrowserContext
|
|
65
|
+
def browser_context: () -> BrowserContext
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|