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,314 @@
|
|
|
1
|
+
module Puppeteer
|
|
2
|
+
def self.env: () -> Puppeteer::Env
|
|
3
|
+
def env: () -> Puppeteer::Env
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
class Puppeteer::Env
|
|
7
|
+
def debug?: () -> bool
|
|
8
|
+
def ci?: () -> bool
|
|
9
|
+
def darwin?: () -> bool
|
|
10
|
+
def windows?: () -> bool
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
module Puppeteer::DebugPrint
|
|
14
|
+
def debug_puts: (*untyped, **untyped) -> void
|
|
15
|
+
def debug_print: (*untyped) -> void
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
module Puppeteer::EventCallbackable
|
|
19
|
+
class EventListeners
|
|
20
|
+
include Enumerable[Proc]
|
|
21
|
+
|
|
22
|
+
def initialize: () -> void
|
|
23
|
+
def add: () { (*untyped, **untyped) -> untyped } -> String
|
|
24
|
+
def delete: (String id) -> untyped
|
|
25
|
+
def delete_by_handler: (Proc handler) -> untyped
|
|
26
|
+
def each: () { (Proc) -> untyped } -> void
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def add_event_listener: (untyped event_name) { (*untyped, **untyped) -> untyped } -> String
|
|
30
|
+
def on: (untyped event_name) { (*untyped, **untyped) -> untyped } -> String
|
|
31
|
+
def off: (untyped event_name_or_id, ?Proc listener) ?{ (*untyped, **untyped) -> untyped } -> void
|
|
32
|
+
def remove_event_listener: (*String id_args) -> void
|
|
33
|
+
def observe_first: (untyped event_name) { (*untyped, **untyped) -> untyped } -> String
|
|
34
|
+
def once: (untyped event_name) { (*untyped, **untyped) -> untyped } -> String
|
|
35
|
+
def on_event: (untyped event_name) { (*untyped, **untyped) -> untyped } -> void
|
|
36
|
+
def emit_event: (untyped event_name, *untyped args, **untyped kwargs) -> untyped
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
module Puppeteer::IfPresent
|
|
40
|
+
def if_present: (untyped target) { (untyped) -> untyped } -> untyped
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
class Puppeteer::Error < StandardError
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
class Puppeteer::TimeoutError < Puppeteer::Error
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
class Puppeteer::JSHandle
|
|
50
|
+
def async_dispose_symbol: () -> untyped
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class Puppeteer::ElementHandle::Point
|
|
55
|
+
def initialize: (x: Numeric, y: Numeric) -> void
|
|
56
|
+
def +: (Puppeteer::ElementHandle::Point other) -> Puppeteer::ElementHandle::Point
|
|
57
|
+
def /: (Numeric num) -> Puppeteer::ElementHandle::Point
|
|
58
|
+
def ==: (untyped other) -> bool
|
|
59
|
+
attr_reader x: Numeric
|
|
60
|
+
attr_reader y: Numeric
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
class Puppeteer::ElementHandle::Offset
|
|
64
|
+
def initialize: (x: Numeric, y: Numeric) -> void
|
|
65
|
+
def self.from: (Puppeteer::ElementHandle::Offset | Hash[Symbol, Numeric] | nil offset) -> Puppeteer::ElementHandle::Offset?
|
|
66
|
+
attr_reader x: Numeric
|
|
67
|
+
attr_reader y: Numeric
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
class Puppeteer::ElementHandle::BoundingBox
|
|
71
|
+
def initialize: (x: Numeric, y: Numeric, width: Numeric, height: Numeric) -> void
|
|
72
|
+
attr_reader x: Numeric
|
|
73
|
+
attr_reader y: Numeric
|
|
74
|
+
attr_reader width: Numeric
|
|
75
|
+
attr_reader height: Numeric
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
class Puppeteer::ElementHandle::BoxModel
|
|
79
|
+
def initialize: (Hash[String, untyped] result_model, offset: Puppeteer::ElementHandle::Point) -> void
|
|
80
|
+
attr_reader content: Array[Puppeteer::ElementHandle::Point]
|
|
81
|
+
attr_reader padding: Array[Puppeteer::ElementHandle::Point]
|
|
82
|
+
attr_reader border: Array[Puppeteer::ElementHandle::Point]
|
|
83
|
+
attr_reader margin: Array[Puppeteer::ElementHandle::Point]
|
|
84
|
+
attr_reader width: Numeric
|
|
85
|
+
attr_reader height: Numeric
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
class Puppeteer::FileChooser
|
|
89
|
+
def initialize: (Puppeteer::ElementHandle element, Hash[String, untyped] event) -> void
|
|
90
|
+
def multiple?: () -> bool
|
|
91
|
+
def accept: (Array[String] file_paths) -> void
|
|
92
|
+
def cancel: () -> void
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
class Puppeteer::Geolocation
|
|
96
|
+
def initialize: (latitude: Numeric, longitude: Numeric, ?accuracy: Numeric) -> void
|
|
97
|
+
def to_h: () -> Hash[Symbol, Numeric]
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
class Puppeteer::Devices
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
class Puppeteer::Device
|
|
104
|
+
def initialize: (name: String, user_agent: String, viewport: Puppeteer::Viewport) -> void
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
class Puppeteer::BrowserContext
|
|
108
|
+
include Puppeteer::EventCallbackable
|
|
109
|
+
|
|
110
|
+
class ScreenshotGuard
|
|
111
|
+
def initialize: (untyped semaphore, ?on_release: (^() -> void)?) -> void
|
|
112
|
+
def release: () -> void
|
|
113
|
+
def close: () -> void
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def initialize: (Puppeteer::Connection connection, Puppeteer::Browser browser, String? context_id) -> void
|
|
117
|
+
def ==: (untyped other) -> bool
|
|
118
|
+
def on: (untyped event_name) { (*untyped, **untyped) -> untyped } -> String
|
|
119
|
+
def once: (untyped event_name) { (*untyped, **untyped) -> untyped } -> String
|
|
120
|
+
def targets: () -> Array[Puppeteer::Target]
|
|
121
|
+
def start_screenshot: () -> Puppeteer::BrowserContext::ScreenshotGuard
|
|
122
|
+
def wait_for_screenshot_operations: () -> Puppeteer::BrowserContext::ScreenshotGuard?
|
|
123
|
+
def wait_for_target: (predicate: Proc, ?timeout: Numeric?) -> Puppeteer::Target
|
|
124
|
+
def pages: (?include_all: bool) -> Array[Puppeteer::Page]
|
|
125
|
+
def incognito?: () -> bool
|
|
126
|
+
def closed?: () -> bool
|
|
127
|
+
def override_permissions: (String origin, Array[String] permissions) -> void
|
|
128
|
+
def clear_permission_overrides: () -> void
|
|
129
|
+
def new_page: () -> Puppeteer::Page
|
|
130
|
+
def browser: () -> Puppeteer::Browser
|
|
131
|
+
def close: () -> void
|
|
132
|
+
def cookies: () -> Array[Hash[String, untyped]]
|
|
133
|
+
def set_cookie: (*Hash[Symbol | String, untyped] cookies) -> void
|
|
134
|
+
def delete_cookie: (*Hash[Symbol | String, untyped] cookies) -> void
|
|
135
|
+
def delete_matching_cookies: (*Hash[Symbol | String, untyped] filters) -> void
|
|
136
|
+
def set_download_behavior: (Hash[Symbol | String, untyped] download_behavior) -> void
|
|
137
|
+
|
|
138
|
+
private
|
|
139
|
+
def normalize_cookie_hash: (Hash[Symbol | String, untyped] cookie) -> Hash[String, untyped]
|
|
140
|
+
def hash_value: (Hash[untyped, untyped]? hash, *(String | Symbol) keys) -> untyped
|
|
141
|
+
def convert_partition_key_for_cdp: (untyped partition_key) -> Hash[Symbol, untyped]?
|
|
142
|
+
def convert_partition_key_from_cdp: (untyped partition_key) -> (Hash[String, untyped] | String | nil)
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
class Puppeteer::Frame
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
class Puppeteer::FrameManager
|
|
149
|
+
include Puppeteer::EventCallbackable
|
|
150
|
+
|
|
151
|
+
def initialize: (Puppeteer::CDPSession client, Puppeteer::Page page, bool ignore_https_errors, untyped timeout_settings, ?network_enabled: bool) -> void
|
|
152
|
+
attr_reader client: Puppeteer::CDPSession
|
|
153
|
+
attr_reader timeout_settings: untyped
|
|
154
|
+
attr_reader network_manager: untyped
|
|
155
|
+
|
|
156
|
+
def navigate_frame: (Puppeteer::Frame frame, String url, ?referer: String?, ?referrer_policy: String?, ?timeout: Numeric?, ?wait_until: (String | Array[String] | nil)) -> Puppeteer::HTTPResponse?
|
|
157
|
+
def wait_for_frame_navigation: (Puppeteer::Frame frame, ?timeout: Numeric?, ?wait_until: (String | Array[String] | nil), ?ignore_same_document_navigation: bool) -> Puppeteer::HTTPResponse?
|
|
158
|
+
def handle_attached_to_target: (Puppeteer::Target target) -> void
|
|
159
|
+
def handle_detached_from_target: (Puppeteer::Target target) -> void
|
|
160
|
+
def handle_lifecycle_event: (Hash[String, untyped] event) -> void
|
|
161
|
+
def handle_frame_started_loading: (String frame_id) -> void
|
|
162
|
+
def handle_frame_stopped_loading: (String frame_id) -> void
|
|
163
|
+
def handle_frame_tree: (Puppeteer::CDPSession session, Hash[String, untyped] frame_tree) -> void
|
|
164
|
+
def page: () -> Puppeteer::Page
|
|
165
|
+
def main_frame: () -> Puppeteer::Frame
|
|
166
|
+
def frames: () -> Array[Puppeteer::Frame]
|
|
167
|
+
def frame: (String frame_id) -> Puppeteer::Frame?
|
|
168
|
+
def handle_frame_attached: (Puppeteer::CDPSession session, String frame_id, String? parent_frame_id) -> void
|
|
169
|
+
def handle_frame_navigated: (Hash[String, untyped] frame_payload) -> void
|
|
170
|
+
def handle_frame_navigated_within_document: (String frame_id, String url) -> void
|
|
171
|
+
def handle_frame_detached: (String frame_id, String reason) -> void
|
|
172
|
+
def handle_execution_context_created: (Hash[String, untyped] context_payload, Puppeteer::CDPSession session) -> void
|
|
173
|
+
def handle_execution_context_destroyed: (Integer execution_context_id, Puppeteer::CDPSession session) -> void
|
|
174
|
+
def handle_execution_contexts_cleared: (Puppeteer::CDPSession session) -> void
|
|
175
|
+
def execution_context_by_id: (Integer context_id, Puppeteer::CDPSession session) -> Puppeteer::ExecutionContext
|
|
176
|
+
|
|
177
|
+
private
|
|
178
|
+
|
|
179
|
+
def setup_listeners: (Puppeteer::CDPSession client) -> void
|
|
180
|
+
def init: (String target_id, ?Puppeteer::CDPSession cdp_session) -> void
|
|
181
|
+
def attach_child_frame: (Puppeteer::Frame parent_frame, String parent_frame_id, String frame_id, Puppeteer::CDPSession? session) -> void
|
|
182
|
+
def reattach_frame: (Puppeteer::Frame frame, String frame_id, bool is_main_frame, Hash[String, untyped] frame_payload) -> void
|
|
183
|
+
def ensure_isolated_world: (Puppeteer::CDPSession session, String name) -> void
|
|
184
|
+
def remove_frame_recursively: (Puppeteer::Frame frame) -> void
|
|
185
|
+
def referrer_policy_to_protocol: (String? referrer_policy) -> String?
|
|
186
|
+
def assert_no_legacy_navigation_options: (wait_until: (String | Array[String] | nil)) -> void
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
class Puppeteer::NetworkCondition
|
|
190
|
+
def initialize: (download: Numeric, upload: Numeric, latency: Numeric) -> void
|
|
191
|
+
def self.new: (download: Numeric, upload: Numeric, latency: Numeric) -> Puppeteer::NetworkCondition
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
module Puppeteer::NetworkConditions
|
|
195
|
+
def slow_3g: () -> Puppeteer::NetworkCondition
|
|
196
|
+
def fast_3g: () -> Puppeteer::NetworkCondition
|
|
197
|
+
|
|
198
|
+
def self.slow_3g: () -> Puppeteer::NetworkCondition
|
|
199
|
+
def self.fast_3g: () -> Puppeteer::NetworkCondition
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
class Puppeteer::Target
|
|
203
|
+
class TargetInfo
|
|
204
|
+
def initialize: (Hash[String, untyped] options) -> void
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
def initialize: (target_info: Puppeteer::Target::TargetInfo, session: Puppeteer::CDPSession?, browser_context: Puppeteer::BrowserContext, target_manager: untyped, session_factory: Proc, ignore_https_errors: bool, default_viewport: Puppeteer::Viewport?, network_enabled: bool, is_page_target_callback: Proc) -> void
|
|
208
|
+
def self.new: (target_info: Puppeteer::Target::TargetInfo, session: Puppeteer::CDPSession?, browser_context: Puppeteer::BrowserContext, target_manager: untyped, session_factory: Proc, ignore_https_errors: bool, default_viewport: Puppeteer::Viewport?, network_enabled: bool, is_page_target_callback: Proc) -> Puppeteer::Target
|
|
209
|
+
|
|
210
|
+
def closed_callback: () -> void
|
|
211
|
+
def ignore_initialize_callback_promise: () -> void
|
|
212
|
+
def initialized?: () -> bool
|
|
213
|
+
def session: () -> Puppeteer::CDPSession?
|
|
214
|
+
def create_cdp_session: () -> Puppeteer::CDPSession
|
|
215
|
+
def target_manager: () -> untyped
|
|
216
|
+
def page: () -> Puppeteer::Page?
|
|
217
|
+
def worker: () -> Puppeteer::CdpWebWorker?
|
|
218
|
+
def url: () -> String
|
|
219
|
+
def type: () -> String
|
|
220
|
+
def raw_type: () -> String
|
|
221
|
+
def browser: () -> Puppeteer::Browser
|
|
222
|
+
def browser_context: () -> Puppeteer::BrowserContext
|
|
223
|
+
def opener: () -> Puppeteer::Target?
|
|
224
|
+
def handle_target_info_changed: (Puppeteer::Target::TargetInfo target_info) -> void
|
|
225
|
+
|
|
226
|
+
private
|
|
227
|
+
|
|
228
|
+
def handle_initialized: (bool success) -> bool
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
class Puppeteer::Page::Metrics
|
|
232
|
+
def initialize: (Hash[String, untyped] metrics_response) -> void
|
|
233
|
+
def []: (String key) -> untyped
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
class Puppeteer::Viewport
|
|
237
|
+
def initialize: (width: Integer, height: Integer, ?device_scale_factor: Numeric, ?is_mobile: bool, ?has_touch: bool, ?is_landscape: bool) -> void
|
|
238
|
+
attr_reader width: Integer
|
|
239
|
+
attr_reader height: Integer
|
|
240
|
+
attr_reader device_scale_factor: Numeric
|
|
241
|
+
def mobile?: () -> bool
|
|
242
|
+
def has_touch?: () -> bool
|
|
243
|
+
def landscape?: () -> bool
|
|
244
|
+
def merge: (?width: Integer?, ?height: Integer?, ?device_scale_factor: Numeric?, ?is_mobile: bool?, ?has_touch: bool?, ?is_landscape: bool?) -> Puppeteer::Viewport
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
class Puppeteer::WebSocketTransport
|
|
248
|
+
class ClosedError < Puppeteer::Error
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
def self.create: (String url) -> Puppeteer::WebSocketTransport
|
|
252
|
+
def initialize: (String url) -> void
|
|
253
|
+
def connect: () -> untyped
|
|
254
|
+
def send_text: (String message) -> void
|
|
255
|
+
def close: () -> void
|
|
256
|
+
def on_close: () { (untyped, untyped) -> untyped } -> void
|
|
257
|
+
def on_message: () { (String) -> untyped } -> void
|
|
258
|
+
def connected?: () -> bool
|
|
259
|
+
def closed?: () -> bool
|
|
260
|
+
|
|
261
|
+
private
|
|
262
|
+
|
|
263
|
+
def receive_loop: (untyped connection) -> void
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
class Puppeteer::Connection
|
|
267
|
+
include Puppeteer::DebugPrint
|
|
268
|
+
include Puppeteer::EventCallbackable
|
|
269
|
+
|
|
270
|
+
def initialize: (String url, Puppeteer::WebSocketTransport transport, ?Numeric delay, ?protocol_timeout: Numeric?) -> void
|
|
271
|
+
def closed?: () -> bool
|
|
272
|
+
def self.from_session: (Puppeteer::CDPSession session) -> Puppeteer::Connection?
|
|
273
|
+
def session: (String session_id) -> Puppeteer::CDPSession?
|
|
274
|
+
def url: () -> String
|
|
275
|
+
def send_message: (String method, ?Hash[Symbol | String, untyped] params) -> untyped
|
|
276
|
+
def async_send_message: (String method, ?Hash[Symbol | String, untyped] params) -> untyped
|
|
277
|
+
def generate_id: () { (Integer) -> untyped } -> untyped
|
|
278
|
+
def raw_send: (id: Integer, message: Hash[Symbol | String, untyped]) -> void
|
|
279
|
+
def on_close: () { (untyped, untyped) -> untyped } -> void
|
|
280
|
+
def on_message: () { (String) -> untyped } -> void
|
|
281
|
+
def dispose: () -> void
|
|
282
|
+
def auto_attached?: (String target_id) -> bool
|
|
283
|
+
def create_session: (untyped target_info, ?auto_attach_emulated: bool) -> Puppeteer::CDPSession
|
|
284
|
+
|
|
285
|
+
private
|
|
286
|
+
|
|
287
|
+
def sleep_before_handling_message: (Hash[String, untyped] message) -> void
|
|
288
|
+
def should_handle_synchronously?: (Hash[String, untyped] message) -> bool
|
|
289
|
+
def request_debug_printer: () -> untyped
|
|
290
|
+
def response_debug_printer: () -> untyped
|
|
291
|
+
def handle_message: (Hash[String, untyped] message) -> void
|
|
292
|
+
def handle_close: () -> void
|
|
293
|
+
end
|
|
294
|
+
|
|
295
|
+
class Puppeteer::BrowserRunner
|
|
296
|
+
def initialize: (String executable_path, Array[String] process_arguments, String user_data_dir, bool using_temp_user_data_dir) -> void
|
|
297
|
+
def start: (?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?) -> void
|
|
298
|
+
def close: () -> void
|
|
299
|
+
def kill: () -> void
|
|
300
|
+
def setup_connection: (use_pipe: bool, timeout: Integer?, slow_mo: Integer?, preferred_revision: String?, ?protocol_timeout: Numeric?) -> Puppeteer::Connection
|
|
301
|
+
|
|
302
|
+
private
|
|
303
|
+
|
|
304
|
+
def wait_for_ws_endpoint: (Puppeteer::BrowserRunner::BrowserProcess browser_process, Numeric? timeout, String? preferred_revision) -> String
|
|
305
|
+
|
|
306
|
+
class BrowserProcess
|
|
307
|
+
def initialize: (Hash[String, String] env, String executable_path, Array[String]? args) -> void
|
|
308
|
+
def kill: () -> void
|
|
309
|
+
def dispose: () -> void
|
|
310
|
+
attr_reader stdout: untyped
|
|
311
|
+
attr_reader stderr: untyped
|
|
312
|
+
attr_reader spawnargs: Array[String]
|
|
313
|
+
end
|
|
314
|
+
end
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# Generated from lib/puppeteer/browser.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
class Puppeteer::Browser
|
|
4
|
+
include Puppeteer::DebugPrint
|
|
5
|
+
|
|
6
|
+
include Puppeteer::EventCallbackable
|
|
7
|
+
|
|
8
|
+
include Puppeteer::IfPresent
|
|
9
|
+
|
|
10
|
+
# @rbs product: String? -- Browser product (chrome only)
|
|
11
|
+
# @rbs connection: Puppeteer::Connection -- CDP connection
|
|
12
|
+
# @rbs context_ids: Array[String] -- Browser context IDs
|
|
13
|
+
# @rbs ignore_https_errors: bool -- Ignore HTTPS errors
|
|
14
|
+
# @rbs default_viewport: Puppeteer::Viewport? -- Default viewport
|
|
15
|
+
# @rbs network_enabled: bool -- Whether network events are enabled
|
|
16
|
+
# @rbs process: Puppeteer::BrowserRunner::BrowserProcess? -- Browser process handle
|
|
17
|
+
# @rbs close_callback: Proc -- Close callback
|
|
18
|
+
# @rbs target_filter_callback: Proc? -- Target filter callback
|
|
19
|
+
# @rbs is_page_target_callback: Proc? -- Page target predicate
|
|
20
|
+
# @rbs return: Puppeteer::Browser -- Browser instance
|
|
21
|
+
def self.create: (product: String?, connection: Puppeteer::Connection, context_ids: Array[String], ignore_https_errors: bool, default_viewport: Puppeteer::Viewport?, process: Puppeteer::BrowserRunner::BrowserProcess?, close_callback: Proc, target_filter_callback: Proc?, is_page_target_callback: Proc?, ?network_enabled: bool) -> Puppeteer::Browser
|
|
22
|
+
|
|
23
|
+
# @rbs product: String? -- Browser product (chrome only)
|
|
24
|
+
# @rbs connection: Puppeteer::Connection -- CDP connection
|
|
25
|
+
# @rbs context_ids: Array[String] -- Browser context IDs
|
|
26
|
+
# @rbs ignore_https_errors: bool -- Ignore HTTPS errors
|
|
27
|
+
# @rbs default_viewport: Puppeteer::Viewport? -- Default viewport
|
|
28
|
+
# @rbs network_enabled: bool -- Whether network events are enabled
|
|
29
|
+
# @rbs process: Puppeteer::BrowserRunner::BrowserProcess? -- Browser process handle
|
|
30
|
+
# @rbs close_callback: Proc -- Close callback
|
|
31
|
+
# @rbs target_filter_callback: Proc? -- Target filter callback
|
|
32
|
+
# @rbs is_page_target_callback: Proc? -- Page target predicate
|
|
33
|
+
# @rbs return: void -- No return value
|
|
34
|
+
def initialize: (product: String?, connection: Puppeteer::Connection, context_ids: Array[String], ignore_https_errors: bool, default_viewport: Puppeteer::Viewport?, process: Puppeteer::BrowserRunner::BrowserProcess?, close_callback: Proc, target_filter_callback: Proc?, is_page_target_callback: Proc?, ?network_enabled: bool) -> void
|
|
35
|
+
|
|
36
|
+
private def default_target_filter_callback: (untyped target_info) -> untyped
|
|
37
|
+
|
|
38
|
+
private def default_is_page_target_callback: (untyped target_info) -> untyped
|
|
39
|
+
|
|
40
|
+
attr_reader is_page_target_callback: untyped
|
|
41
|
+
|
|
42
|
+
# @rbs event_name: (String | Symbol) -- Browser event name
|
|
43
|
+
# @rbs &block: ^(untyped) -> void -- Event handler
|
|
44
|
+
# @rbs return: String -- Listener ID
|
|
45
|
+
def on: (String | Symbol event_name) ?{ (?) -> untyped } -> String
|
|
46
|
+
|
|
47
|
+
# @rbs event_name: (String | Symbol) -- Browser event name
|
|
48
|
+
# @rbs &block: ^(untyped) -> void -- Event handler
|
|
49
|
+
# @rbs return: String -- Listener ID
|
|
50
|
+
def once: (String | Symbol event_name) ?{ (?) -> untyped } -> String
|
|
51
|
+
|
|
52
|
+
private def attach: () -> untyped
|
|
53
|
+
|
|
54
|
+
private def detach: () -> untyped
|
|
55
|
+
|
|
56
|
+
# @rbs return: Puppeteer::BrowserRunner::BrowserProcess? -- Browser process handle
|
|
57
|
+
def process: () -> Puppeteer::BrowserRunner::BrowserProcess?
|
|
58
|
+
|
|
59
|
+
private def target_manager: () -> untyped
|
|
60
|
+
|
|
61
|
+
# @rbs return: Puppeteer::BrowserContext -- New incognito browser context
|
|
62
|
+
def create_incognito_browser_context: () -> Puppeteer::BrowserContext
|
|
63
|
+
|
|
64
|
+
# @rbs proxy_server: String? -- Proxy server for new context
|
|
65
|
+
# @rbs proxy_bypass_list: Array[String]? -- Proxy bypass list
|
|
66
|
+
# @rbs download_behavior: Hash[Symbol | String, untyped]? -- Download behavior options
|
|
67
|
+
# @rbs return: Puppeteer::BrowserContext -- New browser context
|
|
68
|
+
def create_browser_context: (?proxy_server: String?, ?proxy_bypass_list: Array[String]?, ?download_behavior: Hash[Symbol | String, untyped]?) -> Puppeteer::BrowserContext
|
|
69
|
+
|
|
70
|
+
# @rbs return: Array[Puppeteer::BrowserContext] -- All browser contexts
|
|
71
|
+
def browser_contexts: () -> Array[Puppeteer::BrowserContext]
|
|
72
|
+
|
|
73
|
+
# @rbs return: Puppeteer::BrowserContext -- Default browser context
|
|
74
|
+
def default_browser_context: () -> Puppeteer::BrowserContext
|
|
75
|
+
|
|
76
|
+
# @rbs context_id: String? -- Browser context ID
|
|
77
|
+
# @rbs return: void -- No return value
|
|
78
|
+
def dispose_context: (String? context_id) -> void
|
|
79
|
+
|
|
80
|
+
class MissingBrowserContextError < Puppeteer::Error
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# @rbs target_info: Puppeteer::Target::TargetInfo -- Target info
|
|
84
|
+
# @rbs session: Puppeteer::CDPSession? -- Attached session
|
|
85
|
+
# @rbs return: Puppeteer::Target -- Created target
|
|
86
|
+
def create_target: (Puppeteer::Target::TargetInfo target_info, Puppeteer::CDPSession? session) -> Puppeteer::Target
|
|
87
|
+
|
|
88
|
+
private def handle_attached_to_target: (untyped target) -> untyped
|
|
89
|
+
|
|
90
|
+
private def handle_detached_from_target: (untyped target) -> untyped
|
|
91
|
+
|
|
92
|
+
private def handle_target_changed: (untyped target, untyped target_info) -> untyped
|
|
93
|
+
|
|
94
|
+
private def handle_target_discovered: (untyped target_info) -> untyped
|
|
95
|
+
|
|
96
|
+
# @rbs return: String -- WebSocket endpoint URL
|
|
97
|
+
def ws_endpoint: () -> String
|
|
98
|
+
|
|
99
|
+
# @rbs return: Puppeteer::Page -- New page in default context
|
|
100
|
+
def new_page: () -> Puppeteer::Page
|
|
101
|
+
|
|
102
|
+
class MissingTargetError < Puppeteer::Error
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
class CreatePageError < Puppeteer::Error
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# @rbs context_id: String? -- Browser context ID
|
|
109
|
+
# @rbs return: Puppeteer::Page -- Created page
|
|
110
|
+
def create_page_in_context: (String? context_id) -> Puppeteer::Page
|
|
111
|
+
|
|
112
|
+
# All active targets inside the Browser. In case of multiple browser contexts, returns
|
|
113
|
+
# an array with all the targets in all browser contexts.
|
|
114
|
+
# @rbs return: Array[Puppeteer::Target] -- Active targets
|
|
115
|
+
def targets: () -> Array[Puppeteer::Target]
|
|
116
|
+
|
|
117
|
+
# The target associated with the browser.
|
|
118
|
+
# @rbs return: Puppeteer::Target -- Browser target
|
|
119
|
+
def target: () -> Puppeteer::Target
|
|
120
|
+
|
|
121
|
+
# used only in Target#opener
|
|
122
|
+
private def find_target_by_id: (untyped target_id) -> untyped
|
|
123
|
+
|
|
124
|
+
# @rbs predicate: Proc -- Predicate for target matching
|
|
125
|
+
# @rbs timeout: Numeric? -- Timeout in milliseconds
|
|
126
|
+
# @rbs return: Puppeteer::Target -- Matching target
|
|
127
|
+
def wait_for_target: (predicate: Proc, ?timeout: Numeric?) -> Puppeteer::Target
|
|
128
|
+
|
|
129
|
+
# @rbs return: Array[Puppeteer::Page] -- All pages across contexts
|
|
130
|
+
def pages: () -> Array[Puppeteer::Page]
|
|
131
|
+
|
|
132
|
+
# @rbs return: String -- Browser version string
|
|
133
|
+
def version: () -> String
|
|
134
|
+
|
|
135
|
+
# @rbs return: String -- Browser user agent string
|
|
136
|
+
def user_agent: () -> String
|
|
137
|
+
|
|
138
|
+
# @rbs return: void -- No return value
|
|
139
|
+
def close: () -> void
|
|
140
|
+
|
|
141
|
+
# @rbs return: void -- No return value
|
|
142
|
+
def disconnect: () -> void
|
|
143
|
+
|
|
144
|
+
# @rbs return: bool -- Whether the browser is connected
|
|
145
|
+
def connected?: () -> bool
|
|
146
|
+
|
|
147
|
+
class Version
|
|
148
|
+
# @rbs connection: Puppeteer::Connection -- CDP connection
|
|
149
|
+
# @rbs return: Puppeteer::Browser::Version -- Browser version info
|
|
150
|
+
def self.fetch: (Puppeteer::Connection connection) -> Puppeteer::Browser::Version
|
|
151
|
+
|
|
152
|
+
# @rbs hash: Hash[String, String] -- Version payload
|
|
153
|
+
# @rbs return: void -- No return value
|
|
154
|
+
def initialize: (Hash[String, String] hash) -> void
|
|
155
|
+
|
|
156
|
+
attr_reader protocol_version: untyped
|
|
157
|
+
|
|
158
|
+
attr_reader product: untyped
|
|
159
|
+
|
|
160
|
+
attr_reader revision: untyped
|
|
161
|
+
|
|
162
|
+
attr_reader user_agent: untyped
|
|
163
|
+
|
|
164
|
+
attr_reader js_version: untyped
|
|
165
|
+
end
|
|
166
|
+
end
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Generated from lib/puppeteer/cdp_session.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
class Puppeteer::CDPSession
|
|
4
|
+
include Puppeteer::DebugPrint
|
|
5
|
+
|
|
6
|
+
include Puppeteer::EventCallbackable
|
|
7
|
+
|
|
8
|
+
class Error < Puppeteer::Error
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
# @rbs connection: Puppeteer::Connection -- CDP connection
|
|
12
|
+
# @rbs target_type: String -- Target type
|
|
13
|
+
# @rbs session_id: String -- CDP session id
|
|
14
|
+
# @rbs parent_session: Puppeteer::CDPSession? -- Parent CDP session
|
|
15
|
+
# @rbs return: void -- No return value
|
|
16
|
+
def initialize: (Puppeteer::Connection connection, String target_type, String session_id, ?parent_session: Puppeteer::CDPSession?) -> void
|
|
17
|
+
|
|
18
|
+
# @rbs return: String -- CDP session id
|
|
19
|
+
def id: () -> String
|
|
20
|
+
|
|
21
|
+
attr_reader connection: Puppeteer::Connection?
|
|
22
|
+
|
|
23
|
+
attr_reader parent_session: Puppeteer::CDPSession?
|
|
24
|
+
|
|
25
|
+
attr_accessor target: Puppeteer::Target?
|
|
26
|
+
|
|
27
|
+
# @rbs return: void -- Resolve session readiness
|
|
28
|
+
def mark_ready: () -> void
|
|
29
|
+
|
|
30
|
+
# @rbs return: bool -- True when session is ready
|
|
31
|
+
def wait_for_ready: () -> bool
|
|
32
|
+
|
|
33
|
+
# @rbs method: String -- CDP method name
|
|
34
|
+
# @rbs params: Hash[String, untyped] -- CDP parameters
|
|
35
|
+
# @rbs return: Hash[String, untyped] -- CDP response
|
|
36
|
+
def send_message: (String method, ?Hash[String, untyped] params) -> Hash[String, untyped]
|
|
37
|
+
|
|
38
|
+
# @rbs method: String -- CDP method name
|
|
39
|
+
# @rbs params: Hash[String, untyped] -- CDP parameters
|
|
40
|
+
# @rbs return: Async::Promise[Hash[String, untyped]] -- Async CDP response
|
|
41
|
+
def async_send_message: (String method, ?Hash[String, untyped] params) -> Async::Promise[Hash[String, untyped]]
|
|
42
|
+
|
|
43
|
+
# @rbs message: Hash[String, untyped] -- Raw CDP message
|
|
44
|
+
# @rbs return: void -- No return value
|
|
45
|
+
def handle_message: (Hash[String, untyped] message) -> void
|
|
46
|
+
|
|
47
|
+
private def callback_with_message: (untyped callback, untyped message) -> untyped
|
|
48
|
+
|
|
49
|
+
# @rbs return: void -- Detach the session
|
|
50
|
+
def detach: () -> void
|
|
51
|
+
|
|
52
|
+
# @rbs return: void -- Close the session and reject pending callbacks
|
|
53
|
+
def handle_closed: () -> void
|
|
54
|
+
|
|
55
|
+
# @rbs event_name: String -- CDP event name
|
|
56
|
+
# @rbs &block: ^(untyped) -> void -- Event handler
|
|
57
|
+
# @rbs return: String -- Listener id
|
|
58
|
+
def on: (String event_name) ?{ (?) -> untyped } -> String
|
|
59
|
+
|
|
60
|
+
# @rbs event_name: String -- CDP event name
|
|
61
|
+
# @rbs &block: ^(untyped) -> void -- Event handler
|
|
62
|
+
# @rbs return: String -- Listener id
|
|
63
|
+
def once: (String event_name) ?{ (?) -> untyped } -> String
|
|
64
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Generated from lib/puppeteer/dialog.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
class Puppeteer::Dialog
|
|
4
|
+
# @rbs type: String -- Dialog type
|
|
5
|
+
# @rbs message: String -- Dialog message
|
|
6
|
+
# @rbs default_value: String? -- Default prompt value, if any
|
|
7
|
+
# @rbs return: void -- No return value
|
|
8
|
+
def initialize: (type: String, message: String, ?default_value: String?) -> void
|
|
9
|
+
|
|
10
|
+
attr_reader type: String
|
|
11
|
+
|
|
12
|
+
attr_reader message: String
|
|
13
|
+
|
|
14
|
+
attr_reader default_value: String
|
|
15
|
+
|
|
16
|
+
# @rbs prompt_text: String? -- Text entered into the prompt
|
|
17
|
+
# @rbs return: void -- No return value
|
|
18
|
+
def accept: (?String? prompt_text) -> void
|
|
19
|
+
|
|
20
|
+
# @rbs return: void -- No return value
|
|
21
|
+
def dismiss: () -> void
|
|
22
|
+
|
|
23
|
+
# @rbs accept: bool -- Whether to accept the dialog
|
|
24
|
+
# @rbs text: String? -- Text entered into the prompt
|
|
25
|
+
# @rbs return: void -- No return value
|
|
26
|
+
def handle: (accept: bool, ?text: String?) -> void
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
class Puppeteer::CdpDialog < Puppeteer::Dialog
|
|
30
|
+
# @rbs client: Puppeteer::CDPSession -- CDP session used to handle dialog
|
|
31
|
+
# @rbs type: String -- Dialog type
|
|
32
|
+
# @rbs message: String -- Dialog message
|
|
33
|
+
# @rbs default_value: String? -- Default prompt value, if any
|
|
34
|
+
# @rbs return: void -- No return value
|
|
35
|
+
def initialize: (Puppeteer::CDPSession client, type: String, message: String, default_value: String?) -> void
|
|
36
|
+
|
|
37
|
+
# @rbs accept: bool -- Whether to accept the dialog
|
|
38
|
+
# @rbs text: String? -- Text entered into the prompt
|
|
39
|
+
# @rbs return: void -- No return value
|
|
40
|
+
def handle: (accept: bool, ?text: String?) -> void
|
|
41
|
+
end
|