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,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,113 @@
|
|
|
1
|
+
# Generated from lib/puppeteer/mouse.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
class Puppeteer::Mouse
|
|
4
|
+
module Button
|
|
5
|
+
NONE: ::String
|
|
6
|
+
|
|
7
|
+
LEFT: ::String
|
|
8
|
+
|
|
9
|
+
RIGHT: ::String
|
|
10
|
+
|
|
11
|
+
MIDDLE: ::String
|
|
12
|
+
|
|
13
|
+
BACK: ::String
|
|
14
|
+
|
|
15
|
+
FORWARD: ::String
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
module ButtonFlag
|
|
19
|
+
NONE: ::Integer
|
|
20
|
+
|
|
21
|
+
LEFT: ::Integer
|
|
22
|
+
|
|
23
|
+
RIGHT: untyped
|
|
24
|
+
|
|
25
|
+
MIDDLE: untyped
|
|
26
|
+
|
|
27
|
+
BACK: untyped
|
|
28
|
+
|
|
29
|
+
FORWARD: untyped
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# @rbs client: Puppeteer::CDPSession -- CDP session
|
|
33
|
+
# @rbs keyboard: Puppeteer::Keyboard -- Keyboard instance
|
|
34
|
+
# @rbs return: void -- No return value
|
|
35
|
+
def initialize: (Puppeteer::CDPSession client, Puppeteer::Keyboard keyboard) -> void
|
|
36
|
+
|
|
37
|
+
# @rbs return: void -- No return value
|
|
38
|
+
def reset: () -> void
|
|
39
|
+
|
|
40
|
+
# @rbs x: Numeric -- X coordinate
|
|
41
|
+
# @rbs y: Numeric -- Y coordinate
|
|
42
|
+
# @rbs steps: Integer? -- Number of intermediate steps
|
|
43
|
+
# @rbs return: void -- No return value
|
|
44
|
+
def move: (Numeric x, Numeric y, ?steps: Integer?) -> void
|
|
45
|
+
|
|
46
|
+
# @rbs x: Numeric -- X coordinate
|
|
47
|
+
# @rbs y: Numeric -- Y coordinate
|
|
48
|
+
# @rbs delay: Numeric? -- Delay between down and up (ms)
|
|
49
|
+
# @rbs button: String? -- Mouse button
|
|
50
|
+
# @rbs click_count: Integer? -- Deprecated: use count (click_count only sets clickCount)
|
|
51
|
+
# @rbs count: Integer? -- Number of click repetitions
|
|
52
|
+
# @rbs return: void -- No return value
|
|
53
|
+
def click: (Numeric x, Numeric y, ?delay: Numeric?, ?button: String?, ?click_count: Integer?, ?count: Integer?) -> void
|
|
54
|
+
|
|
55
|
+
private def warn_deprecated_click_count: () -> untyped
|
|
56
|
+
|
|
57
|
+
attr_accessor deprecated_click_count_warned: untyped
|
|
58
|
+
|
|
59
|
+
# @rbs button: String? -- Mouse button
|
|
60
|
+
# @rbs click_count: Integer? -- Click count to report
|
|
61
|
+
# @rbs return: void -- No return value
|
|
62
|
+
def down: (?button: String?, ?click_count: Integer?) -> void
|
|
63
|
+
|
|
64
|
+
# @rbs button: String? -- Mouse button
|
|
65
|
+
# @rbs click_count: Integer? -- Click count to report
|
|
66
|
+
# @rbs return: void -- No return value
|
|
67
|
+
def up: (?button: String?, ?click_count: Integer?) -> void
|
|
68
|
+
|
|
69
|
+
# Dispatches a `mousewheel` event.
|
|
70
|
+
#
|
|
71
|
+
# @rbs delta_x: Numeric -- Scroll delta X
|
|
72
|
+
# @rbs delta_y: Numeric -- Scroll delta Y
|
|
73
|
+
# @rbs return: void -- No return value
|
|
74
|
+
def wheel: (?delta_x: Numeric, ?delta_y: Numeric) -> void
|
|
75
|
+
|
|
76
|
+
# @rbs start: Puppeteer::ElementHandle::Point -- Drag start point
|
|
77
|
+
# @rbs target: Puppeteer::ElementHandle::Point -- Drag end point
|
|
78
|
+
# @rbs return: Hash[String, untyped] -- Drag data payload
|
|
79
|
+
def drag: (Puppeteer::ElementHandle::Point start, Puppeteer::ElementHandle::Point target) -> Hash[String, untyped]
|
|
80
|
+
|
|
81
|
+
# @rbs target: Puppeteer::ElementHandle::Point -- Drag target point
|
|
82
|
+
# @rbs data: Hash[String, untyped] -- Drag data payload
|
|
83
|
+
# @rbs return: void -- No return value
|
|
84
|
+
def drag_enter: (Puppeteer::ElementHandle::Point target, Hash[String, untyped] data) -> void
|
|
85
|
+
|
|
86
|
+
# @rbs target: Puppeteer::ElementHandle::Point -- Drag target point
|
|
87
|
+
# @rbs data: Hash[String, untyped] -- Drag data payload
|
|
88
|
+
# @rbs return: void -- No return value
|
|
89
|
+
def drag_over: (Puppeteer::ElementHandle::Point target, Hash[String, untyped] data) -> void
|
|
90
|
+
|
|
91
|
+
# @rbs target: Puppeteer::ElementHandle::Point -- Drag target point
|
|
92
|
+
# @rbs data: Hash[String, untyped] -- Drag data payload
|
|
93
|
+
# @rbs return: void -- No return value
|
|
94
|
+
def drop: (Puppeteer::ElementHandle::Point target, Hash[String, untyped] data) -> void
|
|
95
|
+
|
|
96
|
+
# @rbs start: Puppeteer::ElementHandle::Point -- Drag start point
|
|
97
|
+
# @rbs target: Puppeteer::ElementHandle::Point -- Drag end point
|
|
98
|
+
# @rbs delay: Numeric? -- Delay before drop (ms)
|
|
99
|
+
# @rbs return: void -- No return value
|
|
100
|
+
def drag_and_drop: (Puppeteer::ElementHandle::Point start, Puppeteer::ElementHandle::Point target, ?delay: Numeric?) -> void
|
|
101
|
+
|
|
102
|
+
private def state: () -> untyped
|
|
103
|
+
|
|
104
|
+
# @rbs block: Proc -- Block receiving state update callback
|
|
105
|
+
# @rbs return: untyped -- Block result
|
|
106
|
+
private def with_transaction: () ?{ (?) -> untyped } -> untyped
|
|
107
|
+
|
|
108
|
+
private def merge_state: (untyped base_state, untyped transaction) -> untyped
|
|
109
|
+
|
|
110
|
+
private def button_flag: (untyped button) -> untyped
|
|
111
|
+
|
|
112
|
+
private def button_from_pressed_buttons: (untyped buttons) -> untyped
|
|
113
|
+
end
|