puppeteer-ruby 0.45.6 → 0.50.0.alpha5

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.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -3
  3. data/AGENTS.md +169 -0
  4. data/CLAUDE/README.md +41 -0
  5. data/CLAUDE/architecture.md +253 -0
  6. data/CLAUDE/cdp_protocol.md +230 -0
  7. data/CLAUDE/concurrency.md +216 -0
  8. data/CLAUDE/porting_puppeteer.md +575 -0
  9. data/CLAUDE/rbs_type_checking.md +101 -0
  10. data/CLAUDE/spec_migration_plans.md +1041 -0
  11. data/CLAUDE/testing.md +278 -0
  12. data/CLAUDE.md +242 -0
  13. data/README.md +8 -0
  14. data/Rakefile +7 -0
  15. data/Steepfile +28 -0
  16. data/docs/api_coverage.md +105 -56
  17. data/lib/puppeteer/aria_query_handler.rb +3 -2
  18. data/lib/puppeteer/async_utils.rb +214 -0
  19. data/lib/puppeteer/browser.rb +98 -56
  20. data/lib/puppeteer/browser_connector.rb +18 -3
  21. data/lib/puppeteer/browser_context.rb +196 -3
  22. data/lib/puppeteer/browser_runner.rb +18 -10
  23. data/lib/puppeteer/cdp_session.rb +67 -23
  24. data/lib/puppeteer/chrome_target_manager.rb +65 -40
  25. data/lib/puppeteer/connection.rb +55 -36
  26. data/lib/puppeteer/console_message.rb +9 -1
  27. data/lib/puppeteer/console_patch.rb +47 -0
  28. data/lib/puppeteer/css_coverage.rb +5 -3
  29. data/lib/puppeteer/custom_query_handler.rb +80 -33
  30. data/lib/puppeteer/define_async_method.rb +31 -37
  31. data/lib/puppeteer/dialog.rb +47 -14
  32. data/lib/puppeteer/element_handle.rb +231 -62
  33. data/lib/puppeteer/emulation_manager.rb +1 -1
  34. data/lib/puppeteer/env.rb +1 -1
  35. data/lib/puppeteer/errors.rb +25 -2
  36. data/lib/puppeteer/event_callbackable.rb +15 -0
  37. data/lib/puppeteer/events.rb +4 -0
  38. data/lib/puppeteer/execution_context.rb +148 -3
  39. data/lib/puppeteer/file_chooser.rb +6 -0
  40. data/lib/puppeteer/frame.rb +162 -91
  41. data/lib/puppeteer/frame_manager.rb +69 -48
  42. data/lib/puppeteer/http_request.rb +114 -38
  43. data/lib/puppeteer/http_response.rb +24 -7
  44. data/lib/puppeteer/isolated_world.rb +64 -41
  45. data/lib/puppeteer/js_coverage.rb +5 -3
  46. data/lib/puppeteer/js_handle.rb +58 -16
  47. data/lib/puppeteer/keyboard.rb +30 -17
  48. data/lib/puppeteer/launcher/browser_options.rb +3 -1
  49. data/lib/puppeteer/launcher/chrome.rb +8 -5
  50. data/lib/puppeteer/launcher/launch_options.rb +7 -2
  51. data/lib/puppeteer/launcher.rb +4 -8
  52. data/lib/puppeteer/lifecycle_watcher.rb +38 -22
  53. data/lib/puppeteer/mouse.rb +273 -64
  54. data/lib/puppeteer/network_event_manager.rb +7 -0
  55. data/lib/puppeteer/network_manager.rb +393 -112
  56. data/lib/puppeteer/page/screenshot_task_queue.rb +14 -4
  57. data/lib/puppeteer/page.rb +568 -226
  58. data/lib/puppeteer/puppeteer.rb +171 -64
  59. data/lib/puppeteer/query_handler_manager.rb +112 -16
  60. data/lib/puppeteer/reactor_runner.rb +247 -0
  61. data/lib/puppeteer/remote_object.rb +127 -47
  62. data/lib/puppeteer/target.rb +74 -27
  63. data/lib/puppeteer/task_manager.rb +3 -1
  64. data/lib/puppeteer/timeout_helper.rb +6 -10
  65. data/lib/puppeteer/touch_handle.rb +39 -0
  66. data/lib/puppeteer/touch_screen.rb +72 -22
  67. data/lib/puppeteer/tracing.rb +3 -3
  68. data/lib/puppeteer/version.rb +1 -1
  69. data/lib/puppeteer/wait_task.rb +264 -101
  70. data/lib/puppeteer/web_socket.rb +2 -2
  71. data/lib/puppeteer/web_socket_transport.rb +91 -27
  72. data/lib/puppeteer/web_worker.rb +175 -0
  73. data/lib/puppeteer.rb +20 -4
  74. data/puppeteer-ruby.gemspec +15 -11
  75. data/sig/_external.rbs +8 -0
  76. data/sig/_supplementary.rbs +314 -0
  77. data/sig/puppeteer/browser.rbs +166 -0
  78. data/sig/puppeteer/cdp_session.rbs +64 -0
  79. data/sig/puppeteer/dialog.rbs +41 -0
  80. data/sig/puppeteer/element_handle.rbs +305 -0
  81. data/sig/puppeteer/execution_context.rbs +87 -0
  82. data/sig/puppeteer/frame.rbs +226 -0
  83. data/sig/puppeteer/http_request.rbs +214 -0
  84. data/sig/puppeteer/http_response.rbs +89 -0
  85. data/sig/puppeteer/js_handle.rbs +64 -0
  86. data/sig/puppeteer/keyboard.rbs +40 -0
  87. data/sig/puppeteer/mouse.rbs +113 -0
  88. data/sig/puppeteer/page.rbs +515 -0
  89. data/sig/puppeteer/puppeteer.rbs +98 -0
  90. data/sig/puppeteer/remote_object.rbs +78 -0
  91. data/sig/puppeteer/touch_handle.rbs +21 -0
  92. data/sig/puppeteer/touch_screen.rbs +35 -0
  93. data/sig/puppeteer/web_worker.rbs +83 -0
  94. metadata +116 -45
  95. data/CHANGELOG.md +0 -397
  96. data/lib/puppeteer/concurrent_ruby_utils.rb +0 -81
  97. data/lib/puppeteer/firefox_target_manager.rb +0 -157
  98. data/lib/puppeteer/launcher/firefox.rb +0 -453
