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.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -3
- data/AGENTS.md +170 -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 +605 -0
- data/CLAUDE/rbs_type_checking.md +101 -0
- data/CLAUDE/spec_migration_plans.md +1039 -0
- data/CLAUDE/testing.md +278 -0
- data/CLAUDE.md +242 -0
- data/README.md +9 -0
- data/Rakefile +7 -0
- data/Steepfile +28 -0
- data/docs/api_coverage.md +106 -57
- 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 +236 -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 +177 -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 +77 -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/locators.rb +733 -0
- 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/p_query_handler.rb +367 -0
- data/lib/puppeteer/p_selector_parser.rb +241 -0
- data/lib/puppeteer/page/screenshot_task_queue.rb +14 -4
- data/lib/puppeteer/page.rb +583 -226
- data/lib/puppeteer/puppeteer.rb +171 -64
- data/lib/puppeteer/query_handler_manager.rb +66 -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 +23 -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 +308 -0
- data/sig/puppeteer/execution_context.rbs +87 -0
- data/sig/puppeteer/frame.rbs +233 -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/locators.rbs +222 -0
- data/sig/puppeteer/mouse.rbs +113 -0
- data/sig/puppeteer/p_query_handler.rbs +73 -0
- data/sig/puppeteer/p_selector_parser.rbs +31 -0
- data/sig/puppeteer/page.rbs +522 -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 +122 -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,214 @@
|
|
|
1
|
+
# Generated from lib/puppeteer/http_request.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
class Puppeteer::HTTPRequest
|
|
4
|
+
include Puppeteer::DebugPrint
|
|
5
|
+
|
|
6
|
+
include Puppeteer::IfPresent
|
|
7
|
+
|
|
8
|
+
DEFAULT_INTERCEPT_RESOLUTION_PRIORITY: ::Integer
|
|
9
|
+
|
|
10
|
+
# defines some methods used only in NetworkManager, Response
|
|
11
|
+
class InternalAccessor
|
|
12
|
+
def initialize: (untyped request) -> untyped
|
|
13
|
+
|
|
14
|
+
def request_id: () -> untyped
|
|
15
|
+
|
|
16
|
+
def client=: (untyped client) -> untyped
|
|
17
|
+
|
|
18
|
+
def interception_id: () -> untyped
|
|
19
|
+
|
|
20
|
+
# @param response [Puppeteer::HTTPResponse]
|
|
21
|
+
def response=: (untyped response) -> untyped
|
|
22
|
+
|
|
23
|
+
def redirect_chain: () -> untyped
|
|
24
|
+
|
|
25
|
+
def failure_text=: (untyped failure_text) -> untyped
|
|
26
|
+
|
|
27
|
+
def from_memory_cache=: (untyped from_memory_cache) -> untyped
|
|
28
|
+
|
|
29
|
+
def from_memory_cache?: () -> untyped
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
class InterceptResolutionState
|
|
33
|
+
def self.abort: (?priority: untyped) -> untyped
|
|
34
|
+
|
|
35
|
+
def self.respond: (?priority: untyped) -> untyped
|
|
36
|
+
|
|
37
|
+
def self.continue: (?priority: untyped) -> untyped
|
|
38
|
+
|
|
39
|
+
def self.disabled: (?priority: untyped) -> untyped
|
|
40
|
+
|
|
41
|
+
def self.none: (?priority: untyped) -> untyped
|
|
42
|
+
|
|
43
|
+
def self.already_handled: (?priority: untyped) -> untyped
|
|
44
|
+
|
|
45
|
+
private def initialize: (action: untyped, priority: untyped) -> untyped
|
|
46
|
+
|
|
47
|
+
def priority_unspecified?: () -> untyped
|
|
48
|
+
|
|
49
|
+
attr_reader action: untyped
|
|
50
|
+
|
|
51
|
+
attr_reader priority: untyped
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# @param client [Puppeteer::CDPSession]
|
|
55
|
+
# @param frame [Puppeteer::Frame]
|
|
56
|
+
# @param interception_id [string|nil]
|
|
57
|
+
# @param allow_interception [boolean]
|
|
58
|
+
# @param event [Hash]
|
|
59
|
+
# @param redirect_chain Array<Request>
|
|
60
|
+
def initialize: (untyped client, untyped frame, untyped interception_id, untyped allow_interception, untyped event, untyped redirect_chain) -> untyped
|
|
61
|
+
|
|
62
|
+
attr_reader internal: untyped
|
|
63
|
+
|
|
64
|
+
attr_reader client: untyped
|
|
65
|
+
|
|
66
|
+
attr_reader url: untyped
|
|
67
|
+
|
|
68
|
+
attr_reader resource_type: untyped
|
|
69
|
+
|
|
70
|
+
attr_reader method: untyped
|
|
71
|
+
|
|
72
|
+
attr_reader post_data: untyped
|
|
73
|
+
|
|
74
|
+
attr_reader response: untyped
|
|
75
|
+
|
|
76
|
+
attr_reader frame: untyped
|
|
77
|
+
|
|
78
|
+
attr_reader initiator: untyped
|
|
79
|
+
|
|
80
|
+
def update_headers: (untyped headers) -> untyped
|
|
81
|
+
|
|
82
|
+
def headers: () -> untyped
|
|
83
|
+
|
|
84
|
+
# @rbs return: bool -- Whether request has post data
|
|
85
|
+
def has_post_data?: () -> bool
|
|
86
|
+
|
|
87
|
+
# @rbs return: String? -- Post data string if available
|
|
88
|
+
def fetch_post_data: () -> String?
|
|
89
|
+
|
|
90
|
+
def inspect: () -> untyped
|
|
91
|
+
|
|
92
|
+
private def assert_interception_allowed: () -> untyped
|
|
93
|
+
|
|
94
|
+
private def assert_interception_not_handled: () -> untyped
|
|
95
|
+
|
|
96
|
+
private def can_be_intercepted?: () -> untyped
|
|
97
|
+
|
|
98
|
+
# @returns the `ContinueRequestOverrides` that will be used
|
|
99
|
+
# if the interception is allowed to continue (ie, `abort()` and
|
|
100
|
+
# `respond()` aren't called).
|
|
101
|
+
def continue_request_overrides: () -> untyped
|
|
102
|
+
|
|
103
|
+
# @returns The `ResponseForRequest` that gets used if the
|
|
104
|
+
# interception is allowed to respond (ie, `abort()` is not called).
|
|
105
|
+
def response_for_request: () -> untyped
|
|
106
|
+
|
|
107
|
+
# @returns the most recent reason for aborting the request
|
|
108
|
+
def abort_error_reason: () -> untyped
|
|
109
|
+
|
|
110
|
+
# @returns An InterceptResolutionState object describing the current resolution
|
|
111
|
+
# action and priority.
|
|
112
|
+
#
|
|
113
|
+
# InterceptResolutionState contains:
|
|
114
|
+
# action: InterceptResolutionAction
|
|
115
|
+
# priority?: number
|
|
116
|
+
#
|
|
117
|
+
# InterceptResolutionAction is one of: `abort`, `respond`, `continue`,
|
|
118
|
+
# `disabled`, `none`, or `alreay-handled`
|
|
119
|
+
def intercept_resolution_state: () -> untyped
|
|
120
|
+
|
|
121
|
+
def intercept_resolution_handled?: () -> untyped
|
|
122
|
+
|
|
123
|
+
# Adds an async request handler to the processing queue.
|
|
124
|
+
# Deferred handlers are not guaranteed to execute in any particular order,
|
|
125
|
+
# but they are guarnateed to resolve before the request interception
|
|
126
|
+
# is finalized.
|
|
127
|
+
#
|
|
128
|
+
# @param pending_handler [Proc]
|
|
129
|
+
def enqueue_intercept_action: (untyped pending_handler) -> untyped
|
|
130
|
+
|
|
131
|
+
# Awaits pending interception handlers and then decides how to fulfill
|
|
132
|
+
# the request interception.
|
|
133
|
+
def finalize_interceptions: () -> untyped
|
|
134
|
+
|
|
135
|
+
def navigation_request?: () -> untyped
|
|
136
|
+
|
|
137
|
+
def redirect_chain: () -> untyped
|
|
138
|
+
|
|
139
|
+
def failure: () -> untyped
|
|
140
|
+
|
|
141
|
+
private def headers_to_array: (untyped headers) -> untyped
|
|
142
|
+
|
|
143
|
+
class InterceptionNotEnabledError < Puppeteer::Error
|
|
144
|
+
def initialize: () -> untyped
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
class AlreadyHandledError < Puppeteer::Error
|
|
148
|
+
def initialize: () -> untyped
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
# proceed request on request interception.
|
|
152
|
+
#
|
|
153
|
+
# Example:
|
|
154
|
+
#
|
|
155
|
+
# page.on 'request' do |req|
|
|
156
|
+
# # Override headers
|
|
157
|
+
# headers = req.headers.merge(
|
|
158
|
+
# foo: 'bar', # set "foo" header
|
|
159
|
+
# origin: nil, # remove "origin" header
|
|
160
|
+
# )
|
|
161
|
+
# req.continue(headers: headers)
|
|
162
|
+
# end
|
|
163
|
+
#
|
|
164
|
+
# @param error_code [String|Symbol]
|
|
165
|
+
def continue: (?url: untyped, ?method: untyped, ?post_data: untyped, ?headers: untyped, ?priority: untyped) -> untyped
|
|
166
|
+
|
|
167
|
+
private def continue_impl: (untyped overrides) -> untyped
|
|
168
|
+
|
|
169
|
+
# Mocking response.
|
|
170
|
+
#
|
|
171
|
+
# Example:
|
|
172
|
+
#
|
|
173
|
+
# page.on 'request' do |req|
|
|
174
|
+
# req.respond(
|
|
175
|
+
# status: 404,
|
|
176
|
+
# content_type: 'text/plain',
|
|
177
|
+
# body: 'Not Found!'
|
|
178
|
+
# )
|
|
179
|
+
# end
|
|
180
|
+
#
|
|
181
|
+
# @param status [Integer]
|
|
182
|
+
# @param headers [Hash<String, String>]
|
|
183
|
+
# @param content_type [String]
|
|
184
|
+
# @param body [String]
|
|
185
|
+
def respond: (?status: untyped, ?headers: untyped, ?content_type: untyped, ?body: untyped, ?priority: untyped) -> untyped
|
|
186
|
+
|
|
187
|
+
private def respond_impl: (?status: untyped, ?headers: untyped, ?content_type: untyped, ?body: untyped) -> untyped
|
|
188
|
+
|
|
189
|
+
# abort request on request interception.
|
|
190
|
+
#
|
|
191
|
+
# Example:
|
|
192
|
+
#
|
|
193
|
+
# page.on 'request' do |req|
|
|
194
|
+
# if req.url.include?("porn")
|
|
195
|
+
# req.abort
|
|
196
|
+
# else
|
|
197
|
+
# req.continue
|
|
198
|
+
# end
|
|
199
|
+
# end
|
|
200
|
+
#
|
|
201
|
+
# @param error_code [String|Symbol]
|
|
202
|
+
def abort: (?error_code: untyped, ?priority: untyped) -> untyped
|
|
203
|
+
|
|
204
|
+
private def abort_impl: (untyped error_reason) -> untyped
|
|
205
|
+
|
|
206
|
+
private def target_closed_error?: (untyped error) -> untyped
|
|
207
|
+
|
|
208
|
+
private def handle_interception_error: (untyped error) -> untyped
|
|
209
|
+
|
|
210
|
+
ERROR_REASONS: untyped
|
|
211
|
+
|
|
212
|
+
# List taken from https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml with extra 306 and 418 codes.
|
|
213
|
+
STATUS_TEXTS: untyped
|
|
214
|
+
end
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Generated from lib/puppeteer/http_response.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
class Puppeteer::HTTPResponse
|
|
4
|
+
include Puppeteer::IfPresent
|
|
5
|
+
|
|
6
|
+
class Redirected < Puppeteer::Error
|
|
7
|
+
def initialize: () -> untyped
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
# defines methods used only in NetworkManager
|
|
11
|
+
class InternalAccessor
|
|
12
|
+
def initialize: (untyped response) -> untyped
|
|
13
|
+
|
|
14
|
+
def body_loaded_promise: () -> untyped
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
class RemoteAddress
|
|
18
|
+
def initialize: (ip: untyped, port: untyped) -> untyped
|
|
19
|
+
|
|
20
|
+
attr_reader ip: untyped
|
|
21
|
+
|
|
22
|
+
attr_reader port: untyped
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# @param client [Puppeteer::CDPSession]
|
|
26
|
+
# @param request [Puppeteer::HTTPRequest]
|
|
27
|
+
# @param response_payload [Hash]
|
|
28
|
+
# @param extra_info [Hash|nil]
|
|
29
|
+
def initialize: (untyped client, untyped request, untyped response_payload, untyped extra_info) -> untyped
|
|
30
|
+
|
|
31
|
+
attr_reader internal: untyped
|
|
32
|
+
|
|
33
|
+
attr_reader remote_address: untyped
|
|
34
|
+
|
|
35
|
+
attr_reader url: untyped
|
|
36
|
+
|
|
37
|
+
attr_reader status: untyped
|
|
38
|
+
|
|
39
|
+
attr_reader status_text: untyped
|
|
40
|
+
|
|
41
|
+
attr_reader headers: untyped
|
|
42
|
+
|
|
43
|
+
attr_reader security_details: untyped
|
|
44
|
+
|
|
45
|
+
attr_reader request: untyped
|
|
46
|
+
|
|
47
|
+
attr_reader timing: untyped
|
|
48
|
+
|
|
49
|
+
def inspect: () -> untyped
|
|
50
|
+
|
|
51
|
+
private def parse_status_text_from_extra_info: (untyped extra_info) -> untyped
|
|
52
|
+
|
|
53
|
+
# @return [Boolean]
|
|
54
|
+
def ok?: () -> untyped
|
|
55
|
+
|
|
56
|
+
# @rbs return: String -- Response body as binary string
|
|
57
|
+
def buffer: () -> String
|
|
58
|
+
|
|
59
|
+
# @param text [String]
|
|
60
|
+
# @rbs return: String -- Response body as text
|
|
61
|
+
def text: () -> String
|
|
62
|
+
|
|
63
|
+
# @param json [Hash]
|
|
64
|
+
# @rbs return: Hash[untyped, untyped] -- Parsed JSON
|
|
65
|
+
def json: () -> Hash[untyped, untyped]
|
|
66
|
+
|
|
67
|
+
# @rbs return: bool -- Whether response was served from cache
|
|
68
|
+
def from_cache?: () -> bool
|
|
69
|
+
|
|
70
|
+
# @rbs return: bool -- Whether response was served from service worker
|
|
71
|
+
def from_service_worker?: () -> bool
|
|
72
|
+
|
|
73
|
+
# @rbs return: Puppeteer::Frame -- Frame associated with the request
|
|
74
|
+
def frame: () -> Puppeteer::Frame
|
|
75
|
+
|
|
76
|
+
class SecurityDetails
|
|
77
|
+
def initialize: (untyped security_payload) -> untyped
|
|
78
|
+
|
|
79
|
+
attr_reader subject_name: untyped
|
|
80
|
+
|
|
81
|
+
attr_reader issuer: untyped
|
|
82
|
+
|
|
83
|
+
attr_reader valid_from: untyped
|
|
84
|
+
|
|
85
|
+
attr_reader valid_to: untyped
|
|
86
|
+
|
|
87
|
+
attr_reader protocol: untyped
|
|
88
|
+
end
|
|
89
|
+
end
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Generated from lib/puppeteer/js_handle.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
class Puppeteer::JSHandle
|
|
4
|
+
include Puppeteer::IfPresent
|
|
5
|
+
|
|
6
|
+
# @param context [Puppeteer::ExecutionContext]
|
|
7
|
+
# @param remote_object [Puppeteer::RemoteObject]
|
|
8
|
+
def self.create: (context: untyped, remote_object: untyped) -> untyped
|
|
9
|
+
|
|
10
|
+
# @param context [Puppeteer::ExecutionContext]
|
|
11
|
+
# @param client [Puppeteer::CDPSession]
|
|
12
|
+
# @param remote_object [Puppeteer::RemoteObject]
|
|
13
|
+
def initialize: (context: untyped, client: untyped, remote_object: untyped) -> untyped
|
|
14
|
+
|
|
15
|
+
attr_reader context: untyped
|
|
16
|
+
|
|
17
|
+
attr_reader remote_object: untyped
|
|
18
|
+
|
|
19
|
+
def inspect: () -> untyped
|
|
20
|
+
|
|
21
|
+
# @return [Puppeteer::ExecutionContext]
|
|
22
|
+
def execution_context: () -> untyped
|
|
23
|
+
|
|
24
|
+
# @param page_function [String]
|
|
25
|
+
# @return [Object]
|
|
26
|
+
def evaluate: (untyped page_function, *untyped args) -> untyped
|
|
27
|
+
|
|
28
|
+
# @param page_function [String]
|
|
29
|
+
# @param args {Array<*>}
|
|
30
|
+
# @return [Puppeteer::JSHandle]
|
|
31
|
+
def evaluate_handle: (untyped page_function, *untyped args) -> untyped
|
|
32
|
+
|
|
33
|
+
# getProperty(propertyName) in JavaScript
|
|
34
|
+
# @param name [String]
|
|
35
|
+
# @return [Puppeteer::JSHandle]
|
|
36
|
+
def property: (untyped name) -> untyped
|
|
37
|
+
|
|
38
|
+
# @param name [String]
|
|
39
|
+
# @return [Puppeteer::JSHandle]
|
|
40
|
+
def []: (untyped name) -> untyped
|
|
41
|
+
|
|
42
|
+
# getProperties in JavaScript.
|
|
43
|
+
# @return [Hash<String, JSHandle>]
|
|
44
|
+
def properties: () -> untyped
|
|
45
|
+
|
|
46
|
+
def json_value: () -> untyped
|
|
47
|
+
|
|
48
|
+
def as_element: () -> untyped
|
|
49
|
+
|
|
50
|
+
def dispose: () -> untyped
|
|
51
|
+
|
|
52
|
+
def disposed?: () -> untyped
|
|
53
|
+
|
|
54
|
+
# @rbs return: void
|
|
55
|
+
def dispose_symbol: () -> void
|
|
56
|
+
|
|
57
|
+
# @rbs return: self
|
|
58
|
+
def move: () -> self
|
|
59
|
+
|
|
60
|
+
def to_s: () -> untyped
|
|
61
|
+
|
|
62
|
+
# @rbs return: String
|
|
63
|
+
private def stringify_remote_value: () -> String
|
|
64
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Generated from lib/puppeteer/keyboard.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
class Puppeteer::Keyboard
|
|
4
|
+
# @rbs client: Puppeteer::CDPSession -- CDP session
|
|
5
|
+
# @rbs return: void -- No return value
|
|
6
|
+
def initialize: (Puppeteer::CDPSession client) -> void
|
|
7
|
+
|
|
8
|
+
attr_reader modifiers: untyped
|
|
9
|
+
|
|
10
|
+
# @rbs key: String -- Key name
|
|
11
|
+
# @rbs text: String? -- Text to input
|
|
12
|
+
# @rbs commands: Array[String]? -- Editing commands
|
|
13
|
+
# @rbs return: void -- No return value
|
|
14
|
+
def down: (String key, ?text: String?, ?commands: Array[String]?) -> void
|
|
15
|
+
|
|
16
|
+
private def modifier_bit: (untyped key) -> untyped
|
|
17
|
+
|
|
18
|
+
private def key_description_for_string: (untyped key_string) -> untyped
|
|
19
|
+
|
|
20
|
+
# @rbs key: String -- Key name
|
|
21
|
+
# @rbs return: void -- No return value
|
|
22
|
+
def up: (String key) -> void
|
|
23
|
+
|
|
24
|
+
# @rbs char: String -- Character to insert
|
|
25
|
+
# @rbs return: void -- No return value
|
|
26
|
+
def send_character: (String char) -> void
|
|
27
|
+
|
|
28
|
+
# @rbs text: String -- Text to type
|
|
29
|
+
# @rbs delay: Numeric? -- Delay between key presses (ms)
|
|
30
|
+
# @rbs return: void -- No return value
|
|
31
|
+
def type_text: (String text, ?delay: Numeric?) -> void
|
|
32
|
+
|
|
33
|
+
# @rbs key: String -- Key name
|
|
34
|
+
# @rbs delay: Numeric? -- Delay between key events (ms)
|
|
35
|
+
# @rbs text: String? -- Text to input
|
|
36
|
+
# @rbs commands: Array[String]? -- Editing commands
|
|
37
|
+
# @rbs block: Proc? -- Optional block for key combo usage
|
|
38
|
+
# @rbs return: void -- No return value
|
|
39
|
+
def press: (String key, ?delay: Numeric?, ?text: String?, ?commands: Array[String]?) ?{ (?) -> untyped } -> void
|
|
40
|
+
end
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
# Generated from lib/puppeteer/locators.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Puppeteer
|
|
4
|
+
module LocatorEvent
|
|
5
|
+
Action: ::String
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
class Puppeteer::Locator
|
|
10
|
+
include Puppeteer::EventCallbackable
|
|
11
|
+
|
|
12
|
+
RETRY_DELAY_SECONDS: ::Float
|
|
13
|
+
|
|
14
|
+
class TimeoutController
|
|
15
|
+
def initialize: (untyped timeout) -> untyped
|
|
16
|
+
|
|
17
|
+
attr_reader timeout: untyped
|
|
18
|
+
|
|
19
|
+
def remaining_timeout: () -> untyped
|
|
20
|
+
|
|
21
|
+
def exceeded?: () -> untyped
|
|
22
|
+
|
|
23
|
+
def check!: (?untyped cause) -> untyped
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def initialize: () -> untyped
|
|
27
|
+
|
|
28
|
+
# @rbs locators: Array[Puppeteer::Locator] -- Locator candidates
|
|
29
|
+
# @rbs return: Puppeteer::Locator -- Locator that races candidates
|
|
30
|
+
def self.race: (Array[Puppeteer::Locator] locators) -> Puppeteer::Locator
|
|
31
|
+
|
|
32
|
+
# @rbs input: String -- Input string to check
|
|
33
|
+
# @rbs return: bool -- Whether string looks like a JS function
|
|
34
|
+
def self.function_string?: (String input) -> bool
|
|
35
|
+
|
|
36
|
+
# @rbs return: Numeric -- Timeout in milliseconds
|
|
37
|
+
def timeout: () -> Numeric
|
|
38
|
+
|
|
39
|
+
# @rbs timeout: Numeric -- Timeout in milliseconds
|
|
40
|
+
# @rbs return: Puppeteer::Locator -- Updated locator
|
|
41
|
+
def set_timeout: (Numeric timeout) -> Puppeteer::Locator
|
|
42
|
+
|
|
43
|
+
# @rbs visibility: String? -- 'visible', 'hidden', or nil
|
|
44
|
+
# @rbs return: Puppeteer::Locator -- Updated locator
|
|
45
|
+
def set_visibility: (String? visibility) -> Puppeteer::Locator
|
|
46
|
+
|
|
47
|
+
# @rbs value: bool -- Whether to wait for enabled state
|
|
48
|
+
# @rbs return: Puppeteer::Locator -- Updated locator
|
|
49
|
+
def set_wait_for_enabled: (bool value) -> Puppeteer::Locator
|
|
50
|
+
|
|
51
|
+
# @rbs value: bool -- Whether to ensure element is in viewport
|
|
52
|
+
# @rbs return: Puppeteer::Locator -- Updated locator
|
|
53
|
+
def set_ensure_element_is_in_the_viewport: (bool value) -> Puppeteer::Locator
|
|
54
|
+
|
|
55
|
+
# @rbs value: bool -- Whether to wait for stable bounding box
|
|
56
|
+
# @rbs return: Puppeteer::Locator -- Updated locator
|
|
57
|
+
def set_wait_for_stable_bounding_box: (bool value) -> Puppeteer::Locator
|
|
58
|
+
|
|
59
|
+
# @rbs locator: Puppeteer::Locator -- Locator to copy options from
|
|
60
|
+
# @rbs return: self -- Locator with copied options
|
|
61
|
+
def copy_options: (Puppeteer::Locator locator) -> self
|
|
62
|
+
|
|
63
|
+
# @rbs return: Puppeteer::Locator -- Cloned locator
|
|
64
|
+
def clone: (?freeze: untyped) -> Puppeteer::Locator
|
|
65
|
+
|
|
66
|
+
# @rbs return: Puppeteer::JSHandle -- Handle for located value
|
|
67
|
+
def wait_handle: () -> Puppeteer::JSHandle
|
|
68
|
+
|
|
69
|
+
# @rbs return: untyped -- JSON-serializable value
|
|
70
|
+
def wait: () -> untyped
|
|
71
|
+
|
|
72
|
+
# @rbs mapper: String -- JS mapper function
|
|
73
|
+
# @rbs return: Puppeteer::Locator -- Mapped locator
|
|
74
|
+
def map: (String mapper) -> Puppeteer::Locator
|
|
75
|
+
|
|
76
|
+
# @rbs predicate: String -- JS predicate function
|
|
77
|
+
# @rbs return: Puppeteer::Locator -- Filtered locator
|
|
78
|
+
def filter: (String predicate) -> Puppeteer::Locator
|
|
79
|
+
|
|
80
|
+
# @rbs predicate: Proc -- Handle predicate
|
|
81
|
+
# @rbs return: Puppeteer::Locator -- Filtered locator
|
|
82
|
+
def filter_handle: (Proc predicate) -> Puppeteer::Locator
|
|
83
|
+
|
|
84
|
+
# @rbs mapper: Proc -- Handle mapper
|
|
85
|
+
# @rbs return: Puppeteer::Locator -- Mapped locator
|
|
86
|
+
def map_handle: (Proc mapper) -> Puppeteer::Locator
|
|
87
|
+
|
|
88
|
+
# @rbs delay: Numeric? -- Delay between down and up (ms)
|
|
89
|
+
# @rbs button: String? -- Mouse button
|
|
90
|
+
# @rbs click_count: Integer? -- Deprecated click count
|
|
91
|
+
# @rbs count: Integer? -- Number of clicks
|
|
92
|
+
# @rbs offset: Hash[Symbol, Numeric]? -- Click offset
|
|
93
|
+
# @rbs return: void -- No return value
|
|
94
|
+
def click: (?delay: Numeric?, ?button: String?, ?click_count: Integer?, ?count: Integer?, ?offset: Hash[Symbol, Numeric]?) -> void
|
|
95
|
+
|
|
96
|
+
# @rbs value: String -- Value to fill
|
|
97
|
+
# @rbs return: void -- No return value
|
|
98
|
+
def fill: (String value) -> void
|
|
99
|
+
|
|
100
|
+
# @rbs return: void -- No return value
|
|
101
|
+
def hover: () -> void
|
|
102
|
+
|
|
103
|
+
# @rbs scroll_top: Numeric? -- Scroll top position
|
|
104
|
+
# @rbs scroll_left: Numeric? -- Scroll left position
|
|
105
|
+
# @rbs return: void -- No return value
|
|
106
|
+
def scroll: (?scroll_top: Numeric?, ?scroll_left: Numeric?) -> void
|
|
107
|
+
|
|
108
|
+
# @rbs event_name: String -- Event name
|
|
109
|
+
# @rbs block: Proc -- Event handler
|
|
110
|
+
# @rbs return: Puppeteer::Locator -- Locator for chaining
|
|
111
|
+
def on: (String event_name) ?{ (?) -> untyped } -> Puppeteer::Locator
|
|
112
|
+
|
|
113
|
+
# @rbs event_name: String -- Event name
|
|
114
|
+
# @rbs block: Proc -- Event handler
|
|
115
|
+
# @rbs return: Puppeteer::Locator -- Locator for chaining
|
|
116
|
+
def once: (String event_name) ?{ (?) -> untyped } -> Puppeteer::Locator
|
|
117
|
+
|
|
118
|
+
def _clone: () -> untyped
|
|
119
|
+
|
|
120
|
+
def _wait: (untyped _options) -> untyped
|
|
121
|
+
|
|
122
|
+
private def perform_action: (untyped name, conditions: untyped) ?{ (?) -> untyped } -> untyped
|
|
123
|
+
|
|
124
|
+
private def with_retry: (untyped _name) ?{ (?) -> untyped } -> untyped
|
|
125
|
+
|
|
126
|
+
private def build_action_options: (untyped timeout_controller) -> untyped
|
|
127
|
+
|
|
128
|
+
private def run_conditions: (untyped handle, untyped options, untyped conditions) -> untyped
|
|
129
|
+
|
|
130
|
+
private def wait_for_enabled_if_needed: (untyped handle, untyped options) -> untyped
|
|
131
|
+
|
|
132
|
+
private def wait_for_stable_bounding_box_if_needed: (untyped handle, untyped options) -> untyped
|
|
133
|
+
|
|
134
|
+
private def ensure_element_is_in_viewport_if_needed: (untyped handle, untyped options) -> untyped
|
|
135
|
+
|
|
136
|
+
private def fill_element: (untyped handle, untyped value) -> untyped
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
class Puppeteer::FunctionLocator < Puppeteer::Locator
|
|
140
|
+
# @rbs page_or_frame: Puppeteer::Page | Puppeteer::Frame -- Page or frame
|
|
141
|
+
# @rbs func: String -- JS function to evaluate
|
|
142
|
+
# @rbs return: Puppeteer::Locator -- Function locator
|
|
143
|
+
def self.create: (Puppeteer::Page | Puppeteer::Frame page_or_frame, String func) -> Puppeteer::Locator
|
|
144
|
+
|
|
145
|
+
def initialize: (untyped page_or_frame, untyped func) -> untyped
|
|
146
|
+
|
|
147
|
+
def _clone: () -> untyped
|
|
148
|
+
|
|
149
|
+
def _wait: (untyped options) -> untyped
|
|
150
|
+
|
|
151
|
+
def self.default_timeout_for: (untyped page_or_frame) -> untyped
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
class Puppeteer::DelegatedLocator < Puppeteer::Locator
|
|
155
|
+
def initialize: (untyped delegate) -> untyped
|
|
156
|
+
|
|
157
|
+
def delegate: () -> untyped
|
|
158
|
+
|
|
159
|
+
def set_timeout: (untyped timeout) -> untyped
|
|
160
|
+
|
|
161
|
+
def set_visibility: (untyped visibility) -> untyped
|
|
162
|
+
|
|
163
|
+
def set_wait_for_enabled: (untyped value) -> untyped
|
|
164
|
+
|
|
165
|
+
def set_ensure_element_is_in_the_viewport: (untyped value) -> untyped
|
|
166
|
+
|
|
167
|
+
def set_wait_for_stable_bounding_box: (untyped value) -> untyped
|
|
168
|
+
|
|
169
|
+
def _clone: () -> untyped
|
|
170
|
+
|
|
171
|
+
def _wait: (untyped _options) -> untyped
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
class Puppeteer::FilteredLocator < Puppeteer::DelegatedLocator
|
|
175
|
+
def initialize: (untyped base, untyped predicate) -> untyped
|
|
176
|
+
|
|
177
|
+
def _clone: () -> untyped
|
|
178
|
+
|
|
179
|
+
def _wait: (untyped options) -> untyped
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
class Puppeteer::MappedLocator < Puppeteer::DelegatedLocator
|
|
183
|
+
def initialize: (untyped base, untyped mapper) -> untyped
|
|
184
|
+
|
|
185
|
+
def _clone: () -> untyped
|
|
186
|
+
|
|
187
|
+
def _wait: (untyped options) -> untyped
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
class Puppeteer::NodeLocator < Puppeteer::Locator
|
|
191
|
+
# @rbs page_or_frame: Puppeteer::Page | Puppeteer::Frame -- Page or frame
|
|
192
|
+
# @rbs selector: String -- Selector
|
|
193
|
+
# @rbs return: Puppeteer::Locator -- Node locator
|
|
194
|
+
def self.create: (Puppeteer::Page | Puppeteer::Frame page_or_frame, String selector) -> Puppeteer::Locator
|
|
195
|
+
|
|
196
|
+
# @rbs page_or_frame: Puppeteer::Page | Puppeteer::Frame -- Page or frame
|
|
197
|
+
# @rbs handle: Puppeteer::ElementHandle -- Element handle
|
|
198
|
+
# @rbs return: Puppeteer::Locator -- Node locator
|
|
199
|
+
def self.create_from_handle: (Puppeteer::Page | Puppeteer::Frame page_or_frame, Puppeteer::ElementHandle handle) -> Puppeteer::Locator
|
|
200
|
+
|
|
201
|
+
def initialize: (untyped page_or_frame, untyped selector_or_handle) -> untyped
|
|
202
|
+
|
|
203
|
+
def _clone: () -> untyped
|
|
204
|
+
|
|
205
|
+
def _wait: (untyped options) -> untyped
|
|
206
|
+
|
|
207
|
+
private def wait_for_visibility_if_needed: (untyped handle, untyped options) -> untyped
|
|
208
|
+
|
|
209
|
+
def self.default_timeout_for: (untyped page_or_frame) -> untyped
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
class Puppeteer::RaceLocator < Puppeteer::Locator
|
|
213
|
+
def self.create: (untyped locators) -> untyped
|
|
214
|
+
|
|
215
|
+
def initialize: (untyped locators) -> untyped
|
|
216
|
+
|
|
217
|
+
def _clone: () -> untyped
|
|
218
|
+
|
|
219
|
+
def _wait: (untyped options) -> untyped
|
|
220
|
+
|
|
221
|
+
def self.check_locator_array: (untyped locators) -> untyped
|
|
222
|
+
end
|