puppeteer-ruby 0.45.6 → 0.50.0.alpha6

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 (104) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -3
  3. data/AGENTS.md +170 -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 +605 -0
  9. data/CLAUDE/rbs_type_checking.md +101 -0
  10. data/CLAUDE/spec_migration_plans.md +1039 -0
  11. data/CLAUDE/testing.md +278 -0
  12. data/CLAUDE.md +242 -0
  13. data/README.md +9 -0
  14. data/Rakefile +7 -0
  15. data/Steepfile +28 -0
  16. data/docs/api_coverage.md +106 -57
  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 +236 -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 +177 -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 +77 -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/locators.rb +733 -0
  54. data/lib/puppeteer/mouse.rb +273 -64
  55. data/lib/puppeteer/network_event_manager.rb +7 -0
  56. data/lib/puppeteer/network_manager.rb +393 -112
  57. data/lib/puppeteer/p_query_handler.rb +367 -0
  58. data/lib/puppeteer/p_selector_parser.rb +241 -0
  59. data/lib/puppeteer/page/screenshot_task_queue.rb +14 -4
  60. data/lib/puppeteer/page.rb +583 -226
  61. data/lib/puppeteer/puppeteer.rb +171 -64
  62. data/lib/puppeteer/query_handler_manager.rb +66 -16
  63. data/lib/puppeteer/reactor_runner.rb +247 -0
  64. data/lib/puppeteer/remote_object.rb +127 -47
  65. data/lib/puppeteer/target.rb +74 -27
  66. data/lib/puppeteer/task_manager.rb +3 -1
  67. data/lib/puppeteer/timeout_helper.rb +6 -10
  68. data/lib/puppeteer/touch_handle.rb +39 -0
  69. data/lib/puppeteer/touch_screen.rb +72 -22
  70. data/lib/puppeteer/tracing.rb +3 -3
  71. data/lib/puppeteer/version.rb +1 -1
  72. data/lib/puppeteer/wait_task.rb +264 -101
  73. data/lib/puppeteer/web_socket.rb +2 -2
  74. data/lib/puppeteer/web_socket_transport.rb +91 -27
  75. data/lib/puppeteer/web_worker.rb +175 -0
  76. data/lib/puppeteer.rb +23 -4
  77. data/puppeteer-ruby.gemspec +15 -11
  78. data/sig/_external.rbs +8 -0
  79. data/sig/_supplementary.rbs +314 -0
  80. data/sig/puppeteer/browser.rbs +166 -0
  81. data/sig/puppeteer/cdp_session.rbs +64 -0
  82. data/sig/puppeteer/dialog.rbs +41 -0
  83. data/sig/puppeteer/element_handle.rbs +308 -0
  84. data/sig/puppeteer/execution_context.rbs +87 -0
  85. data/sig/puppeteer/frame.rbs +233 -0
  86. data/sig/puppeteer/http_request.rbs +214 -0
  87. data/sig/puppeteer/http_response.rbs +89 -0
  88. data/sig/puppeteer/js_handle.rbs +64 -0
  89. data/sig/puppeteer/keyboard.rbs +40 -0
  90. data/sig/puppeteer/locators.rbs +222 -0
  91. data/sig/puppeteer/mouse.rbs +113 -0
  92. data/sig/puppeteer/p_query_handler.rbs +73 -0
  93. data/sig/puppeteer/p_selector_parser.rbs +31 -0
  94. data/sig/puppeteer/page.rbs +522 -0
  95. data/sig/puppeteer/puppeteer.rbs +98 -0
  96. data/sig/puppeteer/remote_object.rbs +78 -0
  97. data/sig/puppeteer/touch_handle.rbs +21 -0
  98. data/sig/puppeteer/touch_screen.rbs +35 -0
  99. data/sig/puppeteer/web_worker.rbs +83 -0
  100. metadata +122 -45
  101. data/CHANGELOG.md +0 -397
  102. data/lib/puppeteer/concurrent_ruby_utils.rb +0 -81
  103. data/lib/puppeteer/firefox_target_manager.rb +0 -157
  104. data/lib/puppeteer/launcher/firefox.rb +0 -453
