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.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -3
- data/AGENTS.md +169 -0
- data/CLAUDE/README.md +41 -0
- data/CLAUDE/architecture.md +253 -0
- data/CLAUDE/cdp_protocol.md +230 -0
- data/CLAUDE/concurrency.md +216 -0
- data/CLAUDE/porting_puppeteer.md +575 -0
- data/CLAUDE/rbs_type_checking.md +101 -0
- data/CLAUDE/spec_migration_plans.md +1041 -0
- data/CLAUDE/testing.md +278 -0
- data/CLAUDE.md +242 -0
- data/README.md +8 -0
- data/Rakefile +7 -0
- data/Steepfile +28 -0
- data/docs/api_coverage.md +105 -56
- data/lib/puppeteer/aria_query_handler.rb +3 -2
- data/lib/puppeteer/async_utils.rb +214 -0
- data/lib/puppeteer/browser.rb +98 -56
- data/lib/puppeteer/browser_connector.rb +18 -3
- data/lib/puppeteer/browser_context.rb +196 -3
- data/lib/puppeteer/browser_runner.rb +18 -10
- data/lib/puppeteer/cdp_session.rb +67 -23
- data/lib/puppeteer/chrome_target_manager.rb +65 -40
- data/lib/puppeteer/connection.rb +55 -36
- data/lib/puppeteer/console_message.rb +9 -1
- data/lib/puppeteer/console_patch.rb +47 -0
- data/lib/puppeteer/css_coverage.rb +5 -3
- data/lib/puppeteer/custom_query_handler.rb +80 -33
- data/lib/puppeteer/define_async_method.rb +31 -37
- data/lib/puppeteer/dialog.rb +47 -14
- data/lib/puppeteer/element_handle.rb +231 -62
- data/lib/puppeteer/emulation_manager.rb +1 -1
- data/lib/puppeteer/env.rb +1 -1
- data/lib/puppeteer/errors.rb +25 -2
- data/lib/puppeteer/event_callbackable.rb +15 -0
- data/lib/puppeteer/events.rb +4 -0
- data/lib/puppeteer/execution_context.rb +148 -3
- data/lib/puppeteer/file_chooser.rb +6 -0
- data/lib/puppeteer/frame.rb +162 -91
- data/lib/puppeteer/frame_manager.rb +69 -48
- data/lib/puppeteer/http_request.rb +114 -38
- data/lib/puppeteer/http_response.rb +24 -7
- data/lib/puppeteer/isolated_world.rb +64 -41
- data/lib/puppeteer/js_coverage.rb +5 -3
- data/lib/puppeteer/js_handle.rb +58 -16
- data/lib/puppeteer/keyboard.rb +30 -17
- data/lib/puppeteer/launcher/browser_options.rb +3 -1
- data/lib/puppeteer/launcher/chrome.rb +8 -5
- data/lib/puppeteer/launcher/launch_options.rb +7 -2
- data/lib/puppeteer/launcher.rb +4 -8
- data/lib/puppeteer/lifecycle_watcher.rb +38 -22
- data/lib/puppeteer/mouse.rb +273 -64
- data/lib/puppeteer/network_event_manager.rb +7 -0
- data/lib/puppeteer/network_manager.rb +393 -112
- data/lib/puppeteer/page/screenshot_task_queue.rb +14 -4
- data/lib/puppeteer/page.rb +568 -226
- data/lib/puppeteer/puppeteer.rb +171 -64
- data/lib/puppeteer/query_handler_manager.rb +112 -16
- data/lib/puppeteer/reactor_runner.rb +247 -0
- data/lib/puppeteer/remote_object.rb +127 -47
- data/lib/puppeteer/target.rb +74 -27
- data/lib/puppeteer/task_manager.rb +3 -1
- data/lib/puppeteer/timeout_helper.rb +6 -10
- data/lib/puppeteer/touch_handle.rb +39 -0
- data/lib/puppeteer/touch_screen.rb +72 -22
- data/lib/puppeteer/tracing.rb +3 -3
- data/lib/puppeteer/version.rb +1 -1
- data/lib/puppeteer/wait_task.rb +264 -101
- data/lib/puppeteer/web_socket.rb +2 -2
- data/lib/puppeteer/web_socket_transport.rb +91 -27
- data/lib/puppeteer/web_worker.rb +175 -0
- data/lib/puppeteer.rb +20 -4
- data/puppeteer-ruby.gemspec +15 -11
- data/sig/_external.rbs +8 -0
- data/sig/_supplementary.rbs +314 -0
- data/sig/puppeteer/browser.rbs +166 -0
- data/sig/puppeteer/cdp_session.rbs +64 -0
- data/sig/puppeteer/dialog.rbs +41 -0
- data/sig/puppeteer/element_handle.rbs +305 -0
- data/sig/puppeteer/execution_context.rbs +87 -0
- data/sig/puppeteer/frame.rbs +226 -0
- data/sig/puppeteer/http_request.rbs +214 -0
- data/sig/puppeteer/http_response.rbs +89 -0
- data/sig/puppeteer/js_handle.rbs +64 -0
- data/sig/puppeteer/keyboard.rbs +40 -0
- data/sig/puppeteer/mouse.rbs +113 -0
- data/sig/puppeteer/page.rbs +515 -0
- data/sig/puppeteer/puppeteer.rbs +98 -0
- data/sig/puppeteer/remote_object.rbs +78 -0
- data/sig/puppeteer/touch_handle.rbs +21 -0
- data/sig/puppeteer/touch_screen.rbs +35 -0
- data/sig/puppeteer/web_worker.rbs +83 -0
- metadata +116 -45
- data/CHANGELOG.md +0 -397
- data/lib/puppeteer/concurrent_ruby_utils.rb +0 -81
- data/lib/puppeteer/firefox_target_manager.rb +0 -157
- data/lib/puppeteer/launcher/firefox.rb +0 -453
|
@@ -0,0 +1,305 @@
|
|
|
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: bool -- Whether element is visible
|
|
116
|
+
def visible?: () -> bool
|
|
117
|
+
|
|
118
|
+
# @rbs return: bool -- Whether element is hidden
|
|
119
|
+
def hidden?: () -> bool
|
|
120
|
+
|
|
121
|
+
# @rbs visible: bool -- Expected visibility state
|
|
122
|
+
# @rbs return: bool -- Whether visibility matches
|
|
123
|
+
private def check_visibility: (bool visible) -> bool
|
|
124
|
+
|
|
125
|
+
# @rbs return: Puppeteer::Frame? -- Frame that owns this element
|
|
126
|
+
def content_frame: () -> Puppeteer::Frame?
|
|
127
|
+
|
|
128
|
+
class ScrollIntoViewError < Puppeteer::Error
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# @rbs return: void -- No return value
|
|
132
|
+
def scroll_into_view_if_needed: () -> void
|
|
133
|
+
|
|
134
|
+
class ElementNotVisibleError < Puppeteer::Error
|
|
135
|
+
def initialize: () -> untyped
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
class ElementNotClickableError < Puppeteer::Error
|
|
139
|
+
def initialize: () -> untyped
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
# @rbs quad: Array[Point] -- Quad points
|
|
143
|
+
# @rbs offset: Point -- Offset to apply
|
|
144
|
+
# @rbs return: Array[Point] -- Offset quad points
|
|
145
|
+
private def apply_offsets_to_quad: (Array[Point] quad, Point offset) -> Array[Point]
|
|
146
|
+
|
|
147
|
+
# @rbs frame: Puppeteer::Frame -- Frame to calculate offsets for
|
|
148
|
+
# @rbs return: Point -- Calculated offset
|
|
149
|
+
private def oopif_offsets: (Puppeteer::Frame frame) -> Point
|
|
150
|
+
|
|
151
|
+
# @rbs offset: Puppeteer::ElementHandle::Offset | Hash[Symbol, Numeric] | nil -- Click offset
|
|
152
|
+
# @rbs return: Puppeteer::ElementHandle::Point -- Clickable point
|
|
153
|
+
def clickable_point: (?Puppeteer::ElementHandle::Offset | Hash[Symbol, Numeric] | nil offset) -> Puppeteer::ElementHandle::Point
|
|
154
|
+
|
|
155
|
+
# @rbs quad: Array[Numeric] -- Protocol quad coordinates
|
|
156
|
+
# @rbs return: Array[Point] -- Point array
|
|
157
|
+
private def from_protocol_quad: (Array[Numeric] quad) -> Array[Point]
|
|
158
|
+
|
|
159
|
+
private def intersect_quad_with_viewport: (untyped quad, untyped width, untyped height) -> untyped
|
|
160
|
+
|
|
161
|
+
# @rbs return: void -- No return value
|
|
162
|
+
def hover: () -> void
|
|
163
|
+
|
|
164
|
+
# @rbs delay: Numeric? -- Delay between down and up (ms)
|
|
165
|
+
# @rbs button: String? -- Mouse button
|
|
166
|
+
# @rbs click_count: Integer? -- Deprecated: use count (click_count only sets clickCount)
|
|
167
|
+
# @rbs count: Integer? -- Number of clicks to perform
|
|
168
|
+
# @rbs offset: Puppeteer::ElementHandle::Offset | Hash[Symbol, Numeric] | nil -- Click offset
|
|
169
|
+
# @rbs return: void -- No return value
|
|
170
|
+
def click: (?delay: Numeric?, ?button: String?, ?click_count: Integer?, ?count: Integer?, ?offset: Puppeteer::ElementHandle::Offset | Hash[Symbol, Numeric] | nil) -> void
|
|
171
|
+
|
|
172
|
+
# @rbs return: Puppeteer::TouchHandle -- Touch handle
|
|
173
|
+
def touch_start: () -> Puppeteer::TouchHandle
|
|
174
|
+
|
|
175
|
+
# @rbs touch: Puppeteer::TouchHandle? -- Optional touch handle
|
|
176
|
+
# @rbs return: void -- No return value
|
|
177
|
+
def touch_move: (?Puppeteer::TouchHandle? touch) -> void
|
|
178
|
+
|
|
179
|
+
# @rbs return: void -- No return value
|
|
180
|
+
def touch_end: () -> void
|
|
181
|
+
|
|
182
|
+
class DragInterceptionNotEnabledError < Puppeteer::Error
|
|
183
|
+
def initialize: () -> untyped
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
# @rbs x: Numeric -- Drag end X coordinate
|
|
187
|
+
# @rbs y: Numeric -- Drag end Y coordinate
|
|
188
|
+
# @rbs return: void -- No return value
|
|
189
|
+
def drag: (x: Numeric, y: Numeric) -> void
|
|
190
|
+
|
|
191
|
+
# @rbs data: Hash[String, untyped] -- Drag data payload
|
|
192
|
+
# @rbs return: void -- No return value
|
|
193
|
+
def drag_enter: (Hash[String, untyped] data) -> void
|
|
194
|
+
|
|
195
|
+
# @rbs data: Hash[String, untyped] -- Drag data payload
|
|
196
|
+
# @rbs return: void -- No return value
|
|
197
|
+
def drag_over: (Hash[String, untyped] data) -> void
|
|
198
|
+
|
|
199
|
+
# @rbs data: Hash[String, untyped] -- Drag data payload
|
|
200
|
+
# @rbs return: void -- No return value
|
|
201
|
+
def drop: (Hash[String, untyped] data) -> void
|
|
202
|
+
|
|
203
|
+
# @rbs target: Puppeteer::ElementHandle -- Drop target element
|
|
204
|
+
# @rbs delay: Numeric? -- Delay before dropping (ms)
|
|
205
|
+
# @rbs return: void -- No return value
|
|
206
|
+
def drag_and_drop: (Puppeteer::ElementHandle target, ?delay: Numeric?) -> void
|
|
207
|
+
|
|
208
|
+
# @rbs values: Array[String] -- Option values to select
|
|
209
|
+
# @rbs return: Array[String] -- Selected values
|
|
210
|
+
def select: (*untyped values) -> Array[String]
|
|
211
|
+
|
|
212
|
+
# @rbs file_paths: Array[String] -- Files to upload
|
|
213
|
+
# @rbs return: void -- No return value
|
|
214
|
+
def upload_file: (*untyped file_paths) -> void
|
|
215
|
+
|
|
216
|
+
# @rbs block: Proc? -- Optional block for Object#tap usage
|
|
217
|
+
# @rbs return: Puppeteer::ElementHandle | nil -- Element handle or nil
|
|
218
|
+
def tap: () ?{ (?) -> untyped } -> (Puppeteer::ElementHandle | nil)
|
|
219
|
+
|
|
220
|
+
# @rbs return: void -- No return value
|
|
221
|
+
def focus: () -> void
|
|
222
|
+
|
|
223
|
+
# @rbs text: String -- Text to type
|
|
224
|
+
# @rbs delay: Numeric? -- Delay between key presses (ms)
|
|
225
|
+
# @rbs return: void -- No return value
|
|
226
|
+
def type_text: (String text, ?delay: Numeric?) -> void
|
|
227
|
+
|
|
228
|
+
# @rbs key: String -- Key name
|
|
229
|
+
# @rbs delay: Numeric? -- Delay between key events (ms)
|
|
230
|
+
# @rbs text: String? -- Text to input
|
|
231
|
+
# @rbs return: void -- No return value
|
|
232
|
+
def press: (String key, ?delay: Numeric?, ?text: String?) -> void
|
|
233
|
+
|
|
234
|
+
# @rbs return: Puppeteer::ElementHandle::BoundingBox? -- Bounding box or nil
|
|
235
|
+
def bounding_box: () -> Puppeteer::ElementHandle::BoundingBox?
|
|
236
|
+
|
|
237
|
+
# @rbs return: Puppeteer::ElementHandle::BoxModel? -- Box model or nil
|
|
238
|
+
def box_model: () -> Puppeteer::ElementHandle::BoxModel?
|
|
239
|
+
|
|
240
|
+
# @rbs type: String? -- Image format
|
|
241
|
+
# @rbs path: String? -- File path to save
|
|
242
|
+
# @rbs full_page: bool? -- Capture full page
|
|
243
|
+
# @rbs clip: Hash[Symbol, Numeric]? -- Clip rectangle
|
|
244
|
+
# @rbs quality: Integer? -- JPEG quality
|
|
245
|
+
# @rbs omit_background: bool? -- Omit background for PNG
|
|
246
|
+
# @rbs encoding: String? -- Encoding (base64 or binary)
|
|
247
|
+
# @rbs capture_beyond_viewport: bool? -- Capture beyond viewport
|
|
248
|
+
# @rbs from_surface: bool? -- Capture from surface
|
|
249
|
+
# @rbs return: String -- Screenshot data
|
|
250
|
+
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
|
|
251
|
+
|
|
252
|
+
private def query_handler_manager: () -> untyped
|
|
253
|
+
|
|
254
|
+
private def query_selector_in_isolated_world: (untyped selector) -> untyped
|
|
255
|
+
|
|
256
|
+
private def query_selector_all_in_isolated_world: (untyped selector) -> untyped
|
|
257
|
+
|
|
258
|
+
# `$()` in JavaScript.
|
|
259
|
+
# @rbs selector: String -- CSS selector
|
|
260
|
+
# @rbs return: Puppeteer::ElementHandle? -- Matching element or nil
|
|
261
|
+
def query_selector: (String selector) -> Puppeteer::ElementHandle?
|
|
262
|
+
|
|
263
|
+
# `$$()` in JavaScript.
|
|
264
|
+
# @rbs selector: String -- CSS selector
|
|
265
|
+
# @rbs isolate: bool? -- Use isolated world for queries
|
|
266
|
+
# @rbs return: Array[Puppeteer::ElementHandle] -- Matching elements
|
|
267
|
+
def query_selector_all: (String selector, ?isolate: bool?) -> Array[Puppeteer::ElementHandle]
|
|
268
|
+
|
|
269
|
+
class ElementNotFoundError < Puppeteer::Error
|
|
270
|
+
# @rbs selector: String -- CSS selector
|
|
271
|
+
def initialize: (String selector) -> untyped
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
# `$eval()` in JavaScript.
|
|
275
|
+
# @rbs selector: String -- CSS selector
|
|
276
|
+
# @rbs page_function: String -- Function or expression to evaluate
|
|
277
|
+
# @rbs args: Array[untyped] -- Arguments for evaluation
|
|
278
|
+
# @rbs return: untyped -- Evaluation result
|
|
279
|
+
def eval_on_selector: (String selector, String page_function, *untyped args) -> untyped
|
|
280
|
+
|
|
281
|
+
# `$$eval()` in JavaScript.
|
|
282
|
+
# @rbs selector: String -- CSS selector
|
|
283
|
+
# @rbs page_function: String -- Function or expression to evaluate
|
|
284
|
+
# @rbs args: Array[untyped] -- Arguments for evaluation
|
|
285
|
+
# @rbs return: untyped -- Evaluation result
|
|
286
|
+
def eval_on_selector_all: (String selector, String page_function, *untyped args) -> untyped
|
|
287
|
+
|
|
288
|
+
# `$x()` in JavaScript. $ is not allowed to use as a method name in Ruby.
|
|
289
|
+
# @rbs expression: String -- XPath expression
|
|
290
|
+
# @rbs return: Array[Puppeteer::ElementHandle] -- Matching elements
|
|
291
|
+
def Sx: (String expression) -> Array[Puppeteer::ElementHandle]
|
|
292
|
+
|
|
293
|
+
# in JS, #isIntersectingViewport.
|
|
294
|
+
# @rbs threshold: Numeric? -- Visibility threshold
|
|
295
|
+
# @rbs return: bool -- Whether element intersects viewport
|
|
296
|
+
def intersecting_viewport?: (?threshold: Numeric?) -> bool
|
|
297
|
+
|
|
298
|
+
private def compute_quad_area: (untyped quad) -> untyped
|
|
299
|
+
|
|
300
|
+
# used in AriaQueryHandler
|
|
301
|
+
# @rbs accessible_name: String? -- Accessible name filter
|
|
302
|
+
# @rbs role: String? -- Accessible role filter
|
|
303
|
+
# @rbs return: Hash[String, untyped] -- Accessibility tree result
|
|
304
|
+
def query_ax_tree: (?accessible_name: String?, ?role: String?) -> Hash[String, untyped]
|
|
305
|
+
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,226 @@
|
|
|
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: bool -- Whether this is an OOPIF frame
|
|
23
|
+
def oop_frame?: () -> bool
|
|
24
|
+
|
|
25
|
+
attr_accessor frame_manager: untyped
|
|
26
|
+
|
|
27
|
+
attr_accessor id: untyped
|
|
28
|
+
|
|
29
|
+
attr_accessor loader_id: untyped
|
|
30
|
+
|
|
31
|
+
attr_accessor lifecycle_events: untyped
|
|
32
|
+
|
|
33
|
+
attr_accessor main_world: untyped
|
|
34
|
+
|
|
35
|
+
attr_accessor puppeteer_world: untyped
|
|
36
|
+
|
|
37
|
+
attr_reader client: untyped
|
|
38
|
+
|
|
39
|
+
# @rbs other: Object -- Other object to compare
|
|
40
|
+
# @rbs return: bool -- Equality result
|
|
41
|
+
def ==: (Object other) -> bool
|
|
42
|
+
|
|
43
|
+
# @rbs return: bool -- Whether loading has started
|
|
44
|
+
def has_started_loading?: () -> bool
|
|
45
|
+
|
|
46
|
+
# @rbs url: String -- URL to navigate
|
|
47
|
+
# @rbs referer: String? -- Referer header value
|
|
48
|
+
# @rbs referrer_policy: String? -- Referrer policy
|
|
49
|
+
# @rbs timeout: Numeric? -- Navigation timeout in milliseconds
|
|
50
|
+
# @rbs wait_until: String? -- Lifecycle event to wait for
|
|
51
|
+
# @rbs return: Puppeteer::HTTPResponse? -- Navigation response
|
|
52
|
+
def goto: (String url, ?referer: String?, ?referrer_policy: String?, ?timeout: Numeric?, ?wait_until: String?) -> Puppeteer::HTTPResponse?
|
|
53
|
+
|
|
54
|
+
# @rbs timeout: Numeric? -- Navigation timeout in milliseconds
|
|
55
|
+
# @rbs wait_until: String? -- Lifecycle event to wait for
|
|
56
|
+
# @rbs ignore_same_document_navigation: bool -- Ignore same-document navigation
|
|
57
|
+
# @rbs return: Puppeteer::HTTPResponse? -- Navigation response
|
|
58
|
+
def wait_for_navigation: (?timeout: Numeric?, ?wait_until: String?, ?ignore_same_document_navigation: bool) -> Puppeteer::HTTPResponse?
|
|
59
|
+
|
|
60
|
+
# @rbs return: Puppeteer::ExecutionContext -- Main world execution context
|
|
61
|
+
def execution_context: () -> Puppeteer::ExecutionContext
|
|
62
|
+
|
|
63
|
+
# @rbs page_function: String -- Function or expression to evaluate
|
|
64
|
+
# @rbs args: Array[untyped] -- Arguments for evaluation
|
|
65
|
+
# @rbs return: Puppeteer::JSHandle -- Handle to evaluation result
|
|
66
|
+
def evaluate_handle: (String page_function, *untyped args) -> Puppeteer::JSHandle
|
|
67
|
+
|
|
68
|
+
# @rbs page_function: String -- Function or expression to evaluate
|
|
69
|
+
# @rbs args: Array[untyped] -- Arguments for evaluation
|
|
70
|
+
# @rbs return: untyped -- Evaluation result
|
|
71
|
+
def evaluate: (String page_function, *untyped args) -> untyped
|
|
72
|
+
|
|
73
|
+
# `$()` in JavaScript.
|
|
74
|
+
# @rbs selector: String -- CSS selector
|
|
75
|
+
# @rbs return: Puppeteer::ElementHandle? -- Matching element or nil
|
|
76
|
+
def query_selector: (String selector) -> Puppeteer::ElementHandle?
|
|
77
|
+
|
|
78
|
+
# `$x()` in JavaScript. $ is not allowed to use as a method name in Ruby.
|
|
79
|
+
# @rbs expression: String -- XPath expression
|
|
80
|
+
# @rbs return: Array[Puppeteer::ElementHandle] -- Matching elements
|
|
81
|
+
def Sx: (String expression) -> Array[Puppeteer::ElementHandle]
|
|
82
|
+
|
|
83
|
+
# `$eval()` in JavaScript.
|
|
84
|
+
# @rbs selector: String -- CSS selector
|
|
85
|
+
# @rbs page_function: String -- Function or expression to evaluate
|
|
86
|
+
# @rbs args: Array[untyped] -- Arguments for evaluation
|
|
87
|
+
# @rbs return: untyped -- Evaluation result
|
|
88
|
+
def eval_on_selector: (String selector, String page_function, *untyped args) -> untyped
|
|
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_all: (String selector, String page_function, *untyped args) -> untyped
|
|
96
|
+
|
|
97
|
+
# `$$()` in JavaScript.
|
|
98
|
+
# @rbs selector: String -- CSS selector
|
|
99
|
+
# @rbs isolate: bool? -- Use isolated world for queries
|
|
100
|
+
# @rbs return: Array[Puppeteer::ElementHandle] -- Matching elements
|
|
101
|
+
def query_selector_all: (String selector, ?isolate: bool?) -> Array[Puppeteer::ElementHandle]
|
|
102
|
+
|
|
103
|
+
# @rbs return: String -- Page HTML content
|
|
104
|
+
def content: () -> String
|
|
105
|
+
|
|
106
|
+
# @rbs html: String -- HTML content
|
|
107
|
+
# @rbs timeout: Numeric? -- Navigation timeout in milliseconds
|
|
108
|
+
# @rbs wait_until: String | Array[String] | nil -- Lifecycle events to wait for
|
|
109
|
+
# @rbs return: void -- No return value
|
|
110
|
+
def set_content: (String html, ?timeout: Numeric?, ?wait_until: String | Array[String] | nil) -> void
|
|
111
|
+
|
|
112
|
+
# @rbs return: String -- Frame name
|
|
113
|
+
def name: () -> String
|
|
114
|
+
|
|
115
|
+
# @rbs return: String? -- Frame URL
|
|
116
|
+
def url: () -> String?
|
|
117
|
+
|
|
118
|
+
# @rbs return: Puppeteer::Frame? -- Parent frame
|
|
119
|
+
def parent_frame: () -> Puppeteer::Frame?
|
|
120
|
+
|
|
121
|
+
# @rbs return: Puppeteer::ElementHandle? -- Frame element handle
|
|
122
|
+
def frame_element: () -> Puppeteer::ElementHandle?
|
|
123
|
+
|
|
124
|
+
def _child_frames: () -> untyped
|
|
125
|
+
|
|
126
|
+
# @rbs return: Array[Puppeteer::Frame] -- Child frames
|
|
127
|
+
def child_frames: () -> Array[Puppeteer::Frame]
|
|
128
|
+
|
|
129
|
+
# @rbs return: bool -- Whether the frame is detached
|
|
130
|
+
def detached?: () -> bool
|
|
131
|
+
|
|
132
|
+
# @rbs url: String? -- Script URL
|
|
133
|
+
# @rbs path: String? -- Path to script file
|
|
134
|
+
# @rbs content: String? -- Script contents
|
|
135
|
+
# @rbs type: String? -- Script type
|
|
136
|
+
# @rbs id: String? -- Script element ID
|
|
137
|
+
# @rbs return: Puppeteer::ElementHandle -- Script element handle
|
|
138
|
+
def add_script_tag: (?url: String?, ?path: String?, ?content: String?, ?type: String?, ?id: String?) -> Puppeteer::ElementHandle
|
|
139
|
+
|
|
140
|
+
# @rbs url: String? -- Stylesheet URL
|
|
141
|
+
# @rbs path: String? -- Path to stylesheet file
|
|
142
|
+
# @rbs content: String? -- Stylesheet contents
|
|
143
|
+
# @rbs return: Puppeteer::ElementHandle -- Style element handle
|
|
144
|
+
def add_style_tag: (?url: String?, ?path: String?, ?content: String?) -> Puppeteer::ElementHandle
|
|
145
|
+
|
|
146
|
+
# @rbs selector: String -- CSS selector
|
|
147
|
+
# @rbs delay: Numeric? -- Delay between down and up (ms)
|
|
148
|
+
# @rbs button: String? -- Mouse button
|
|
149
|
+
# @rbs click_count: Integer? -- Deprecated: use count (click_count only sets clickCount)
|
|
150
|
+
# @rbs count: Integer? -- Number of clicks to perform
|
|
151
|
+
# @rbs return: void -- No return value
|
|
152
|
+
def click: (String selector, ?delay: Numeric?, ?button: String?, ?click_count: Integer?, ?count: Integer?) -> void
|
|
153
|
+
|
|
154
|
+
# @rbs selector: String -- CSS selector
|
|
155
|
+
# @rbs return: void -- No return value
|
|
156
|
+
def focus: (String selector) -> void
|
|
157
|
+
|
|
158
|
+
# @rbs selector: String -- CSS selector
|
|
159
|
+
# @rbs return: void -- No return value
|
|
160
|
+
def hover: (String selector) -> void
|
|
161
|
+
|
|
162
|
+
# @rbs selector: String -- CSS selector
|
|
163
|
+
# @rbs values: Array[String] -- Option values to select
|
|
164
|
+
# @rbs return: Array[String] -- Selected values
|
|
165
|
+
def select: (String selector, *untyped values) -> Array[String]
|
|
166
|
+
|
|
167
|
+
# @rbs selector: String -- CSS selector
|
|
168
|
+
# @rbs return: void -- No return value
|
|
169
|
+
def tap: (String selector) -> void
|
|
170
|
+
|
|
171
|
+
# @rbs selector: String -- CSS selector
|
|
172
|
+
# @rbs text: String -- Text to type
|
|
173
|
+
# @rbs delay: Numeric? -- Delay between key presses (ms)
|
|
174
|
+
# @rbs return: void -- No return value
|
|
175
|
+
def type_text: (String selector, String text, ?delay: Numeric?) -> void
|
|
176
|
+
|
|
177
|
+
# @rbs selector: String -- CSS selector
|
|
178
|
+
# @rbs visible: bool? -- Wait for element to be visible
|
|
179
|
+
# @rbs hidden: bool? -- Wait for element to be hidden
|
|
180
|
+
# @rbs timeout: Numeric? -- Maximum wait time in milliseconds
|
|
181
|
+
# @rbs return: Puppeteer::ElementHandle? -- Matching element or nil
|
|
182
|
+
def wait_for_selector: (String selector, ?visible: bool?, ?hidden: bool?, ?timeout: Numeric?) -> Puppeteer::ElementHandle?
|
|
183
|
+
|
|
184
|
+
# @rbs milliseconds: Numeric -- Time to wait in milliseconds
|
|
185
|
+
# @rbs return: void -- No return value
|
|
186
|
+
def wait_for_timeout: (Numeric milliseconds) -> void
|
|
187
|
+
|
|
188
|
+
# @rbs xpath: String -- XPath expression
|
|
189
|
+
# @rbs visible: bool? -- Wait for element to be visible
|
|
190
|
+
# @rbs hidden: bool? -- Wait for element to be hidden
|
|
191
|
+
# @rbs timeout: Numeric? -- Maximum wait time in milliseconds
|
|
192
|
+
# @rbs return: Puppeteer::ElementHandle? -- Matching element or nil
|
|
193
|
+
def wait_for_xpath: (String xpath, ?visible: bool?, ?hidden: bool?, ?timeout: Numeric?) -> Puppeteer::ElementHandle?
|
|
194
|
+
|
|
195
|
+
# @rbs page_function: String -- Function or expression to evaluate
|
|
196
|
+
# @rbs args: Array[untyped] -- Arguments for evaluation
|
|
197
|
+
# @rbs polling: String | Numeric | nil -- Polling strategy
|
|
198
|
+
# @rbs timeout: Numeric? -- Maximum wait time in milliseconds
|
|
199
|
+
# @rbs return: Puppeteer::JSHandle -- Handle to evaluation result
|
|
200
|
+
def wait_for_function: (String page_function, ?args: Array[untyped], ?polling: String | Numeric | nil, ?timeout: Numeric?) -> Puppeteer::JSHandle
|
|
201
|
+
|
|
202
|
+
# @rbs return: String -- Frame title
|
|
203
|
+
def title: () -> String
|
|
204
|
+
|
|
205
|
+
# @rbs frame_payload: Hash[String, untyped] -- Frame payload
|
|
206
|
+
# @rbs return: void -- No return value
|
|
207
|
+
def navigated: (Hash[String, untyped] frame_payload) -> void
|
|
208
|
+
|
|
209
|
+
# @rbs url: String -- Updated URL
|
|
210
|
+
# @rbs return: void -- No return value
|
|
211
|
+
def navigated_within_document: (String url) -> void
|
|
212
|
+
|
|
213
|
+
# @rbs loader_id: String -- Loader ID
|
|
214
|
+
# @rbs name: String -- Lifecycle event name
|
|
215
|
+
# @rbs return: void -- No return value
|
|
216
|
+
def handle_lifecycle_event: (String loader_id, String name) -> void
|
|
217
|
+
|
|
218
|
+
# @rbs return: void -- No return value
|
|
219
|
+
def handle_loading_started: () -> void
|
|
220
|
+
|
|
221
|
+
# @rbs return: void -- No return value
|
|
222
|
+
def handle_loading_stopped: () -> void
|
|
223
|
+
|
|
224
|
+
# @rbs return: void -- No return value
|
|
225
|
+
def detach: () -> void
|
|
226
|
+
end
|