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,308 @@
1
+ # Generated from lib/puppeteer/element_handle.rb with RBS::Inline
2
+
3
+ class Puppeteer::ElementHandle < Puppeteer::JSHandle
4
+ include Puppeteer::DebugPrint
5
+
6
+ include Puppeteer::IfPresent
7
+
8
+ # @rbs context: Puppeteer::ExecutionContext -- Execution context
9
+ # @rbs client: Puppeteer::CDPSession -- CDP session
10
+ # @rbs remote_object: Puppeteer::RemoteObject -- Remote object handle
11
+ # @rbs frame: Puppeteer::Frame -- Owning frame
12
+ def initialize: (context: Puppeteer::ExecutionContext, client: Puppeteer::CDPSession, remote_object: Puppeteer::RemoteObject, frame: Puppeteer::Frame) -> untyped
13
+
14
+ attr_reader page: untyped
15
+
16
+ attr_reader frame: untyped
17
+
18
+ attr_reader frame_manager: untyped
19
+
20
+ # @rbs return: String -- Inspection string
21
+ def inspect: () -> String
22
+
23
+ #
24
+ # Wait for the `selector` to appear within the element. If at the moment of calling the
25
+ # method the `selector` already exists, the method will return immediately. If
26
+ # the `selector` doesn't appear after the `timeout` milliseconds of waiting, the
27
+ # function will throw.
28
+ #
29
+ # This method does not work across navigations or if the element is detached from DOM.
30
+ #
31
+ # {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | selector}
32
+ # of an element to wait for
33
+ # is added to DOM. Resolves to `null` if waiting for hidden: `true` and
34
+ # selector is not found in DOM.
35
+ # @remarks
36
+ # The optional parameters in `options` are:
37
+ #
38
+ # - `visible`: wait for the selected element to be present in DOM and to be
39
+ # visible, i.e. to not have `display: none` or `visibility: hidden` CSS
40
+ # properties. Defaults to `false`.
41
+ #
42
+ # - `hidden`: wait for the selected element to not be found in the DOM or to be hidden,
43
+ # i.e. have `display: none` or `visibility: hidden` CSS properties. Defaults to
44
+ # `false`.
45
+ #
46
+ # - `timeout`: maximum time to wait in milliseconds. Defaults to `30000`
47
+ # (30 seconds). Pass `0` to disable timeout. The default value can be changed
48
+ # by using the {@link Page.setDefaultTimeout} method.
49
+ # @rbs selector: String -- CSS selector
50
+ # @rbs visible: bool? -- Wait for element to be visible
51
+ # @rbs hidden: bool? -- Wait for element to be hidden
52
+ # @rbs timeout: Numeric? -- Maximum wait time in milliseconds
53
+ # @rbs return: Puppeteer::ElementHandle? -- Matched element handle
54
+ def wait_for_selector: (String selector, ?visible: bool?, ?hidden: bool?, ?timeout: Numeric?) -> Puppeteer::ElementHandle?
55
+
56
+ # Wait for the `xpath` within the element. If at the moment of calling the
57
+ # method the `xpath` already exists, the method will return immediately. If
58
+ # the `xpath` doesn't appear after the `timeout` milliseconds of waiting, the
59
+ # function will throw.
60
+ #
61
+ # If `xpath` starts with `//` instead of `.//`, the dot will be appended automatically.
62
+ #
63
+ # This method works across navigation
64
+ # ```js
65
+ # const puppeteer = require('puppeteer');
66
+ # (async () => {
67
+ # const browser = await puppeteer.launch();
68
+ # const page = await browser.newPage();
69
+ # let currentURL;
70
+ # page
71
+ # .waitForXPath('//img')
72
+ # .then(() => console.log('First URL with image: ' + currentURL));
73
+ # for (currentURL of [
74
+ # 'https://example.com',
75
+ # 'https://google.com',
76
+ # 'https://bbc.com',
77
+ # ]) {
78
+ # await page.goto(currentURL);
79
+ # }
80
+ # await browser.close();
81
+ # })();
82
+ # ```
83
+ # {@link https://developer.mozilla.org/en-US/docs/Web/XPath | xpath} of an
84
+ # element to wait for
85
+ # added to DOM. Resolves to `null` if waiting for `hidden: true` and xpath is
86
+ # not found in DOM.
87
+ # @remarks
88
+ # The optional Argument `options` have properties:
89
+ #
90
+ # - `visible`: A boolean to wait for element to be present in DOM and to be
91
+ # visible, i.e. to not have `display: none` or `visibility: hidden` CSS
92
+ # properties. Defaults to `false`.
93
+ #
94
+ # - `hidden`: A boolean wait for element to not be found in the DOM or to be
95
+ # hidden, i.e. have `display: none` or `visibility: hidden` CSS properties.
96
+ # Defaults to `false`.
97
+ #
98
+ # - `timeout`: A number which is maximum time to wait for in milliseconds.
99
+ # Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default
100
+ # value can be changed by using the {@link Page.setDefaultTimeout} method.
101
+ # @rbs xpath: String -- XPath expression
102
+ # @rbs visible: bool? -- Wait for element to be visible
103
+ # @rbs hidden: bool? -- Wait for element to be hidden
104
+ # @rbs timeout: Numeric? -- Maximum wait time in milliseconds
105
+ # @rbs return: Puppeteer::ElementHandle? -- Matched element handle
106
+ def wait_for_xpath: (String xpath, ?visible: bool?, ?hidden: bool?, ?timeout: Numeric?) -> Puppeteer::ElementHandle?
107
+
108
+ # @rbs tag_name: String -- Tag name to assert
109
+ # @rbs return: Puppeteer::ElementHandle -- Element handle
110
+ def to_element: (String tag_name) -> Puppeteer::ElementHandle
111
+
112
+ # @rbs return: Puppeteer::ElementHandle -- Element handle
113
+ def as_element: () -> Puppeteer::ElementHandle
114
+
115
+ # @rbs return: Puppeteer::Locator -- Locator for this element
116
+ def as_locator: () -> Puppeteer::Locator
117
+
118
+ # @rbs return: bool -- Whether element is visible
119
+ def visible?: () -> bool
120
+
121
+ # @rbs return: bool -- Whether element is hidden
122
+ def hidden?: () -> bool
123
+
124
+ # @rbs visible: bool -- Expected visibility state
125
+ # @rbs return: bool -- Whether visibility matches
126
+ private def check_visibility: (bool visible) -> bool
127
+
128
+ # @rbs return: Puppeteer::Frame? -- Frame that owns this element
129
+ def content_frame: () -> Puppeteer::Frame?
130
+
131
+ class ScrollIntoViewError < Puppeteer::Error
132
+ end
133
+
134
+ # @rbs return: void -- No return value
135
+ def scroll_into_view_if_needed: () -> void
136
+
137
+ class ElementNotVisibleError < Puppeteer::Error
138
+ def initialize: () -> untyped
139
+ end
140
+
141
+ class ElementNotClickableError < Puppeteer::Error
142
+ def initialize: () -> untyped
143
+ end
144
+
145
+ # @rbs quad: Array[Point] -- Quad points
146
+ # @rbs offset: Point -- Offset to apply
147
+ # @rbs return: Array[Point] -- Offset quad points
148
+ private def apply_offsets_to_quad: (Array[Point] quad, Point offset) -> Array[Point]
149
+
150
+ # @rbs frame: Puppeteer::Frame -- Frame to calculate offsets for
151
+ # @rbs return: Point -- Calculated offset
152
+ private def oopif_offsets: (Puppeteer::Frame frame) -> Point
153
+
154
+ # @rbs offset: Puppeteer::ElementHandle::Offset | Hash[Symbol, Numeric] | nil -- Click offset
155
+ # @rbs return: Puppeteer::ElementHandle::Point -- Clickable point
156
+ def clickable_point: (?Puppeteer::ElementHandle::Offset | Hash[Symbol, Numeric] | nil offset) -> Puppeteer::ElementHandle::Point
157
+
158
+ # @rbs quad: Array[Numeric] -- Protocol quad coordinates
159
+ # @rbs return: Array[Point] -- Point array
160
+ private def from_protocol_quad: (Array[Numeric] quad) -> Array[Point]
161
+
162
+ private def intersect_quad_with_viewport: (untyped quad, untyped width, untyped height) -> untyped
163
+
164
+ # @rbs return: void -- No return value
165
+ def hover: () -> void
166
+
167
+ # @rbs delay: Numeric? -- Delay between down and up (ms)
168
+ # @rbs button: String? -- Mouse button
169
+ # @rbs click_count: Integer? -- Deprecated: use count (click_count only sets clickCount)
170
+ # @rbs count: Integer? -- Number of clicks to perform
171
+ # @rbs offset: Puppeteer::ElementHandle::Offset | Hash[Symbol, Numeric] | nil -- Click offset
172
+ # @rbs return: void -- No return value
173
+ def click: (?delay: Numeric?, ?button: String?, ?click_count: Integer?, ?count: Integer?, ?offset: Puppeteer::ElementHandle::Offset | Hash[Symbol, Numeric] | nil) -> void
174
+
175
+ # @rbs return: Puppeteer::TouchHandle -- Touch handle
176
+ def touch_start: () -> Puppeteer::TouchHandle
177
+
178
+ # @rbs touch: Puppeteer::TouchHandle? -- Optional touch handle
179
+ # @rbs return: void -- No return value
180
+ def touch_move: (?Puppeteer::TouchHandle? touch) -> void
181
+
182
+ # @rbs return: void -- No return value
183
+ def touch_end: () -> void
184
+
185
+ class DragInterceptionNotEnabledError < Puppeteer::Error
186
+ def initialize: () -> untyped
187
+ end
188
+
189
+ # @rbs x: Numeric -- Drag end X coordinate
190
+ # @rbs y: Numeric -- Drag end Y coordinate
191
+ # @rbs return: void -- No return value
192
+ def drag: (x: Numeric, y: Numeric) -> void
193
+
194
+ # @rbs data: Hash[String, untyped] -- Drag data payload
195
+ # @rbs return: void -- No return value
196
+ def drag_enter: (Hash[String, untyped] data) -> void
197
+
198
+ # @rbs data: Hash[String, untyped] -- Drag data payload
199
+ # @rbs return: void -- No return value
200
+ def drag_over: (Hash[String, untyped] data) -> void
201
+
202
+ # @rbs data: Hash[String, untyped] -- Drag data payload
203
+ # @rbs return: void -- No return value
204
+ def drop: (Hash[String, untyped] data) -> void
205
+
206
+ # @rbs target: Puppeteer::ElementHandle -- Drop target element
207
+ # @rbs delay: Numeric? -- Delay before dropping (ms)
208
+ # @rbs return: void -- No return value
209
+ def drag_and_drop: (Puppeteer::ElementHandle target, ?delay: Numeric?) -> void
210
+
211
+ # @rbs values: Array[String] -- Option values to select
212
+ # @rbs return: Array[String] -- Selected values
213
+ def select: (*untyped values) -> Array[String]
214
+
215
+ # @rbs file_paths: Array[String] -- Files to upload
216
+ # @rbs return: void -- No return value
217
+ def upload_file: (*untyped file_paths) -> void
218
+
219
+ # @rbs block: Proc? -- Optional block for Object#tap usage
220
+ # @rbs return: Puppeteer::ElementHandle | nil -- Element handle or nil
221
+ def tap: () ?{ (?) -> untyped } -> (Puppeteer::ElementHandle | nil)
222
+
223
+ # @rbs return: void -- No return value
224
+ def focus: () -> void
225
+
226
+ # @rbs text: String -- Text to type
227
+ # @rbs delay: Numeric? -- Delay between key presses (ms)
228
+ # @rbs return: void -- No return value
229
+ def type_text: (String text, ?delay: Numeric?) -> void
230
+
231
+ # @rbs key: String -- Key name
232
+ # @rbs delay: Numeric? -- Delay between key events (ms)
233
+ # @rbs text: String? -- Text to input
234
+ # @rbs return: void -- No return value
235
+ def press: (String key, ?delay: Numeric?, ?text: String?) -> void
236
+
237
+ # @rbs return: Puppeteer::ElementHandle::BoundingBox? -- Bounding box or nil
238
+ def bounding_box: () -> Puppeteer::ElementHandle::BoundingBox?
239
+
240
+ # @rbs return: Puppeteer::ElementHandle::BoxModel? -- Box model or nil
241
+ def box_model: () -> Puppeteer::ElementHandle::BoxModel?
242
+
243
+ # @rbs type: String? -- Image format
244
+ # @rbs path: String? -- File path to save
245
+ # @rbs full_page: bool? -- Capture full page
246
+ # @rbs clip: Hash[Symbol, Numeric]? -- Clip rectangle
247
+ # @rbs quality: Integer? -- JPEG quality
248
+ # @rbs omit_background: bool? -- Omit background for PNG
249
+ # @rbs encoding: String? -- Encoding (base64 or binary)
250
+ # @rbs capture_beyond_viewport: bool? -- Capture beyond viewport
251
+ # @rbs from_surface: bool? -- Capture from surface
252
+ # @rbs return: String -- Screenshot data
253
+ 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
254
+
255
+ private def query_handler_manager: () -> untyped
256
+
257
+ private def query_selector_in_isolated_world: (untyped selector) -> untyped
258
+
259
+ private def query_selector_all_in_isolated_world: (untyped selector) -> untyped
260
+
261
+ # `$()` in JavaScript.
262
+ # @rbs selector: String -- CSS selector
263
+ # @rbs return: Puppeteer::ElementHandle? -- Matching element or nil
264
+ def query_selector: (String selector) -> Puppeteer::ElementHandle?
265
+
266
+ # `$$()` in JavaScript.
267
+ # @rbs selector: String -- CSS selector
268
+ # @rbs isolate: bool? -- Use isolated world for queries
269
+ # @rbs return: Array[Puppeteer::ElementHandle] -- Matching elements
270
+ def query_selector_all: (String selector, ?isolate: bool?) -> Array[Puppeteer::ElementHandle]
271
+
272
+ class ElementNotFoundError < Puppeteer::Error
273
+ # @rbs selector: String -- CSS selector
274
+ def initialize: (String selector) -> untyped
275
+ end
276
+
277
+ # `$eval()` in JavaScript.
278
+ # @rbs selector: String -- CSS selector
279
+ # @rbs page_function: String -- Function or expression to evaluate
280
+ # @rbs args: Array[untyped] -- Arguments for evaluation
281
+ # @rbs return: untyped -- Evaluation result
282
+ def eval_on_selector: (String selector, String page_function, *untyped args) -> untyped
283
+
284
+ # `$$eval()` in JavaScript.
285
+ # @rbs selector: String -- CSS selector
286
+ # @rbs page_function: String -- Function or expression to evaluate
287
+ # @rbs args: Array[untyped] -- Arguments for evaluation
288
+ # @rbs return: untyped -- Evaluation result
289
+ def eval_on_selector_all: (String selector, String page_function, *untyped args) -> untyped
290
+
291
+ # `$x()` in JavaScript. $ is not allowed to use as a method name in Ruby.
292
+ # @rbs expression: String -- XPath expression
293
+ # @rbs return: Array[Puppeteer::ElementHandle] -- Matching elements
294
+ def Sx: (String expression) -> Array[Puppeteer::ElementHandle]
295
+
296
+ # in JS, #isIntersectingViewport.
297
+ # @rbs threshold: Numeric? -- Visibility threshold
298
+ # @rbs return: bool -- Whether element intersects viewport
299
+ def intersecting_viewport?: (?threshold: Numeric?) -> bool
300
+
301
+ private def compute_quad_area: (untyped quad) -> untyped
302
+
303
+ # used in AriaQueryHandler
304
+ # @rbs accessible_name: String? -- Accessible name filter
305
+ # @rbs role: String? -- Accessible role filter
306
+ # @rbs return: Hash[String, untyped] -- Accessibility tree result
307
+ def query_ax_tree: (?accessible_name: String?, ?role: String?) -> Hash[String, untyped]
308
+ end
@@ -0,0 +1,87 @@
1
+ # Generated from lib/puppeteer/execution_context.rb with RBS::Inline
2
+
3
+ class Puppeteer::ExecutionContext
4
+ include Puppeteer::IfPresent
5
+
6
+ EVALUATION_SCRIPT_URL: ::String
7
+
8
+ SOURCE_URL_REGEX: ::Regexp
9
+
10
+ # @param client [Puppeteer::CDPSession]
11
+ # @param context_payload [Hash]
12
+ # @param world [Puppeteer::IsolaatedWorld?]
13
+ def initialize: (untyped client, untyped context_payload, untyped world) -> untyped
14
+
15
+ attr_reader client: untyped
16
+
17
+ attr_reader world: untyped
18
+
19
+ # only used in IsolaatedWorld
20
+ private def _context_id: () -> untyped
21
+
22
+ # only used in IsolaatedWorld::BindingFunction#add_binding_to_context
23
+ private def _context_name: () -> untyped
24
+
25
+ # @param page_function [String]
26
+ # @return [Object]
27
+ def evaluate: (untyped page_function, *untyped args) -> untyped
28
+
29
+ # @param page_function [String]
30
+ # @return [Puppeteer::JSHandle]
31
+ def evaluate_handle: (untyped page_function, *untyped args) -> untyped
32
+
33
+ class JavaScriptExpression
34
+ def initialize: (untyped execution_context, untyped expression, untyped return_by_value) -> untyped
35
+
36
+ # @param client [Puppeteer::CDPSession]
37
+ # @param context_id [String]
38
+ # @return [Object|JSHandle]
39
+ def evaluate_with: (client: untyped, context_id: untyped) -> untyped
40
+
41
+ private def suffix: () -> untyped
42
+
43
+ private def expression_with_source_url: () -> untyped
44
+ end
45
+
46
+ class JavaScriptFunction
47
+ include Puppeteer::IfPresent
48
+
49
+ def initialize: (untyped execution_context, untyped expression, untyped args, untyped return_by_value) -> untyped
50
+
51
+ # @param client [Puppeteer::CDPSession]
52
+ # @param context_id [String]
53
+ # @return [Object|JSHandle]
54
+ def evaluate_with: (client: untyped, context_id: untyped) -> untyped
55
+
56
+ private def converted_args: () -> untyped
57
+
58
+ # @rbs value: untyped -- Value to check for cycles
59
+ # @rbs stack: Hash[Integer, bool]? -- Current stack for cycle detection
60
+ # @rbs visited: Hash[Integer, bool]? -- Already visited objects
61
+ # @rbs return: bool -- Whether the value contains cycles
62
+ private def recursive_object?: (untyped value, ?Hash[Integer, bool]? stack, ?Hash[Integer, bool]? visited) -> bool
63
+
64
+ # @rbs return: String -- JavaScript function declaration
65
+ private def function_declaration: () -> String
66
+
67
+ # @rbs return: String -- Wrapped function with serialization
68
+ private def serialized_function_declaration: () -> String
69
+
70
+ # @rbs return: String -- JavaScript serialization helper source
71
+ private def serialized_value_source: () -> String
72
+
73
+ private def suffix: () -> untyped
74
+ end
75
+
76
+ class EvaluationError < Puppeteer::Error
77
+ end
78
+
79
+ # @param return_by_value [Boolean]
80
+ # @param page_function [String]
81
+ # @return [Object|Puppeteer::JSHandle]
82
+ private def evaluate_internal: (untyped return_by_value, untyped page_function, *untyped args) -> untyped
83
+
84
+ # @rbs page_function: String -- JavaScript code to check
85
+ # @rbs return: bool -- Whether the code represents a function
86
+ private def function_string?: (String page_function) -> bool
87
+ end
@@ -0,0 +1,233 @@
1
+ # Generated from lib/puppeteer/frame.rb with RBS::Inline
2
+
3
+ class Puppeteer::Frame
4
+ # @rbs frame_manager: Puppeteer::FrameManager -- Owning frame manager
5
+ # @rbs parent_frame: Puppeteer::Frame? -- Parent frame
6
+ # @rbs frame_id: String -- Frame ID
7
+ # @rbs client: Puppeteer::CDPSession -- CDP session
8
+ # @rbs return: void -- No return value
9
+ def initialize: (Puppeteer::FrameManager frame_manager, Puppeteer::Frame? parent_frame, String frame_id, Puppeteer::CDPSession client) -> void
10
+
11
+ # @rbs return: String -- Inspection string
12
+ def inspect: () -> String
13
+
14
+ # @rbs return: Puppeteer::CDPSession -- Current CDP session
15
+ def _client: () -> Puppeteer::CDPSession
16
+
17
+ private def update_client: (untyped client) -> untyped
18
+
19
+ # @rbs return: Puppeteer::Page -- Owning page
20
+ def page: () -> Puppeteer::Page
21
+
22
+ # @rbs return: Numeric -- Default timeout in milliseconds
23
+ def default_timeout: () -> Numeric
24
+
25
+ # @rbs selector_or_function: String -- Selector or JS function
26
+ # @rbs return: Puppeteer::Locator -- Locator for selector or function
27
+ def locator: (String selector_or_function) -> Puppeteer::Locator
28
+
29
+ # @rbs return: bool -- Whether this is an OOPIF frame
30
+ def oop_frame?: () -> bool
31
+
32
+ attr_accessor frame_manager: untyped
33
+
34
+ attr_accessor id: untyped
35
+
36
+ attr_accessor loader_id: untyped
37
+
38
+ attr_accessor lifecycle_events: untyped
39
+
40
+ attr_accessor main_world: untyped
41
+
42
+ attr_accessor puppeteer_world: untyped
43
+
44
+ attr_reader client: untyped
45
+
46
+ # @rbs other: Object -- Other object to compare
47
+ # @rbs return: bool -- Equality result
48
+ def ==: (Object other) -> bool
49
+
50
+ # @rbs return: bool -- Whether loading has started
51
+ def has_started_loading?: () -> bool
52
+
53
+ # @rbs url: String -- URL to navigate
54
+ # @rbs referer: String? -- Referer header value
55
+ # @rbs referrer_policy: String? -- Referrer policy
56
+ # @rbs timeout: Numeric? -- Navigation timeout in milliseconds
57
+ # @rbs wait_until: String? -- Lifecycle event to wait for
58
+ # @rbs return: Puppeteer::HTTPResponse? -- Navigation response
59
+ def goto: (String url, ?referer: String?, ?referrer_policy: String?, ?timeout: Numeric?, ?wait_until: String?) -> Puppeteer::HTTPResponse?
60
+
61
+ # @rbs timeout: Numeric? -- Navigation timeout in milliseconds
62
+ # @rbs wait_until: String? -- Lifecycle event to wait for
63
+ # @rbs ignore_same_document_navigation: bool -- Ignore same-document navigation
64
+ # @rbs return: Puppeteer::HTTPResponse? -- Navigation response
65
+ def wait_for_navigation: (?timeout: Numeric?, ?wait_until: String?, ?ignore_same_document_navigation: bool) -> Puppeteer::HTTPResponse?
66
+
67
+ # @rbs return: Puppeteer::ExecutionContext -- Main world execution context
68
+ def execution_context: () -> Puppeteer::ExecutionContext
69
+
70
+ # @rbs page_function: String -- Function or expression to evaluate
71
+ # @rbs args: Array[untyped] -- Arguments for evaluation
72
+ # @rbs return: Puppeteer::JSHandle -- Handle to evaluation result
73
+ def evaluate_handle: (String page_function, *untyped args) -> Puppeteer::JSHandle
74
+
75
+ # @rbs page_function: String -- Function or expression to evaluate
76
+ # @rbs args: Array[untyped] -- Arguments for evaluation
77
+ # @rbs return: untyped -- Evaluation result
78
+ def evaluate: (String page_function, *untyped args) -> untyped
79
+
80
+ # `$()` in JavaScript.
81
+ # @rbs selector: String -- CSS selector
82
+ # @rbs return: Puppeteer::ElementHandle? -- Matching element or nil
83
+ def query_selector: (String selector) -> Puppeteer::ElementHandle?
84
+
85
+ # `$x()` in JavaScript. $ is not allowed to use as a method name in Ruby.
86
+ # @rbs expression: String -- XPath expression
87
+ # @rbs return: Array[Puppeteer::ElementHandle] -- Matching elements
88
+ def Sx: (String expression) -> Array[Puppeteer::ElementHandle]
89
+
90
+ # `$eval()` in JavaScript.
91
+ # @rbs selector: String -- CSS selector
92
+ # @rbs page_function: String -- Function or expression to evaluate
93
+ # @rbs args: Array[untyped] -- Arguments for evaluation
94
+ # @rbs return: untyped -- Evaluation result
95
+ def eval_on_selector: (String selector, String page_function, *untyped args) -> untyped
96
+
97
+ # `$$eval()` in JavaScript.
98
+ # @rbs selector: String -- CSS selector
99
+ # @rbs page_function: String -- Function or expression to evaluate
100
+ # @rbs args: Array[untyped] -- Arguments for evaluation
101
+ # @rbs return: untyped -- Evaluation result
102
+ def eval_on_selector_all: (String selector, String page_function, *untyped args) -> untyped
103
+
104
+ # `$$()` in JavaScript.
105
+ # @rbs selector: String -- CSS selector
106
+ # @rbs isolate: bool? -- Use isolated world for queries
107
+ # @rbs return: Array[Puppeteer::ElementHandle] -- Matching elements
108
+ def query_selector_all: (String selector, ?isolate: bool?) -> Array[Puppeteer::ElementHandle]
109
+
110
+ # @rbs return: String -- Page HTML content
111
+ def content: () -> String
112
+
113
+ # @rbs html: String -- HTML content
114
+ # @rbs timeout: Numeric? -- Navigation timeout in milliseconds
115
+ # @rbs wait_until: String | Array[String] | nil -- Lifecycle events to wait for
116
+ # @rbs return: void -- No return value
117
+ def set_content: (String html, ?timeout: Numeric?, ?wait_until: String | Array[String] | nil) -> void
118
+
119
+ # @rbs return: String -- Frame name
120
+ def name: () -> String
121
+
122
+ # @rbs return: String? -- Frame URL
123
+ def url: () -> String?
124
+
125
+ # @rbs return: Puppeteer::Frame? -- Parent frame
126
+ def parent_frame: () -> Puppeteer::Frame?
127
+
128
+ # @rbs return: Puppeteer::ElementHandle? -- Frame element handle
129
+ def frame_element: () -> Puppeteer::ElementHandle?
130
+
131
+ def _child_frames: () -> untyped
132
+
133
+ # @rbs return: Array[Puppeteer::Frame] -- Child frames
134
+ def child_frames: () -> Array[Puppeteer::Frame]
135
+
136
+ # @rbs return: bool -- Whether the frame is detached
137
+ def detached?: () -> bool
138
+
139
+ # @rbs url: String? -- Script URL
140
+ # @rbs path: String? -- Path to script file
141
+ # @rbs content: String? -- Script contents
142
+ # @rbs type: String? -- Script type
143
+ # @rbs id: String? -- Script element ID
144
+ # @rbs return: Puppeteer::ElementHandle -- Script element handle
145
+ def add_script_tag: (?url: String?, ?path: String?, ?content: String?, ?type: String?, ?id: String?) -> Puppeteer::ElementHandle
146
+
147
+ # @rbs url: String? -- Stylesheet URL
148
+ # @rbs path: String? -- Path to stylesheet file
149
+ # @rbs content: String? -- Stylesheet contents
150
+ # @rbs return: Puppeteer::ElementHandle -- Style element handle
151
+ def add_style_tag: (?url: String?, ?path: String?, ?content: String?) -> Puppeteer::ElementHandle
152
+
153
+ # @rbs selector: String -- CSS selector
154
+ # @rbs delay: Numeric? -- Delay between down and up (ms)
155
+ # @rbs button: String? -- Mouse button
156
+ # @rbs click_count: Integer? -- Deprecated: use count (click_count only sets clickCount)
157
+ # @rbs count: Integer? -- Number of clicks to perform
158
+ # @rbs return: void -- No return value
159
+ def click: (String selector, ?delay: Numeric?, ?button: String?, ?click_count: Integer?, ?count: Integer?) -> void
160
+
161
+ # @rbs selector: String -- CSS selector
162
+ # @rbs return: void -- No return value
163
+ def focus: (String selector) -> void
164
+
165
+ # @rbs selector: String -- CSS selector
166
+ # @rbs return: void -- No return value
167
+ def hover: (String selector) -> void
168
+
169
+ # @rbs selector: String -- CSS selector
170
+ # @rbs values: Array[String] -- Option values to select
171
+ # @rbs return: Array[String] -- Selected values
172
+ def select: (String selector, *untyped values) -> Array[String]
173
+
174
+ # @rbs selector: String -- CSS selector
175
+ # @rbs return: void -- No return value
176
+ def tap: (String selector) -> void
177
+
178
+ # @rbs selector: String -- CSS selector
179
+ # @rbs text: String -- Text to type
180
+ # @rbs delay: Numeric? -- Delay between key presses (ms)
181
+ # @rbs return: void -- No return value
182
+ def type_text: (String selector, String text, ?delay: Numeric?) -> void
183
+
184
+ # @rbs selector: String -- CSS selector
185
+ # @rbs visible: bool? -- Wait for element to be visible
186
+ # @rbs hidden: bool? -- Wait for element to be hidden
187
+ # @rbs timeout: Numeric? -- Maximum wait time in milliseconds
188
+ # @rbs return: Puppeteer::ElementHandle? -- Matching element or nil
189
+ def wait_for_selector: (String selector, ?visible: bool?, ?hidden: bool?, ?timeout: Numeric?) -> Puppeteer::ElementHandle?
190
+
191
+ # @rbs milliseconds: Numeric -- Time to wait in milliseconds
192
+ # @rbs return: void -- No return value
193
+ def wait_for_timeout: (Numeric milliseconds) -> void
194
+
195
+ # @rbs xpath: String -- XPath expression
196
+ # @rbs visible: bool? -- Wait for element to be visible
197
+ # @rbs hidden: bool? -- Wait for element to be hidden
198
+ # @rbs timeout: Numeric? -- Maximum wait time in milliseconds
199
+ # @rbs return: Puppeteer::ElementHandle? -- Matching element or nil
200
+ def wait_for_xpath: (String xpath, ?visible: bool?, ?hidden: bool?, ?timeout: Numeric?) -> Puppeteer::ElementHandle?
201
+
202
+ # @rbs page_function: String -- Function or expression to evaluate
203
+ # @rbs args: Array[untyped] -- Arguments for evaluation
204
+ # @rbs polling: String | Numeric | nil -- Polling strategy
205
+ # @rbs timeout: Numeric? -- Maximum wait time in milliseconds
206
+ # @rbs return: Puppeteer::JSHandle -- Handle to evaluation result
207
+ def wait_for_function: (String page_function, ?args: Array[untyped], ?polling: String | Numeric | nil, ?timeout: Numeric?) -> Puppeteer::JSHandle
208
+
209
+ # @rbs return: String -- Frame title
210
+ def title: () -> String
211
+
212
+ # @rbs frame_payload: Hash[String, untyped] -- Frame payload
213
+ # @rbs return: void -- No return value
214
+ def navigated: (Hash[String, untyped] frame_payload) -> void
215
+
216
+ # @rbs url: String -- Updated URL
217
+ # @rbs return: void -- No return value
218
+ def navigated_within_document: (String url) -> void
219
+
220
+ # @rbs loader_id: String -- Loader ID
221
+ # @rbs name: String -- Lifecycle event name
222
+ # @rbs return: void -- No return value
223
+ def handle_lifecycle_event: (String loader_id, String name) -> void
224
+
225
+ # @rbs return: void -- No return value
226
+ def handle_loading_started: () -> void
227
+
228
+ # @rbs return: void -- No return value
229
+ def handle_loading_stopped: () -> void
230
+
231
+ # @rbs return: void -- No return value
232
+ def detach: () -> void
233
+ end