@@ -0,0 +1,522 @@
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
+ # @rbs return: Numeric -- Default timeout in milliseconds
142
+ def default_timeout: () -> Numeric
143
+
144
+ # @rbs selector_or_function: String -- Selector or JS function
145
+ # @rbs return: Puppeteer::Locator -- Locator for selector or function
146
+ def locator: (String selector_or_function) -> Puppeteer::Locator
147
+
148
+ # `$()` in JavaScript.
149
+ # @rbs selector: String -- CSS selector
150
+ # @rbs return: Puppeteer::ElementHandle? -- Matching element or nil
151
+ def query_selector: (String selector) -> Puppeteer::ElementHandle?
152
+
153
+ # `$$()` in JavaScript.
154
+ # @rbs selector: String -- CSS selector
155
+ # @rbs isolate: bool? -- Use isolated world for queries
156
+ # @rbs return: Array[Puppeteer::ElementHandle] -- Matching elements
157
+ def query_selector_all: (String selector, ?isolate: bool?) -> Array[Puppeteer::ElementHandle]
158
+
159
+ # @rbs page_function: String -- Function or expression to evaluate
160
+ # @rbs args: Array[untyped] -- Arguments for evaluation
161
+ # @rbs return: Puppeteer::JSHandle -- Handle to evaluation result
162
+ def evaluate_handle: (String page_function, *untyped args) -> Puppeteer::JSHandle
163
+
164
+ # @rbs prototype_handle: Puppeteer::JSHandle -- Prototype handle
165
+ # @rbs return: Puppeteer::JSHandle -- Handle to query result
166
+ def query_objects: (Puppeteer::JSHandle prototype_handle) -> Puppeteer::JSHandle
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: (String selector, String page_function, *untyped args) -> untyped
174
+
175
+ # `$$eval()` in JavaScript.
176
+ # @rbs selector: String -- CSS selector
177
+ # @rbs page_function: String -- Function or expression to evaluate
178
+ # @rbs args: Array[untyped] -- Arguments for evaluation
179
+ # @rbs return: untyped -- Evaluation result
180
+ def eval_on_selector_all: (String selector, String page_function, *untyped args) -> untyped
181
+
182
+ # `$x()` in JavaScript. $ is not allowed to use as a method name in Ruby.
183
+ # @rbs expression: String -- XPath expression
184
+ # @rbs return: Array[Puppeteer::ElementHandle] -- Matching elements
185
+ def Sx: (String expression) -> Array[Puppeteer::ElementHandle]
186
+
187
+ # @rbs urls: Array[String] -- URLs to fetch cookies for
188
+ # @rbs return: Array[Hash[String, untyped]] -- Cookies list
189
+ def cookies: (*untyped urls) -> Array[Hash[String, untyped]]
190
+
191
+ # check if each cookie element has required fields ('name' and 'value')
192
+ private def assert_cookie_params: (untyped cookies, requires: untyped) -> untyped
193
+
194
+ # @rbs cookies: Array[Hash[Symbol | String, untyped]] -- cookies parameter
195
+ # @rbs return: void -- No return value
196
+ def delete_cookie: (*untyped cookies) -> void
197
+
198
+ # @rbs cookies: Array[Hash[Symbol | String, untyped]] -- cookies parameter
199
+ # @rbs return: void -- No return value
200
+ def set_cookie: (*untyped cookies) -> void
201
+
202
+ # @rbs url: String? -- Script URL
203
+ # @rbs path: String? -- Path to script file
204
+ # @rbs content: String? -- Script contents
205
+ # @rbs type: String? -- Script type
206
+ # @rbs id: String? -- Script element ID
207
+ # @rbs return: Puppeteer::ElementHandle -- Script element handle
208
+ def add_script_tag: (?url: String?, ?path: String?, ?content: String?, ?type: String?, ?id: String?) -> Puppeteer::ElementHandle
209
+
210
+ # @rbs url: String? -- Stylesheet URL
211
+ # @rbs path: String? -- Path to stylesheet file
212
+ # @rbs content: String? -- Stylesheet contents
213
+ # @rbs return: Puppeteer::ElementHandle -- Style element handle
214
+ def add_style_tag: (?url: String?, ?path: String?, ?content: String?) -> Puppeteer::ElementHandle
215
+
216
+ # @rbs name: String -- Binding name
217
+ # @rbs puppeteer_function: Proc -- Ruby callback
218
+ # @rbs return: void -- No return value
219
+ def expose_function: (String name, Proc puppeteer_function) -> void
220
+
221
+ # @rbs name: String -- Binding name
222
+ # @rbs return: void -- No return value
223
+ def remove_exposed_function: (String name) -> void
224
+
225
+ # @rbs username: String? -- HTTP basic auth username
226
+ # @rbs password: String? -- HTTP basic auth password
227
+ # @rbs return: void -- No return value
228
+ def authenticate: (?username: String?, ?password: String?) -> void
229
+
230
+ # @rbs headers: Hash[String, String] -- Extra HTTP headers
231
+ # @rbs return: void -- No return value
232
+ def extra_http_headers=: (Hash[String, String] headers) -> void
233
+
234
+ # @rbs user_agent: String -- User agent string
235
+ # @rbs user_agent_metadata: Hash[String, untyped]? -- User agent metadata
236
+ # @rbs return: void -- No return value
237
+ def set_user_agent: (String user_agent, ?Hash[String, untyped]? user_agent_metadata) -> void
238
+
239
+ # @rbs return: Puppeteer::Page::Metrics -- Page metrics
240
+ def metrics: () -> Puppeteer::Page::Metrics
241
+
242
+ class PageError < Puppeteer::Error
243
+ end
244
+
245
+ private def handle_exception: (untyped exception_details) -> untyped
246
+
247
+ private def handle_console_api: (untyped event) -> untyped
248
+
249
+ # @rbs event: Hash[String, untyped] -- Binding called payload
250
+ # @rbs return: void -- No return value
251
+ def handle_binding_called: (Hash[String, untyped] event) -> void
252
+
253
+ private def add_console_message: (untyped type, untyped args, untyped stack_trace) -> untyped
254
+
255
+ private def handle_dialog_opening: (untyped event) -> untyped
256
+
257
+ private def set_transparent_background_color: () ?{ (?) -> untyped } -> untyped
258
+
259
+ private def reset_default_background_color: () ?{ (?) -> untyped } -> untyped
260
+
261
+ # @rbs return: String? -- Page URL
262
+ def url: () -> String?
263
+
264
+ # @rbs return: String -- Page HTML content
265
+ def content: () -> String
266
+
267
+ # @rbs html: String -- HTML content
268
+ # @rbs timeout: Numeric? -- Navigation timeout in milliseconds
269
+ # @rbs wait_until: String | Array[String] | nil -- Lifecycle events to wait for
270
+ # @rbs return: void -- No return value
271
+ def set_content: (String html, ?timeout: Numeric?, ?wait_until: String | Array[String] | nil) -> void
272
+
273
+ # @rbs html: String -- HTML content
274
+ # @rbs return: void -- No return value
275
+ def content=: (String html) -> void
276
+
277
+ # @rbs url: String -- URL to navigate
278
+ # @rbs referer: String? -- Referer header value
279
+ # @rbs referer: String? -- Referer header value
280
+ # @rbs referrer_policy: String? -- Referrer policy
281
+ # @rbs timeout: Numeric? -- Navigation timeout in milliseconds
282
+ # @rbs wait_until: String | Array[String] | nil -- Lifecycle events to wait for
283
+ # @rbs return: Puppeteer::HTTPResponse? -- Navigation response
284
+ def goto: (String url, ?referer: String?, ?referrer_policy: String?, ?timeout: Numeric?, ?wait_until: String | Array[String] | nil) -> Puppeteer::HTTPResponse?
285
+
286
+ # @rbs timeout: Numeric? -- Navigation timeout in milliseconds
287
+ # @rbs wait_until: String | Array[String] | nil -- Lifecycle events to wait for
288
+ # @rbs ignore_cache: bool? -- Skip cache when reloading
289
+ # @rbs return: Puppeteer::HTTPResponse? -- Navigation response
290
+ def reload: (?timeout: Numeric?, ?wait_until: String | Array[String] | nil, ?ignore_cache: bool?) -> Puppeteer::HTTPResponse?
291
+
292
+ # @rbs timeout: Numeric? -- Navigation timeout in milliseconds
293
+ # @rbs wait_until: String | Array[String] | nil -- Lifecycle events to wait for
294
+ # @rbs ignore_same_document_navigation: bool -- Ignore same-document navigation
295
+ # @rbs return: Puppeteer::HTTPResponse? -- Navigation response
296
+ def wait_for_navigation: (?timeout: Numeric?, ?wait_until: String | Array[String] | nil, ?ignore_same_document_navigation: bool) -> Puppeteer::HTTPResponse?
297
+
298
+ private def wait_for_network_manager_event: (untyped event_name, predicate: untyped, timeout: untyped) -> untyped
299
+
300
+ private def wait_for_frame_manager_event: (*untyped event_names, predicate: untyped, timeout: untyped) -> untyped
301
+
302
+ private def session_close_promise: () -> untyped
303
+
304
+ # @rbs url: String? -- URL to match
305
+ # @rbs predicate: Proc? -- Predicate to match
306
+ # @rbs timeout: Numeric? -- Timeout in milliseconds
307
+ # @rbs return: Puppeteer::HTTPRequest -- Matching request
308
+ def wait_for_request: (?url: String?, ?predicate: Proc?, ?timeout: Numeric?) -> Puppeteer::HTTPRequest
309
+
310
+ # @rbs url: String? -- URL to match
311
+ # @rbs predicate: Proc? -- Predicate to match
312
+ # @rbs timeout: Numeric? -- Timeout in milliseconds
313
+ # @rbs return: Puppeteer::HTTPResponse -- Matching response
314
+ def wait_for_response: (?url: String?, ?predicate: Proc?, ?timeout: Numeric?) -> Puppeteer::HTTPResponse
315
+
316
+ # @rbs idle_time: Numeric -- Idle time to wait for in milliseconds
317
+ # @rbs timeout: Numeric? -- Timeout in milliseconds
318
+ # @rbs concurrency: Integer -- Allowed number of concurrent requests
319
+ # @rbs return: void -- No return value
320
+ def wait_for_network_idle: (?idle_time: Numeric, ?timeout: Numeric?, ?concurrency: Integer) -> void
321
+
322
+ # @rbs url: String? -- URL to match
323
+ # @rbs predicate: Proc? -- Predicate to match
324
+ # @rbs timeout: Numeric? -- Timeout in milliseconds
325
+ # @rbs return: Puppeteer::Frame -- Matching frame
326
+ def wait_for_frame: (?url: String?, ?predicate: Proc?, ?timeout: Numeric?) -> Puppeteer::Frame
327
+
328
+ # @rbs timeout: Numeric? -- Navigation timeout in milliseconds
329
+ # @rbs wait_until: String | Array[String] | nil -- Lifecycle events to wait for
330
+ # @rbs return: Puppeteer::HTTPResponse? -- Navigation response
331
+ def go_back: (?timeout: Numeric?, ?wait_until: String | Array[String] | nil) -> Puppeteer::HTTPResponse?
332
+
333
+ # @rbs timeout: Numeric? -- Navigation timeout in milliseconds
334
+ # @rbs wait_until: String | Array[String] | nil -- Lifecycle events to wait for
335
+ # @rbs return: Puppeteer::HTTPResponse? -- Navigation response
336
+ def go_forward: (?timeout: Numeric?, ?wait_until: String | Array[String] | nil) -> Puppeteer::HTTPResponse?
337
+
338
+ private def go: (untyped delta, ?timeout: untyped, ?wait_until: untyped) -> untyped
339
+
340
+ # Brings page to front (activates tab).
341
+ # @rbs return: void -- No return value
342
+ def bring_to_front: () -> void
343
+
344
+ # @rbs device: Puppeteer::Device -- Device descriptor
345
+ # @rbs return: void -- No return value
346
+ def emulate: (Puppeteer::Device device) -> void
347
+
348
+ # @rbs enabled: bool -- Enable JavaScript
349
+ # @rbs return: void -- No return value
350
+ def javascript_enabled=: (bool enabled) -> void
351
+
352
+ # @rbs enabled: bool -- Enable bypassing CSP
353
+ # @rbs return: void -- No return value
354
+ def bypass_csp=: (bool enabled) -> void
355
+
356
+ # @rbs media_type: (String | Symbol)? -- Media type override
357
+ # @rbs return: void -- No return value
358
+ def emulate_media_type: ((String | Symbol)? media_type) -> void
359
+
360
+ # @rbs factor: Numeric? -- CPU throttling rate
361
+ # @rbs return: void -- No return value
362
+ def emulate_cpu_throttling: (Numeric? factor) -> void
363
+
364
+ # @rbs features: Array[Hash[Symbol, untyped]]? -- Media feature overrides
365
+ # @rbs return: void -- No return value
366
+ def emulate_media_features: (Array[Hash[Symbol, untyped]]? features) -> void
367
+
368
+ # @rbs timezone_id: String? -- Timezone ID
369
+ # @rbs return: void -- No return value
370
+ def emulate_timezone: (String? timezone_id) -> void
371
+
372
+ VISION_DEFICIENCY_TYPES: untyped
373
+
374
+ # @rbs vision_deficiency_type: String? -- Vision deficiency type
375
+ # @rbs return: void -- No return value
376
+ def emulate_vision_deficiency: (String? vision_deficiency_type) -> void
377
+
378
+ # @rbs is_user_active: bool? -- User activity override
379
+ # @rbs is_screen_unlocked: bool? -- Screen unlocked override
380
+ # @rbs return: void -- No return value
381
+ def emulate_idle_state: (?is_user_active: bool?, ?is_screen_unlocked: bool?) -> void
382
+
383
+ # @rbs viewport: Puppeteer::Viewport? -- Viewport settings
384
+ # @rbs return: void -- No return value
385
+ def viewport=: (Puppeteer::Viewport? viewport) -> void
386
+
387
+ attr_reader viewport: untyped
388
+
389
+ # @rbs page_function: String -- page_function parameter
390
+ # @rbs args: Array[untyped] -- args parameter
391
+ # @rbs return: untyped -- Result
392
+ def evaluate: (String page_function, *untyped args) -> untyped
393
+
394
+ class JavaScriptFunction
395
+ # @rbs expression: String -- Function expression
396
+ # @rbs args: Array[untyped] -- Arguments for evaluation
397
+ # @rbs return: void -- No return value
398
+ def initialize: (String expression, Array[untyped] args) -> void
399
+
400
+ # @rbs return: String -- Generated source
401
+ def source: () -> String
402
+
403
+ private def arguments: () -> untyped
404
+ end
405
+
406
+ class JavaScriptExpression
407
+ # @rbs expression: String -- Expression to evaluate
408
+ # @rbs return: void -- No return value
409
+ def initialize: (String expression) -> void
410
+
411
+ # @rbs return: String -- Generated source
412
+ def source: () -> String
413
+ end
414
+
415
+ # @rbs page_function: String -- page_function parameter
416
+ # @rbs args: Array[untyped] -- args parameter
417
+ # @rbs return: Hash[String, untyped] -- CDP response
418
+ def evaluate_on_new_document: (String page_function, *untyped args) -> Hash[String, untyped]
419
+
420
+ # @rbs identifier: String -- Script identifier to remove
421
+ # @rbs return: void
422
+ def remove_script_to_evaluate_on_new_document: (String identifier) -> void
423
+
424
+ # @rbs enabled: bool -- Enable cache usage
425
+ def cache_enabled=: (bool enabled) -> untyped
426
+
427
+ # @rbs return: String -- Page title
428
+ def title: () -> String
429
+
430
+ # @rbs type: String? -- Image format
431
+ # @rbs path: String? -- File path to save
432
+ # @rbs full_page: bool? -- Capture full page
433
+ # @rbs clip: Hash[Symbol, Numeric]? -- Clip rectangle
434
+ # @rbs quality: Integer? -- JPEG quality
435
+ # @rbs omit_background: bool? -- Omit background for PNG
436
+ # @rbs encoding: String? -- Encoding (base64 or binary)
437
+ # @rbs capture_beyond_viewport: bool? -- Capture beyond viewport
438
+ # @rbs from_surface: bool? -- Capture from surface
439
+ # @rbs return: String -- Screenshot data
440
+ 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
441
+
442
+ private def screenshot_task: (untyped format, untyped screenshot_options) -> untyped
443
+
444
+ class PrintToPdfIsNotImplementedError < Puppeteer::Error
445
+ # @rbs return: void -- No return value
446
+ def initialize: () -> void
447
+ end
448
+
449
+ # @rbs options: Hash[Symbol, untyped] -- PDF options
450
+ # @rbs return: Enumerable[String] -- PDF data chunks
451
+ def create_pdf_stream: (?Hash[Symbol, untyped] options) -> Enumerable[String]
452
+
453
+ # @rbs options: Hash[Symbol, untyped] -- PDF options
454
+ # @rbs return: String -- PDF data
455
+ def pdf: (?Hash[Symbol, untyped] options) -> String
456
+
457
+ # @rbs run_before_unload: bool -- Whether to run beforeunload handlers
458
+ # @rbs return: void -- No return value
459
+ def close: (?run_before_unload: bool) -> void
460
+
461
+ # @rbs return: bool -- Whether the page is closed
462
+ def closed?: () -> bool
463
+
464
+ attr_reader mouse: untyped
465
+
466
+ # @rbs selector: String -- CSS selector
467
+ # @rbs delay: Numeric? -- Delay between down and up (ms)
468
+ # @rbs button: String? -- Mouse button
469
+ # @rbs click_count: Integer? -- Deprecated: use count (click_count only sets clickCount)
470
+ # @rbs count: Integer? -- Number of clicks to perform
471
+ # @rbs return: void -- No return value
472
+ def click: (String selector, ?delay: Numeric?, ?button: String?, ?click_count: Integer?, ?count: Integer?) -> void
473
+
474
+ # @rbs selector: String -- CSS selector
475
+ # @rbs return: void -- No return value
476
+ def focus: (String selector) -> void
477
+
478
+ # @rbs selector: String -- CSS selector
479
+ # @rbs return: void -- No return value
480
+ def hover: (String selector) -> void
481
+
482
+ # @rbs selector: String -- CSS selector
483
+ # @rbs values: Array[String] -- Option values to select
484
+ # @rbs return: Array[String] -- Selected values
485
+ def select: (String selector, *untyped values) -> Array[String]
486
+
487
+ # @rbs selector: String? -- CSS selector
488
+ # @rbs block: Proc? -- Optional block for Object#tap usage
489
+ # @rbs return: Puppeteer::Page | nil -- Page instance or nil
490
+ def tap: (?selector: String?) ?{ (?) -> untyped } -> (Puppeteer::Page | nil)
491
+
492
+ # @rbs selector: String -- CSS selector
493
+ # @rbs text: String -- Text to type
494
+ # @rbs delay: Numeric? -- Delay between key presses (ms)
495
+ # @rbs return: void -- No return value
496
+ def type_text: (String selector, String text, ?delay: Numeric?) -> void
497
+
498
+ # @rbs selector: String -- CSS selector
499
+ # @rbs visible: bool? -- Wait for element to be visible
500
+ # @rbs hidden: bool? -- Wait for element to be hidden
501
+ # @rbs timeout: Numeric? -- Maximum wait time in milliseconds
502
+ # @rbs return: Puppeteer::ElementHandle? -- Matching element or nil
503
+ def wait_for_selector: (String selector, ?visible: bool?, ?hidden: bool?, ?timeout: Numeric?) -> Puppeteer::ElementHandle?
504
+
505
+ # @rbs milliseconds: Numeric -- Time to wait in milliseconds
506
+ # @rbs return: void -- No return value
507
+ def wait_for_timeout: (Numeric milliseconds) -> void
508
+
509
+ # @rbs xpath: String -- XPath expression
510
+ # @rbs visible: bool? -- Wait for element to be visible
511
+ # @rbs hidden: bool? -- Wait for element to be hidden
512
+ # @rbs timeout: Numeric? -- Maximum wait time in milliseconds
513
+ # @rbs return: Puppeteer::ElementHandle? -- Matching element or nil
514
+ def wait_for_xpath: (String xpath, ?visible: bool?, ?hidden: bool?, ?timeout: Numeric?) -> Puppeteer::ElementHandle?
515
+
516
+ # @rbs page_function: String -- Function or expression to evaluate
517
+ # @rbs args: Array[untyped] -- Arguments for evaluation
518
+ # @rbs polling: String | Numeric | nil -- Polling strategy
519
+ # @rbs timeout: Numeric? -- Maximum wait time in milliseconds
520
+ # @rbs return: Puppeteer::JSHandle -- Handle to evaluation result
521
+ def wait_for_function: (String page_function, ?args: Array[untyped], ?polling: String | Numeric | nil, ?timeout: Numeric?) -> Puppeteer::JSHandle
522
+ 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