@@ -0,0 +1,515 @@
1
+ # Generated from lib/puppeteer/page.rb with RBS::Inline
2
+
3
+ class Puppeteer::Page
4
+ include Puppeteer::DebugPrint
5
+
6
+ include Puppeteer::EventCallbackable
7
+
8
+ include Puppeteer::IfPresent
9
+
10
+ # @rbs client: Puppeteer::CDPSession -- CDP session for the page
11
+ # @rbs target: Puppeteer::Target -- Target associated with the page
12
+ # @rbs ignore_https_errors: bool -- Ignore HTTPS errors
13
+ # @rbs default_viewport: Puppeteer::Viewport? -- Default viewport for new pages
14
+ # @rbs network_enabled: bool -- Whether network events are enabled
15
+ # @rbs return: Puppeteer::Page -- Created page instance
16
+ def self.create: (Puppeteer::CDPSession client, Puppeteer::Target target, bool ignore_https_errors, Puppeteer::Viewport? default_viewport, ?network_enabled: bool) -> Puppeteer::Page
17
+
18
+ # @rbs client: Puppeteer::CDPSession -- CDP session for the page
19
+ # @rbs target: Puppeteer::Target -- Target associated with the page
20
+ # @rbs ignore_https_errors: bool -- Ignore HTTPS errors
21
+ # @rbs network_enabled: bool -- Whether network events are enabled
22
+ # @rbs return: void -- No return value
23
+ def initialize: (Puppeteer::CDPSession client, Puppeteer::Target target, bool ignore_https_errors, ?network_enabled: bool) -> void
24
+
25
+ private def handle_detached_from_target: (untyped target) -> untyped
26
+
27
+ private def handle_attached_to_session: (untyped session) -> untyped
28
+
29
+ private def handle_attached_to_target: (untyped target) -> untyped
30
+
31
+ # @rbs return: Array[untyped] -- Initialization results
32
+ def init: () -> Array[untyped]
33
+
34
+ # @rbs return: bool -- Whether drag interception is enabled
35
+ def drag_interception_enabled?: () -> bool
36
+
37
+ # @rbs event_name: (String | Symbol) -- Page event name
38
+ # @rbs &block: ^(untyped) -> void -- Event handler
39
+ # @rbs return: String -- Listener ID
40
+ def on: (String | Symbol event_name) ?{ (?) -> untyped } -> String
41
+
42
+ # @rbs event_name: (String | Symbol) -- Page event name
43
+ # @rbs &block: ^(untyped) -> void -- Event handler
44
+ # @rbs return: String -- Listener ID
45
+ def once: (String | Symbol event_name) ?{ (?) -> untyped } -> String
46
+
47
+ # @rbs event_name_or_id: (String | Symbol) -- Page event name or listener ID
48
+ # @rbs listener: Proc? -- Event handler to remove
49
+ # @rbs return: void -- No return value
50
+ def off: (String | Symbol event_name_or_id, ?Proc? listener) ?{ (?) -> untyped } -> void
51
+
52
+ # @rbs event: Hash[String, untyped] -- File chooser event payload
53
+ # @rbs return: void -- No return value
54
+ def handle_file_chooser: (Hash[String, untyped] event) -> void
55
+
56
+ # @rbs timeout: Numeric? -- Timeout in milliseconds
57
+ # @rbs return: Puppeteer::FileChooser -- File chooser handle
58
+ def wait_for_file_chooser: (?timeout: Numeric?) -> Puppeteer::FileChooser
59
+
60
+ # @rbs geolocation: Puppeteer::Geolocation -- Geolocation override
61
+ # @rbs return: void -- No return value
62
+ def geolocation=: (Puppeteer::Geolocation geolocation) -> void
63
+
64
+ attr_reader javascript_enabled: untyped
65
+
66
+ attr_reader service_worker_bypassed: untyped
67
+
68
+ attr_reader target: untyped
69
+
70
+ attr_reader client: untyped
71
+
72
+ # @rbs return: String -- Tab target id
73
+ def _tab_id: () -> String
74
+
75
+ # @rbs other: Object -- Other object to compare
76
+ # @rbs return: bool -- Equality result
77
+ def ==: (Object other) -> bool
78
+
79
+ # @rbs return: Puppeteer::Browser -- Owning browser
80
+ def browser: () -> Puppeteer::Browser
81
+
82
+ # @rbs return: Puppeteer::BrowserContext -- Owning browser context
83
+ def browser_context: () -> Puppeteer::BrowserContext
84
+
85
+ class TargetCrashedError < Puppeteer::Error
86
+ end
87
+
88
+ private def handle_target_crashed: () -> untyped
89
+
90
+ private def handle_log_entry_added: (untyped event) -> untyped
91
+
92
+ # @rbs return: Puppeteer::Frame -- Main frame
93
+ def main_frame: () -> Puppeteer::Frame
94
+
95
+ attr_reader touchscreen: untyped
96
+
97
+ attr_reader coverage: untyped
98
+
99
+ attr_reader tracing: untyped
100
+
101
+ attr_reader accessibility: untyped
102
+
103
+ # @rbs block: Proc? -- Optional block for instance_eval
104
+ # @rbs return: Puppeteer::Keyboard -- Keyboard instance
105
+ def keyboard: () ?{ (?) -> untyped } -> Puppeteer::Keyboard
106
+
107
+ # @rbs return: Array[Puppeteer::Frame] -- All frames
108
+ def frames: () -> Array[Puppeteer::Frame]
109
+
110
+ # @rbs return: Array[untyped] -- Active web workers
111
+ def workers: () -> Array[untyped]
112
+
113
+ # @rbs value: bool -- Enable request interception
114
+ # @rbs return: void -- No return value
115
+ def request_interception=: (bool value) -> void
116
+
117
+ # @rbs enabled: bool -- Enable drag interception
118
+ # @rbs return: void -- No return value
119
+ def drag_interception_enabled=: (bool enabled) -> void
120
+
121
+ # @rbs bypass: bool -- Bypass service workers
122
+ # @rbs return: void -- No return value
123
+ def service_worker_bypassed=: (bool bypass) -> void
124
+
125
+ # @rbs enabled: bool -- Enable offline mode
126
+ # @rbs return: void -- No return value
127
+ def offline_mode=: (bool enabled) -> void
128
+
129
+ # @rbs network_condition: Puppeteer::NetworkCondition? -- Network condition override
130
+ # @rbs return: void -- No return value
131
+ def emulate_network_conditions: (Puppeteer::NetworkCondition? network_condition) -> void
132
+
133
+ # @rbs timeout: Numeric? -- Default navigation timeout in milliseconds
134
+ # @rbs return: void -- No return value
135
+ def default_navigation_timeout=: (Numeric? timeout) -> void
136
+
137
+ # @rbs timeout: Numeric? -- Default timeout in milliseconds
138
+ # @rbs return: void -- No return value
139
+ def default_timeout=: (Numeric? timeout) -> void
140
+
141
+ # `$()` in JavaScript.
142
+ # @rbs selector: String -- CSS selector
143
+ # @rbs return: Puppeteer::ElementHandle? -- Matching element or nil
144
+ def query_selector: (String selector) -> Puppeteer::ElementHandle?
145
+
146
+ # `$$()` in JavaScript.
147
+ # @rbs selector: String -- CSS selector
148
+ # @rbs isolate: bool? -- Use isolated world for queries
149
+ # @rbs return: Array[Puppeteer::ElementHandle] -- Matching elements
150
+ def query_selector_all: (String selector, ?isolate: bool?) -> Array[Puppeteer::ElementHandle]
151
+
152
+ # @rbs page_function: String -- Function or expression to evaluate
153
+ # @rbs args: Array[untyped] -- Arguments for evaluation
154
+ # @rbs return: Puppeteer::JSHandle -- Handle to evaluation result
155
+ def evaluate_handle: (String page_function, *untyped args) -> Puppeteer::JSHandle
156
+
157
+ # @rbs prototype_handle: Puppeteer::JSHandle -- Prototype handle
158
+ # @rbs return: Puppeteer::JSHandle -- Handle to query result
159
+ def query_objects: (Puppeteer::JSHandle prototype_handle) -> Puppeteer::JSHandle
160
+
161
+ # `$eval()` in JavaScript.
162
+ # @rbs selector: String -- CSS selector
163
+ # @rbs page_function: String -- Function or expression to evaluate
164
+ # @rbs args: Array[untyped] -- Arguments for evaluation
165
+ # @rbs return: untyped -- Evaluation result
166
+ def eval_on_selector: (String selector, String page_function, *untyped args) -> untyped
167
+
168
+ # `$$eval()` in JavaScript.
169
+ # @rbs selector: String -- CSS selector
170
+ # @rbs page_function: String -- Function or expression to evaluate
171
+ # @rbs args: Array[untyped] -- Arguments for evaluation
172
+ # @rbs return: untyped -- Evaluation result
173
+ def eval_on_selector_all: (String selector, String page_function, *untyped args) -> untyped
174
+
175
+ # `$x()` in JavaScript. $ is not allowed to use as a method name in Ruby.
176
+ # @rbs expression: String -- XPath expression
177
+ # @rbs return: Array[Puppeteer::ElementHandle] -- Matching elements
178
+ def Sx: (String expression) -> Array[Puppeteer::ElementHandle]
179
+
180
+ # @rbs urls: Array[String] -- URLs to fetch cookies for
181
+ # @rbs return: Array[Hash[String, untyped]] -- Cookies list
182
+ def cookies: (*untyped urls) -> Array[Hash[String, untyped]]
183
+
184
+ # check if each cookie element has required fields ('name' and 'value')
185
+ private def assert_cookie_params: (untyped cookies, requires: untyped) -> untyped
186
+
187
+ # @rbs cookies: Array[Hash[Symbol | String, untyped]] -- cookies parameter
188
+ # @rbs return: void -- No return value
189
+ def delete_cookie: (*untyped cookies) -> void
190
+
191
+ # @rbs cookies: Array[Hash[Symbol | String, untyped]] -- cookies parameter
192
+ # @rbs return: void -- No return value
193
+ def set_cookie: (*untyped cookies) -> void
194
+
195
+ # @rbs url: String? -- Script URL
196
+ # @rbs path: String? -- Path to script file
197
+ # @rbs content: String? -- Script contents
198
+ # @rbs type: String? -- Script type
199
+ # @rbs id: String? -- Script element ID
200
+ # @rbs return: Puppeteer::ElementHandle -- Script element handle
201
+ def add_script_tag: (?url: String?, ?path: String?, ?content: String?, ?type: String?, ?id: String?) -> Puppeteer::ElementHandle
202
+
203
+ # @rbs url: String? -- Stylesheet URL
204
+ # @rbs path: String? -- Path to stylesheet file
205
+ # @rbs content: String? -- Stylesheet contents
206
+ # @rbs return: Puppeteer::ElementHandle -- Style element handle
207
+ def add_style_tag: (?url: String?, ?path: String?, ?content: String?) -> Puppeteer::ElementHandle
208
+
209
+ # @rbs name: String -- Binding name
210
+ # @rbs puppeteer_function: Proc -- Ruby callback
211
+ # @rbs return: void -- No return value
212
+ def expose_function: (String name, Proc puppeteer_function) -> void
213
+
214
+ # @rbs name: String -- Binding name
215
+ # @rbs return: void -- No return value
216
+ def remove_exposed_function: (String name) -> void
217
+
218
+ # @rbs username: String? -- HTTP basic auth username
219
+ # @rbs password: String? -- HTTP basic auth password
220
+ # @rbs return: void -- No return value
221
+ def authenticate: (?username: String?, ?password: String?) -> void
222
+
223
+ # @rbs headers: Hash[String, String] -- Extra HTTP headers
224
+ # @rbs return: void -- No return value
225
+ def extra_http_headers=: (Hash[String, String] headers) -> void
226
+
227
+ # @rbs user_agent: String -- User agent string
228
+ # @rbs user_agent_metadata: Hash[String, untyped]? -- User agent metadata
229
+ # @rbs return: void -- No return value
230
+ def set_user_agent: (String user_agent, ?Hash[String, untyped]? user_agent_metadata) -> void
231
+
232
+ # @rbs return: Puppeteer::Page::Metrics -- Page metrics
233
+ def metrics: () -> Puppeteer::Page::Metrics
234
+
235
+ class PageError < Puppeteer::Error
236
+ end
237
+
238
+ private def handle_exception: (untyped exception_details) -> untyped
239
+
240
+ private def handle_console_api: (untyped event) -> untyped
241
+
242
+ # @rbs event: Hash[String, untyped] -- Binding called payload
243
+ # @rbs return: void -- No return value
244
+ def handle_binding_called: (Hash[String, untyped] event) -> void
245
+
246
+ private def add_console_message: (untyped type, untyped args, untyped stack_trace) -> untyped
247
+
248
+ private def handle_dialog_opening: (untyped event) -> untyped
249
+
250
+ private def set_transparent_background_color: () ?{ (?) -> untyped } -> untyped
251
+
252
+ private def reset_default_background_color: () ?{ (?) -> untyped } -> untyped
253
+
254
+ # @rbs return: String? -- Page URL
255
+ def url: () -> String?
256
+
257
+ # @rbs return: String -- Page HTML content
258
+ def content: () -> String
259
+
260
+ # @rbs html: String -- HTML content
261
+ # @rbs timeout: Numeric? -- Navigation timeout in milliseconds
262
+ # @rbs wait_until: String | Array[String] | nil -- Lifecycle events to wait for
263
+ # @rbs return: void -- No return value
264
+ def set_content: (String html, ?timeout: Numeric?, ?wait_until: String | Array[String] | nil) -> void
265
+
266
+ # @rbs html: String -- HTML content
267
+ # @rbs return: void -- No return value
268
+ def content=: (String html) -> void
269
+
270
+ # @rbs url: String -- URL to navigate
271
+ # @rbs referer: String? -- Referer header value
272
+ # @rbs referer: String? -- Referer header value
273
+ # @rbs referrer_policy: String? -- Referrer policy
274
+ # @rbs timeout: Numeric? -- Navigation timeout in milliseconds
275
+ # @rbs wait_until: String | Array[String] | nil -- Lifecycle events to wait for
276
+ # @rbs return: Puppeteer::HTTPResponse? -- Navigation response
277
+ def goto: (String url, ?referer: String?, ?referrer_policy: String?, ?timeout: Numeric?, ?wait_until: String | Array[String] | nil) -> Puppeteer::HTTPResponse?
278
+
279
+ # @rbs timeout: Numeric? -- Navigation timeout in milliseconds
280
+ # @rbs wait_until: String | Array[String] | nil -- Lifecycle events to wait for
281
+ # @rbs ignore_cache: bool? -- Skip cache when reloading
282
+ # @rbs return: Puppeteer::HTTPResponse? -- Navigation response
283
+ def reload: (?timeout: Numeric?, ?wait_until: String | Array[String] | nil, ?ignore_cache: bool?) -> Puppeteer::HTTPResponse?
284
+
285
+ # @rbs timeout: Numeric? -- Navigation timeout in milliseconds
286
+ # @rbs wait_until: String | Array[String] | nil -- Lifecycle events to wait for
287
+ # @rbs ignore_same_document_navigation: bool -- Ignore same-document navigation
288
+ # @rbs return: Puppeteer::HTTPResponse? -- Navigation response
289
+ def wait_for_navigation: (?timeout: Numeric?, ?wait_until: String | Array[String] | nil, ?ignore_same_document_navigation: bool) -> Puppeteer::HTTPResponse?
290
+
291
+ private def wait_for_network_manager_event: (untyped event_name, predicate: untyped, timeout: untyped) -> untyped
292
+
293
+ private def wait_for_frame_manager_event: (*untyped event_names, predicate: untyped, timeout: untyped) -> untyped
294
+
295
+ private def session_close_promise: () -> untyped
296
+
297
+ # @rbs url: String? -- URL to match
298
+ # @rbs predicate: Proc? -- Predicate to match
299
+ # @rbs timeout: Numeric? -- Timeout in milliseconds
300
+ # @rbs return: Puppeteer::HTTPRequest -- Matching request
301
+ def wait_for_request: (?url: String?, ?predicate: Proc?, ?timeout: Numeric?) -> Puppeteer::HTTPRequest
302
+
303
+ # @rbs url: String? -- URL to match
304
+ # @rbs predicate: Proc? -- Predicate to match
305
+ # @rbs timeout: Numeric? -- Timeout in milliseconds
306
+ # @rbs return: Puppeteer::HTTPResponse -- Matching response
307
+ def wait_for_response: (?url: String?, ?predicate: Proc?, ?timeout: Numeric?) -> Puppeteer::HTTPResponse
308
+
309
+ # @rbs idle_time: Numeric -- Idle time to wait for in milliseconds
310
+ # @rbs timeout: Numeric? -- Timeout in milliseconds
311
+ # @rbs concurrency: Integer -- Allowed number of concurrent requests
312
+ # @rbs return: void -- No return value
313
+ def wait_for_network_idle: (?idle_time: Numeric, ?timeout: Numeric?, ?concurrency: Integer) -> void
314
+
315
+ # @rbs url: String? -- URL to match
316
+ # @rbs predicate: Proc? -- Predicate to match
317
+ # @rbs timeout: Numeric? -- Timeout in milliseconds
318
+ # @rbs return: Puppeteer::Frame -- Matching frame
319
+ def wait_for_frame: (?url: String?, ?predicate: Proc?, ?timeout: Numeric?) -> Puppeteer::Frame
320
+
321
+ # @rbs timeout: Numeric? -- Navigation timeout in milliseconds
322
+ # @rbs wait_until: String | Array[String] | nil -- Lifecycle events to wait for
323
+ # @rbs return: Puppeteer::HTTPResponse? -- Navigation response
324
+ def go_back: (?timeout: Numeric?, ?wait_until: String | Array[String] | nil) -> Puppeteer::HTTPResponse?
325
+
326
+ # @rbs timeout: Numeric? -- Navigation timeout in milliseconds
327
+ # @rbs wait_until: String | Array[String] | nil -- Lifecycle events to wait for
328
+ # @rbs return: Puppeteer::HTTPResponse? -- Navigation response
329
+ def go_forward: (?timeout: Numeric?, ?wait_until: String | Array[String] | nil) -> Puppeteer::HTTPResponse?
330
+
331
+ private def go: (untyped delta, ?timeout: untyped, ?wait_until: untyped) -> untyped
332
+
333
+ # Brings page to front (activates tab).
334
+ # @rbs return: void -- No return value
335
+ def bring_to_front: () -> void
336
+
337
+ # @rbs device: Puppeteer::Device -- Device descriptor
338
+ # @rbs return: void -- No return value
339
+ def emulate: (Puppeteer::Device device) -> void
340
+
341
+ # @rbs enabled: bool -- Enable JavaScript
342
+ # @rbs return: void -- No return value
343
+ def javascript_enabled=: (bool enabled) -> void
344
+
345
+ # @rbs enabled: bool -- Enable bypassing CSP
346
+ # @rbs return: void -- No return value
347
+ def bypass_csp=: (bool enabled) -> void
348
+
349
+ # @rbs media_type: (String | Symbol)? -- Media type override
350
+ # @rbs return: void -- No return value
351
+ def emulate_media_type: ((String | Symbol)? media_type) -> void
352
+
353
+ # @rbs factor: Numeric? -- CPU throttling rate
354
+ # @rbs return: void -- No return value
355
+ def emulate_cpu_throttling: (Numeric? factor) -> void
356
+
357
+ # @rbs features: Array[Hash[Symbol, untyped]]? -- Media feature overrides
358
+ # @rbs return: void -- No return value
359
+ def emulate_media_features: (Array[Hash[Symbol, untyped]]? features) -> void
360
+
361
+ # @rbs timezone_id: String? -- Timezone ID
362
+ # @rbs return: void -- No return value
363
+ def emulate_timezone: (String? timezone_id) -> void
364
+
365
+ VISION_DEFICIENCY_TYPES: untyped
366
+
367
+ # @rbs vision_deficiency_type: String? -- Vision deficiency type
368
+ # @rbs return: void -- No return value
369
+ def emulate_vision_deficiency: (String? vision_deficiency_type) -> void
370
+
371
+ # @rbs is_user_active: bool? -- User activity override
372
+ # @rbs is_screen_unlocked: bool? -- Screen unlocked override
373
+ # @rbs return: void -- No return value
374
+ def emulate_idle_state: (?is_user_active: bool?, ?is_screen_unlocked: bool?) -> void
375
+
376
+ # @rbs viewport: Puppeteer::Viewport? -- Viewport settings
377
+ # @rbs return: void -- No return value
378
+ def viewport=: (Puppeteer::Viewport? viewport) -> void
379
+
380
+ attr_reader viewport: untyped
381
+
382
+ # @rbs page_function: String -- page_function parameter
383
+ # @rbs args: Array[untyped] -- args parameter
384
+ # @rbs return: untyped -- Result
385
+ def evaluate: (String page_function, *untyped args) -> untyped
386
+
387
+ class JavaScriptFunction
388
+ # @rbs expression: String -- Function expression
389
+ # @rbs args: Array[untyped] -- Arguments for evaluation
390
+ # @rbs return: void -- No return value
391
+ def initialize: (String expression, Array[untyped] args) -> void
392
+
393
+ # @rbs return: String -- Generated source
394
+ def source: () -> String
395
+
396
+ private def arguments: () -> untyped
397
+ end
398
+
399
+ class JavaScriptExpression
400
+ # @rbs expression: String -- Expression to evaluate
401
+ # @rbs return: void -- No return value
402
+ def initialize: (String expression) -> void
403
+
404
+ # @rbs return: String -- Generated source
405
+ def source: () -> String
406
+ end
407
+
408
+ # @rbs page_function: String -- page_function parameter
409
+ # @rbs args: Array[untyped] -- args parameter
410
+ # @rbs return: Hash[String, untyped] -- CDP response
411
+ def evaluate_on_new_document: (String page_function, *untyped args) -> Hash[String, untyped]
412
+
413
+ # @rbs identifier: String -- Script identifier to remove
414
+ # @rbs return: void
415
+ def remove_script_to_evaluate_on_new_document: (String identifier) -> void
416
+
417
+ # @rbs enabled: bool -- Enable cache usage
418
+ def cache_enabled=: (bool enabled) -> untyped
419
+
420
+ # @rbs return: String -- Page title
421
+ def title: () -> String
422
+
423
+ # @rbs type: String? -- Image format
424
+ # @rbs path: String? -- File path to save
425
+ # @rbs full_page: bool? -- Capture full page
426
+ # @rbs clip: Hash[Symbol, Numeric]? -- Clip rectangle
427
+ # @rbs quality: Integer? -- JPEG quality
428
+ # @rbs omit_background: bool? -- Omit background for PNG
429
+ # @rbs encoding: String? -- Encoding (base64 or binary)
430
+ # @rbs capture_beyond_viewport: bool? -- Capture beyond viewport
431
+ # @rbs from_surface: bool? -- Capture from surface
432
+ # @rbs return: String -- Screenshot data
433
+ def screenshot: (?type: String?, ?path: String?, ?full_page: bool?, ?clip: Hash[Symbol, Numeric]?, ?quality: Integer?, ?omit_background: bool?, ?encoding: String?, ?capture_beyond_viewport: bool?, ?from_surface: bool?) -> String
434
+
435
+ private def screenshot_task: (untyped format, untyped screenshot_options) -> untyped
436
+
437
+ class PrintToPdfIsNotImplementedError < Puppeteer::Error
438
+ # @rbs return: void -- No return value
439
+ def initialize: () -> void
440
+ end
441
+
442
+ # @rbs options: Hash[Symbol, untyped] -- PDF options
443
+ # @rbs return: Enumerable[String] -- PDF data chunks
444
+ def create_pdf_stream: (?Hash[Symbol, untyped] options) -> Enumerable[String]
445
+
446
+ # @rbs options: Hash[Symbol, untyped] -- PDF options
447
+ # @rbs return: String -- PDF data
448
+ def pdf: (?Hash[Symbol, untyped] options) -> String
449
+
450
+ # @rbs run_before_unload: bool -- Whether to run beforeunload handlers
451
+ # @rbs return: void -- No return value
452
+ def close: (?run_before_unload: bool) -> void
453
+
454
+ # @rbs return: bool -- Whether the page is closed
455
+ def closed?: () -> bool
456
+
457
+ attr_reader mouse: untyped
458
+
459
+ # @rbs selector: String -- CSS selector
460
+ # @rbs delay: Numeric? -- Delay between down and up (ms)
461
+ # @rbs button: String? -- Mouse button
462
+ # @rbs click_count: Integer? -- Deprecated: use count (click_count only sets clickCount)
463
+ # @rbs count: Integer? -- Number of clicks to perform
464
+ # @rbs return: void -- No return value
465
+ def click: (String selector, ?delay: Numeric?, ?button: String?, ?click_count: Integer?, ?count: Integer?) -> void
466
+
467
+ # @rbs selector: String -- CSS selector
468
+ # @rbs return: void -- No return value
469
+ def focus: (String selector) -> void
470
+
471
+ # @rbs selector: String -- CSS selector
472
+ # @rbs return: void -- No return value
473
+ def hover: (String selector) -> void
474
+
475
+ # @rbs selector: String -- CSS selector
476
+ # @rbs values: Array[String] -- Option values to select
477
+ # @rbs return: Array[String] -- Selected values
478
+ def select: (String selector, *untyped values) -> Array[String]
479
+
480
+ # @rbs selector: String? -- CSS selector
481
+ # @rbs block: Proc? -- Optional block for Object#tap usage
482
+ # @rbs return: Puppeteer::Page | nil -- Page instance or nil
483
+ def tap: (?selector: String?) ?{ (?) -> untyped } -> (Puppeteer::Page | nil)
484
+
485
+ # @rbs selector: String -- CSS selector
486
+ # @rbs text: String -- Text to type
487
+ # @rbs delay: Numeric? -- Delay between key presses (ms)
488
+ # @rbs return: void -- No return value
489
+ def type_text: (String selector, String text, ?delay: Numeric?) -> void
490
+
491
+ # @rbs selector: String -- CSS selector
492
+ # @rbs visible: bool? -- Wait for element to be visible
493
+ # @rbs hidden: bool? -- Wait for element to be hidden
494
+ # @rbs timeout: Numeric? -- Maximum wait time in milliseconds
495
+ # @rbs return: Puppeteer::ElementHandle? -- Matching element or nil
496
+ def wait_for_selector: (String selector, ?visible: bool?, ?hidden: bool?, ?timeout: Numeric?) -> Puppeteer::ElementHandle?
497
+
498
+ # @rbs milliseconds: Numeric -- Time to wait in milliseconds
499
+ # @rbs return: void -- No return value
500
+ def wait_for_timeout: (Numeric milliseconds) -> void
501
+
502
+ # @rbs xpath: String -- XPath expression
503
+ # @rbs visible: bool? -- Wait for element to be visible
504
+ # @rbs hidden: bool? -- Wait for element to be hidden
505
+ # @rbs timeout: Numeric? -- Maximum wait time in milliseconds
506
+ # @rbs return: Puppeteer::ElementHandle? -- Matching element or nil
507
+ def wait_for_xpath: (String xpath, ?visible: bool?, ?hidden: bool?, ?timeout: Numeric?) -> Puppeteer::ElementHandle?
508
+
509
+ # @rbs page_function: String -- Function or expression to evaluate
510
+ # @rbs args: Array[untyped] -- Arguments for evaluation
511
+ # @rbs polling: String | Numeric | nil -- Polling strategy
512
+ # @rbs timeout: Numeric? -- Maximum wait time in milliseconds
513
+ # @rbs return: Puppeteer::JSHandle -- Handle to evaluation result
514
+ def wait_for_function: (String page_function, ?args: Array[untyped], ?polling: String | Numeric | nil, ?timeout: Numeric?) -> Puppeteer::JSHandle
515
+ end
@@ -0,0 +1,98 @@
1
+ # Generated from lib/puppeteer/puppeteer.rb with RBS::Inline
2
+
3
+ class Puppeteer::Puppeteer
4
+ # @rbs project_root: String -- Project root directory
5
+ # @rbs preferred_revision: String -- Preferred Chromium revision
6
+ # @rbs is_puppeteer_core: bool -- Whether puppeteer-core mode is enabled
7
+ # @rbs return: void -- No return value
8
+ def initialize: (project_root: String, preferred_revision: String, is_puppeteer_core: bool) -> void
9
+
10
+ class NoViewport
11
+ end
12
+
13
+ # @rbs product: String? -- Browser product (chrome only)
14
+ # @rbs channel: (String | Symbol)? -- Browser channel
15
+ # @rbs executable_path: String? -- Path to browser executable
16
+ # @rbs ignore_default_args: Array[String]? -- Arguments to exclude from defaults
17
+ # @rbs handle_SIGINT: bool? -- Handle SIGINT in browser process
18
+ # @rbs handle_SIGTERM: bool? -- Handle SIGTERM in browser process
19
+ # @rbs handle_SIGHUP: bool? -- Handle SIGHUP in browser process
20
+ # @rbs timeout: Integer? -- Launch timeout in milliseconds
21
+ # @rbs dumpio: bool? -- Pipe browser stdout/stderr to current process
22
+ # @rbs env: Hash[String, String]? -- Environment variables for browser
23
+ # @rbs pipe: bool? -- Use pipe instead of WebSocket
24
+ # @rbs args: Array[String]? -- Additional browser arguments
25
+ # @rbs user_data_dir: String? -- Path to user data directory
26
+ # @rbs devtools: bool? -- Auto-open DevTools
27
+ # @rbs debugging_port: Integer? -- Remote debugging port
28
+ # @rbs headless: bool? -- Run browser in headless mode
29
+ # @rbs ignore_https_errors: bool? -- Ignore HTTPS errors
30
+ # @rbs network_enabled: bool? -- Enable network domain
31
+ # @rbs default_viewport: Puppeteer::Viewport? -- Default viewport
32
+ # @rbs slow_mo: Integer? -- Delay between operations (ms)
33
+ # @rbs protocol_timeout: Integer? -- CDP protocol timeout in milliseconds
34
+ # @rbs wait_for_initial_page: bool? -- Wait for initial page to load
35
+ # @rbs block: Proc? -- Optional block receiving the browser
36
+ # @rbs return: Puppeteer::Browser -- Browser instance
37
+ def launch: (?product: String?, ?channel: (String | Symbol)?, ?executable_path: String?, ?ignore_default_args: Array[String]?, ?handle_SIGINT: bool?, ?handle_SIGTERM: bool?, ?handle_SIGHUP: bool?, ?timeout: Integer?, ?dumpio: bool?, ?env: Hash[String, String]?, ?pipe: bool?, ?args: Array[String]?, ?user_data_dir: String?, ?devtools: bool?, ?debugging_port: Integer?, ?headless: bool?, ?ignore_https_errors: bool?, ?network_enabled: bool?, ?default_viewport: Puppeteer::Viewport?, ?slow_mo: Integer?, ?protocol_timeout: Integer?, ?wait_for_initial_page: bool?) ?{ (?) -> untyped } -> Puppeteer::Browser
38
+
39
+ # @rbs browser_ws_endpoint: String? -- Browser WebSocket endpoint
40
+ # @rbs browser_url: String? -- Browser HTTP URL for WebSocket discovery
41
+ # @rbs transport: Puppeteer::WebSocketTransport? -- Pre-connected transport
42
+ # @rbs ignore_https_errors: bool? -- Ignore HTTPS errors
43
+ # @rbs network_enabled: bool? -- Enable network domain
44
+ # @rbs default_viewport: Puppeteer::Viewport? -- Default viewport
45
+ # @rbs slow_mo: Integer? -- Delay between operations (ms)
46
+ # @rbs protocol_timeout: Integer? -- CDP protocol timeout in milliseconds
47
+ # @rbs block: Proc? -- Optional block receiving the browser
48
+ # @rbs return: Puppeteer::Browser -- Browser instance
49
+ def connect: (?browser_ws_endpoint: String?, ?browser_url: String?, ?transport: Puppeteer::WebSocketTransport?, ?ignore_https_errors: bool?, ?network_enabled: bool?, ?default_viewport: Puppeteer::Viewport?, ?slow_mo: Integer?, ?protocol_timeout: Integer?) ?{ (?) -> untyped } -> Puppeteer::Browser
50
+
51
+ # @rbs channel: String? -- Browser channel
52
+ # @rbs return: String -- Executable path
53
+ def executable_path: (?channel: String?) -> String
54
+
55
+ private def launcher: () -> untyped
56
+
57
+ # @rbs return: String -- Product name
58
+ def product: () -> String
59
+
60
+ private def async_context?: () -> untyped
61
+
62
+ # @rbs name: String -- Custom query handler name
63
+ # @rbs query_one: String? -- Query-one handler
64
+ # @rbs query_all: String? -- Query-all handler
65
+ # @rbs return: void -- No return value
66
+ def register_custom_query_handler: (name: String, ?query_one: String?, ?query_all: String?) -> void
67
+
68
+ # @rbs name: String -- Custom query handler name
69
+ # @rbs query_one: String? -- Query-one handler
70
+ # @rbs query_all: String? -- Query-all handler
71
+ # @rbs return: untyped -- Block result
72
+ def with_custom_query_handler: (name: String, ?query_one: String?, ?query_all: String?) ?{ (?) -> untyped } -> untyped
73
+
74
+ # @rbs name: String -- Custom query handler name
75
+ # @rbs return: void -- No return value
76
+ def unregister_custom_query_handler: (name: String) -> void
77
+
78
+ # @rbs return: void -- No return value
79
+ def clear_custom_query_handlers: () -> void
80
+
81
+ # @rbs return: Array[String] -- Registered custom query handler names
82
+ def custom_query_handler_names: () -> Array[String]
83
+
84
+ private def query_handler_manager: () -> untyped
85
+
86
+ # @rbs return: Puppeteer::Devices -- Devices registry
87
+ def devices: () -> Puppeteer::Devices
88
+
89
+ # @rbs return: Puppeteer::NetworkConditions -- Network conditions registry
90
+ def network_conditions: () -> Puppeteer::NetworkConditions
91
+
92
+ # @rbs args: Array[String]? -- Additional arguments
93
+ # @rbs user_data_dir: String? -- Path to user data directory
94
+ # @rbs devtools: bool? -- Enable DevTools
95
+ # @rbs headless: bool? -- Run browser in headless mode
96
+ # @rbs return: Array[String] -- Default launch arguments
97
+ def default_args: (?args: Array[String]?, ?user_data_dir: String?, ?devtools: bool?, ?headless: bool?) -> Array[String]
98
+ end
@@ -0,0 +1,78 @@
1
+ # Generated from lib/puppeteer/remote_object.rb with RBS::Inline
2
+
3
+ # providing #valueFromRemoteObject, #releaseObject
4
+ class Puppeteer::RemoteObject
5
+ include Puppeteer::DebugPrint
6
+
7
+ UNSERIALIZABLE_SENTINEL_KEY: ::String
8
+
9
+ NUMBER_SENTINEL_KEY: ::String
10
+
11
+ REGEXP_SENTINEL_KEY: ::String
12
+
13
+ # @param payload [Hash]
14
+ def initialize: (untyped payload) -> untyped
15
+
16
+ attr_reader sub_type: untyped
17
+
18
+ attr_reader type: untyped
19
+
20
+ attr_reader description: untyped
21
+
22
+ # @rbs return: bool
23
+ def object_id?: () -> bool
24
+
25
+ # @rbs return: String?
26
+ def object_id_value: () -> String?
27
+
28
+ # @return [String]
29
+ def type_str: () -> untyped
30
+
31
+ # used in JSHandle#properties
32
+ def properties: (untyped client) -> untyped
33
+
34
+ # used in ElementHandle#content_frame, ElementHandle#upload_file
35
+ def node_info: (untyped client) -> untyped
36
+
37
+ # used in ElementHandle#clickable_point
38
+ def content_quads: (untyped client) -> untyped
39
+
40
+ # used in ElementHandle#_box_model
41
+ def box_model: (untyped client) -> untyped
42
+
43
+ # used in ElementHandle#query_ax_tree
44
+ def query_ax_tree: (untyped client, ?accessible_name: untyped, ?role: untyped) -> untyped
45
+
46
+ # helper#valueFromRemoteObject
47
+ def value: () -> untyped
48
+
49
+ # @rbs value: untyped -- Serialized value from JavaScript
50
+ # @rbs return: untyped -- Normalized Ruby value
51
+ private def normalize_serialized_value: (untyped value) -> untyped
52
+
53
+ # @rbs value: String -- Special number string
54
+ # @rbs return: Float | String -- Parsed number or original value
55
+ private def unserializable_number: (String value) -> (Float | String)
56
+
57
+ # @rbs description: String -- Regexp description string
58
+ # @rbs return: [String, String] -- Source and flags tuple
59
+ private def parse_regexp: (String description) -> [ String, String ]
60
+
61
+ # @rbs value: untyped -- Date value from CDP
62
+ # @rbs return: Time? -- Parsed Ruby time
63
+ private def parse_date_value: (untyped value) -> Time?
64
+
65
+ # @rbs flags: String -- Regexp flags string
66
+ # @rbs return: Integer -- Ruby Regexp options
67
+ private def regexp_options: (String flags) -> Integer
68
+
69
+ # @param client [Puppeteer::CDPSession]
70
+ def release: (untyped client) -> untyped
71
+
72
+ def converted_arg: () -> untyped
73
+
74
+ # used in ElementHandle#upload_file
75
+ def set_file_input_files: (untyped client, untyped files, untyped backend_node_id) -> untyped
76
+
77
+ def scroll_into_view_if_needed: (untyped client) -> untyped
78
+ end