puppeteer-bidi 0.0.1.beta1 → 0.0.1.beta3
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/CLAUDE.md +50 -4
- data/README.md +8 -1
- data/Steepfile +36 -0
- data/lib/puppeteer/bidi/async_utils.rb +1 -0
- data/lib/puppeteer/bidi/browser.rb +38 -24
- data/lib/puppeteer/bidi/browser_context.rb +13 -4
- data/lib/puppeteer/bidi/browser_launcher.rb +1 -0
- data/lib/puppeteer/bidi/connection.rb +26 -9
- data/lib/puppeteer/bidi/core/browser.rb +15 -14
- data/lib/puppeteer/bidi/core/browsing_context.rb +64 -46
- data/lib/puppeteer/bidi/core/disposable.rb +10 -3
- data/lib/puppeteer/bidi/core/errors.rb +18 -1
- data/lib/puppeteer/bidi/core/event_emitter.rb +18 -9
- data/lib/puppeteer/bidi/core/navigation.rb +4 -3
- data/lib/puppeteer/bidi/core/realm.rb +29 -26
- data/lib/puppeteer/bidi/core/request.rb +33 -29
- data/lib/puppeteer/bidi/core/session.rb +14 -11
- data/lib/puppeteer/bidi/core/user_context.rb +17 -16
- data/lib/puppeteer/bidi/core/user_prompt.rb +8 -7
- data/lib/puppeteer/bidi/core.rb +1 -0
- data/lib/puppeteer/bidi/deserializer.rb +1 -0
- data/lib/puppeteer/bidi/element_handle.rb +52 -52
- data/lib/puppeteer/bidi/errors.rb +1 -0
- data/lib/puppeteer/bidi/file_chooser.rb +1 -0
- data/lib/puppeteer/bidi/frame.rb +70 -70
- data/lib/puppeteer/bidi/http_response.rb +1 -0
- data/lib/puppeteer/bidi/injected_source.rb +1 -0
- data/lib/puppeteer/bidi/js_handle.rb +23 -23
- data/lib/puppeteer/bidi/keyboard.rb +24 -13
- data/lib/puppeteer/bidi/lazy_arg.rb +1 -0
- data/lib/puppeteer/bidi/mouse.rb +31 -18
- data/lib/puppeteer/bidi/page.rb +87 -87
- data/lib/puppeteer/bidi/query_handler.rb +3 -0
- data/lib/puppeteer/bidi/realm.rb +70 -6
- data/lib/puppeteer/bidi/serializer.rb +1 -0
- data/lib/puppeteer/bidi/target.rb +24 -0
- data/lib/puppeteer/bidi/task_manager.rb +9 -3
- data/lib/puppeteer/bidi/timeout_settings.rb +1 -0
- data/lib/puppeteer/bidi/transport.rb +1 -0
- data/lib/puppeteer/bidi/version.rb +1 -1
- data/lib/puppeteer/bidi/wait_task.rb +1 -0
- data/lib/puppeteer/bidi.rb +8 -4
- data/sig/_external.rbs +128 -0
- data/sig/_supplementary.rbs +20 -0
- data/sig/puppeteer/bidi/async_utils.rbs +68 -0
- data/sig/puppeteer/bidi/browser.rbs +35 -26
- data/sig/puppeteer/bidi/browser_context.rbs +39 -0
- data/sig/puppeteer/bidi/browser_launcher.rbs +45 -0
- data/sig/puppeteer/bidi/connection.rbs +67 -0
- data/sig/puppeteer/bidi/core/browser.rbs +79 -0
- data/sig/puppeteer/bidi/core/browsing_context.rbs +210 -0
- data/sig/puppeteer/bidi/core/disposable.rbs +42 -0
- data/sig/puppeteer/bidi/core/errors.rbs +65 -0
- data/sig/puppeteer/bidi/core/event_emitter.rbs +50 -0
- data/sig/puppeteer/bidi/core/navigation.rbs +37 -0
- data/sig/puppeteer/bidi/core/realm.rbs +132 -0
- data/sig/puppeteer/bidi/core/request.rbs +120 -0
- data/sig/puppeteer/bidi/core/session.rbs +65 -0
- data/sig/puppeteer/bidi/core/user_context.rbs +72 -0
- data/sig/puppeteer/bidi/core/user_prompt.rbs +52 -0
- data/sig/puppeteer/bidi/core.rbs +9 -0
- data/sig/puppeteer/bidi/deserializer.rbs +28 -0
- data/sig/puppeteer/bidi/element_handle.rbs +52 -52
- data/sig/puppeteer/bidi/errors.rbs +34 -0
- data/sig/puppeteer/bidi/file_chooser.rbs +27 -0
- data/sig/puppeteer/bidi/frame.rbs +70 -70
- data/sig/puppeteer/bidi/http_response.rbs +18 -0
- data/sig/puppeteer/bidi/injected_source.rbs +21 -0
- data/sig/puppeteer/bidi/js_handle.rbs +23 -23
- data/sig/puppeteer/bidi/keyboard.rbs +57 -0
- data/sig/puppeteer/bidi/lazy_arg.rbs +15 -0
- data/sig/puppeteer/bidi/mouse.rbs +73 -0
- data/sig/puppeteer/bidi/page.rbs +87 -87
- data/sig/puppeteer/bidi/query_handler.rbs +113 -0
- data/sig/puppeteer/bidi/realm.rbs +141 -0
- data/sig/puppeteer/bidi/serializer.rbs +31 -0
- data/sig/puppeteer/bidi/target.rbs +68 -0
- data/sig/puppeteer/bidi/task_manager.rbs +36 -0
- data/sig/puppeteer/bidi/timeout_settings.rbs +14 -0
- data/sig/puppeteer/bidi/transport.rbs +43 -0
- data/sig/puppeteer/bidi/wait_task.rbs +62 -0
- data/sig/puppeteer/bidi.rbs +8 -4
- metadata +36 -1
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# Generated from lib/puppeteer/bidi/core/request.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Puppeteer
|
|
4
|
+
module Bidi
|
|
5
|
+
module Core
|
|
6
|
+
# Request represents a network request
|
|
7
|
+
class Request < EventEmitter
|
|
8
|
+
include Disposable::DisposableMixin
|
|
9
|
+
|
|
10
|
+
# Create a request instance from a beforeRequestSent event
|
|
11
|
+
# @rbs browsing_context: BrowsingContext -- The browsing context
|
|
12
|
+
# @rbs event: Hash[String, untyped] -- The beforeRequestSent event data
|
|
13
|
+
# @rbs return: Request -- New request instance
|
|
14
|
+
def self.from: (BrowsingContext browsing_context, Hash[String, untyped] event) -> Request
|
|
15
|
+
|
|
16
|
+
attr_reader browsing_context: untyped
|
|
17
|
+
|
|
18
|
+
attr_reader error: untyped
|
|
19
|
+
|
|
20
|
+
attr_reader response: untyped
|
|
21
|
+
|
|
22
|
+
def initialize: (untyped browsing_context, untyped event) -> untyped
|
|
23
|
+
|
|
24
|
+
# Get request ID
|
|
25
|
+
# @rbs return: String -- Request ID
|
|
26
|
+
def id: () -> String
|
|
27
|
+
|
|
28
|
+
# Get request URL
|
|
29
|
+
# @rbs return: String -- Request URL
|
|
30
|
+
def url: () -> String
|
|
31
|
+
|
|
32
|
+
# Get request method
|
|
33
|
+
# @rbs return: String -- Request method (GET, POST, etc.)
|
|
34
|
+
def method: () -> String
|
|
35
|
+
|
|
36
|
+
# Get request headers
|
|
37
|
+
# @rbs return: Array[Hash[String, untyped]] -- Request headers
|
|
38
|
+
def headers: () -> Array[Hash[String, untyped]]
|
|
39
|
+
|
|
40
|
+
# Get navigation ID if this is a navigation request
|
|
41
|
+
# @rbs return: String? -- Navigation ID
|
|
42
|
+
def navigation: () -> String?
|
|
43
|
+
|
|
44
|
+
# Get redirect request if this request was redirected
|
|
45
|
+
# @rbs return: Request? -- Redirect request
|
|
46
|
+
def redirect: () -> Request?
|
|
47
|
+
|
|
48
|
+
# Get the last redirect in the chain
|
|
49
|
+
# @rbs return: Request? -- Last redirect request
|
|
50
|
+
def last_redirect: () -> Request?
|
|
51
|
+
|
|
52
|
+
# Get request initiator information
|
|
53
|
+
# @rbs return: untyped -- Initiator info (mixed String/Symbol keys)
|
|
54
|
+
def initiator: () -> untyped
|
|
55
|
+
|
|
56
|
+
# Check if the request is blocked
|
|
57
|
+
# @rbs return: bool -- Whether the request is blocked
|
|
58
|
+
def blocked?: () -> bool
|
|
59
|
+
|
|
60
|
+
# Get resource type (non-standard)
|
|
61
|
+
# @rbs return: String? -- Resource type
|
|
62
|
+
def resource_type: () -> String?
|
|
63
|
+
|
|
64
|
+
# Get POST data (non-standard)
|
|
65
|
+
# @rbs return: String? -- POST data
|
|
66
|
+
def post_data: () -> String?
|
|
67
|
+
|
|
68
|
+
# Check if request has POST data
|
|
69
|
+
# @rbs return: bool -- Whether request has POST data
|
|
70
|
+
def has_post_data?: () -> bool
|
|
71
|
+
|
|
72
|
+
# Get timing information
|
|
73
|
+
# @rbs return: Hash[String, untyped] -- Timing info
|
|
74
|
+
def timing: () -> Hash[String, untyped]
|
|
75
|
+
|
|
76
|
+
# Continue the request with optional modifications
|
|
77
|
+
# @rbs url: String? -- Modified URL
|
|
78
|
+
# @rbs method: String? -- Modified method
|
|
79
|
+
# @rbs headers: Array[Hash[String, untyped]]? -- Modified headers
|
|
80
|
+
# @rbs cookies: Array[Hash[String, untyped]]? -- Modified cookies
|
|
81
|
+
# @rbs body: Hash[String, untyped]? -- Modified body
|
|
82
|
+
# @rbs return: untyped
|
|
83
|
+
def continue_request: (?url: String?, ?method: String?, ?headers: Array[Hash[String, untyped]]?, ?cookies: Array[Hash[String, untyped]]?, ?body: Hash[String, untyped]?) -> untyped
|
|
84
|
+
|
|
85
|
+
# Fail the request
|
|
86
|
+
def fail_request: () -> untyped
|
|
87
|
+
|
|
88
|
+
# Provide a response for the request
|
|
89
|
+
# @rbs status_code: Integer? -- Response status code
|
|
90
|
+
# @rbs reason_phrase: String? -- Response reason phrase
|
|
91
|
+
# @rbs headers: Array[Hash[String, untyped]]? -- Response headers
|
|
92
|
+
# @rbs body: Hash[String, untyped]? -- Response body
|
|
93
|
+
# @rbs return: untyped
|
|
94
|
+
def provide_response: (?status_code: Integer?, ?reason_phrase: String?, ?headers: Array[Hash[String, untyped]]?, ?body: Hash[String, untyped]?) -> untyped
|
|
95
|
+
|
|
96
|
+
# Fetch POST data for the request
|
|
97
|
+
# @rbs return: String? -- POST data
|
|
98
|
+
def fetch_post_data: () -> String?
|
|
99
|
+
|
|
100
|
+
# Get response content
|
|
101
|
+
# @rbs return: String -- Response content as binary string
|
|
102
|
+
def response_content: () -> String
|
|
103
|
+
|
|
104
|
+
# Continue with authentication
|
|
105
|
+
# @rbs action: String -- 'provideCredentials', 'default', or 'cancel'
|
|
106
|
+
# @rbs credentials: Hash[String, untyped]? -- Credentials hash with username and password
|
|
107
|
+
# @rbs return: untyped
|
|
108
|
+
def continue_with_auth: (action: String, ?credentials: Hash[String, untyped]?) -> untyped
|
|
109
|
+
|
|
110
|
+
def perform_dispose: () -> untyped
|
|
111
|
+
|
|
112
|
+
private
|
|
113
|
+
|
|
114
|
+
def session: () -> untyped
|
|
115
|
+
|
|
116
|
+
def initialize_request: () -> untyped
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
end
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Generated from lib/puppeteer/bidi/core/session.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Puppeteer
|
|
4
|
+
module Bidi
|
|
5
|
+
module Core
|
|
6
|
+
# Session represents a BiDi session with the browser
|
|
7
|
+
# It wraps a Connection and provides session-specific functionality
|
|
8
|
+
class Session < EventEmitter
|
|
9
|
+
include Disposable::DisposableMixin
|
|
10
|
+
|
|
11
|
+
# Create a new session from an existing connection
|
|
12
|
+
# @rbs connection: Puppeteer::Bidi::Connection -- The BiDi connection
|
|
13
|
+
# @rbs capabilities: Hash[String, untyped] -- Session capabilities
|
|
14
|
+
# @rbs return: Async::Task[Session]
|
|
15
|
+
def self.from: (connection: Puppeteer::Bidi::Connection, capabilities: Hash[String, untyped]) -> Async::Task[Session]
|
|
16
|
+
|
|
17
|
+
attr_reader connection: untyped
|
|
18
|
+
|
|
19
|
+
attr_reader id: untyped
|
|
20
|
+
|
|
21
|
+
attr_reader capabilities: untyped
|
|
22
|
+
|
|
23
|
+
attr_accessor browser: untyped
|
|
24
|
+
|
|
25
|
+
def initialize: (untyped connection, untyped info) -> untyped
|
|
26
|
+
|
|
27
|
+
# Check if the session has ended
|
|
28
|
+
def ended?: () -> untyped
|
|
29
|
+
|
|
30
|
+
alias disposed? ended?
|
|
31
|
+
|
|
32
|
+
# Send a BiDi command through this session
|
|
33
|
+
# @rbs method: String -- BiDi method name
|
|
34
|
+
# @rbs params: Hash[String | Symbol, untyped] -- Command parameters
|
|
35
|
+
# @rbs return: Async::Task[Hash[String, untyped]]
|
|
36
|
+
def async_send_command: (String method, ?Hash[String | Symbol, untyped] params) -> Async::Task[Hash[String, untyped]]
|
|
37
|
+
|
|
38
|
+
# Subscribe to BiDi events
|
|
39
|
+
# @rbs events: Array[String] -- Event names to subscribe to
|
|
40
|
+
# @rbs contexts: Array[String]? -- Context IDs (optional)
|
|
41
|
+
# @rbs return: Async::Task[untyped]
|
|
42
|
+
def subscribe: (Array[String] events, ?Array[String]? contexts) -> Async::Task[untyped]
|
|
43
|
+
|
|
44
|
+
# Add intercepts (same as subscribe but for interception events)
|
|
45
|
+
# @rbs events: Array[String] -- Event names to intercept
|
|
46
|
+
# @rbs contexts: Array[String]? -- Context IDs (optional)
|
|
47
|
+
# @rbs return: Async::Task[untyped]
|
|
48
|
+
def add_intercepts: (Array[String] events, ?Array[String]? contexts) -> Async::Task[untyped]
|
|
49
|
+
|
|
50
|
+
# End the session
|
|
51
|
+
def end_session: () -> untyped
|
|
52
|
+
|
|
53
|
+
def perform_dispose: () -> untyped
|
|
54
|
+
|
|
55
|
+
private
|
|
56
|
+
|
|
57
|
+
def initialize_session: () -> untyped
|
|
58
|
+
|
|
59
|
+
def dispose_session: (untyped reason) -> untyped
|
|
60
|
+
|
|
61
|
+
def setup_event_forwarding: () -> untyped
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Generated from lib/puppeteer/bidi/core/user_context.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Puppeteer
|
|
4
|
+
module Bidi
|
|
5
|
+
module Core
|
|
6
|
+
# UserContext represents an isolated browsing context (like an incognito session)
|
|
7
|
+
class UserContext < EventEmitter
|
|
8
|
+
include Disposable::DisposableMixin
|
|
9
|
+
|
|
10
|
+
DEFAULT: ::String
|
|
11
|
+
|
|
12
|
+
# Create a user context
|
|
13
|
+
# @rbs browser: Browser -- Parent browser
|
|
14
|
+
# @rbs id: String -- Context ID
|
|
15
|
+
# @rbs return: UserContext
|
|
16
|
+
def self.create: (Browser browser, String id) -> UserContext
|
|
17
|
+
|
|
18
|
+
attr_reader browser: untyped
|
|
19
|
+
|
|
20
|
+
attr_reader id: untyped
|
|
21
|
+
|
|
22
|
+
def initialize: (untyped browser, untyped id) -> untyped
|
|
23
|
+
|
|
24
|
+
# Check if the context is closed
|
|
25
|
+
def closed?: () -> untyped
|
|
26
|
+
|
|
27
|
+
alias disposed? closed?
|
|
28
|
+
|
|
29
|
+
# Get all browsing contexts in this user context
|
|
30
|
+
# @rbs return: Array[BrowsingContext] -- Top-level browsing contexts
|
|
31
|
+
def browsing_contexts: () -> Array[BrowsingContext]
|
|
32
|
+
|
|
33
|
+
# Create a new browsing context (tab or window)
|
|
34
|
+
# @rbs type: String -- 'tab' or 'window'
|
|
35
|
+
# @rbs reference_context: BrowsingContext? -- Reference context
|
|
36
|
+
# @rbs return: BrowsingContext -- New browsing context
|
|
37
|
+
def create_browsing_context: (String type, **untyped options) -> BrowsingContext
|
|
38
|
+
|
|
39
|
+
# Remove this user context
|
|
40
|
+
def remove: () -> untyped
|
|
41
|
+
|
|
42
|
+
# Get cookies for this user context
|
|
43
|
+
# @rbs source_origin: String? -- Source origin
|
|
44
|
+
# @rbs return: Array[Hash[String, untyped]] -- Cookies
|
|
45
|
+
def get_cookies: (**untyped options) -> Array[Hash[String, untyped]]
|
|
46
|
+
|
|
47
|
+
# Set a cookie in this user context
|
|
48
|
+
# @rbs cookie: Hash[String, untyped] -- Cookie data
|
|
49
|
+
# @rbs source_origin: String? -- Source origin
|
|
50
|
+
# @rbs return: void
|
|
51
|
+
def set_cookie: (Hash[String, untyped] cookie, **untyped options) -> void
|
|
52
|
+
|
|
53
|
+
# Set permissions for an origin
|
|
54
|
+
# @rbs origin: String -- Origin URL
|
|
55
|
+
# @rbs descriptor: Hash[String, untyped] -- Permission descriptor
|
|
56
|
+
# @rbs state: String -- Permission state
|
|
57
|
+
# @rbs return: void
|
|
58
|
+
def set_permissions: (String origin, Hash[String, untyped] descriptor, String state) -> void
|
|
59
|
+
|
|
60
|
+
def perform_dispose: () -> untyped
|
|
61
|
+
|
|
62
|
+
private
|
|
63
|
+
|
|
64
|
+
def session: () -> untyped
|
|
65
|
+
|
|
66
|
+
def initialize_context: () -> untyped
|
|
67
|
+
|
|
68
|
+
def dispose_context: (untyped reason) -> untyped
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Generated from lib/puppeteer/bidi/core/user_prompt.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Puppeteer
|
|
4
|
+
module Bidi
|
|
5
|
+
module Core
|
|
6
|
+
# UserPrompt represents a user prompt (alert, confirm, prompt)
|
|
7
|
+
class UserPrompt < EventEmitter
|
|
8
|
+
include Disposable::DisposableMixin
|
|
9
|
+
|
|
10
|
+
# Create a user prompt instance
|
|
11
|
+
# @rbs browsing_context: BrowsingContext -- The browsing context
|
|
12
|
+
# @rbs info: Hash[String, untyped] -- The userPromptOpened event data
|
|
13
|
+
# @rbs return: UserPrompt -- New user prompt instance
|
|
14
|
+
def self.from: (BrowsingContext browsing_context, Hash[String, untyped] info) -> UserPrompt
|
|
15
|
+
|
|
16
|
+
attr_reader browsing_context: untyped
|
|
17
|
+
|
|
18
|
+
attr_reader info: untyped
|
|
19
|
+
|
|
20
|
+
attr_reader result: untyped
|
|
21
|
+
|
|
22
|
+
def initialize: (untyped browsing_context, untyped info) -> untyped
|
|
23
|
+
|
|
24
|
+
# Check if the prompt is closed
|
|
25
|
+
def closed?: () -> untyped
|
|
26
|
+
|
|
27
|
+
alias disposed? closed?
|
|
28
|
+
|
|
29
|
+
# Check if the prompt has been handled
|
|
30
|
+
# Auto-handled prompts return true immediately
|
|
31
|
+
# @rbs return: bool -- Whether the prompt is handled
|
|
32
|
+
def handled?: () -> bool
|
|
33
|
+
|
|
34
|
+
# Handle the user prompt
|
|
35
|
+
# @rbs accept: bool? -- Whether to accept the prompt
|
|
36
|
+
# @rbs user_text: String? -- Text to enter (for prompt dialogs)
|
|
37
|
+
# @rbs return: Hash[String, untyped] -- Result of handling the prompt
|
|
38
|
+
def handle: (?accept: bool?, ?user_text: String?) -> Hash[String, untyped]
|
|
39
|
+
|
|
40
|
+
def perform_dispose: () -> untyped
|
|
41
|
+
|
|
42
|
+
private
|
|
43
|
+
|
|
44
|
+
def session: () -> untyped
|
|
45
|
+
|
|
46
|
+
def initialize_prompt: () -> untyped
|
|
47
|
+
|
|
48
|
+
def dispose_prompt: (untyped reason) -> untyped
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Generated from lib/puppeteer/bidi/deserializer.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Puppeteer
|
|
4
|
+
module Bidi
|
|
5
|
+
# Deserializer converts BiDi Script.RemoteValue to Ruby values
|
|
6
|
+
# Based on Puppeteer's Deserializer.ts
|
|
7
|
+
class Deserializer
|
|
8
|
+
# Deserialize a BiDi RemoteValue to Ruby value
|
|
9
|
+
# @param remote_value [Hash] BiDi RemoteValue
|
|
10
|
+
# @param realm [Core::Realm, nil] Realm for creating handles (optional)
|
|
11
|
+
# @return [Object] Ruby value or JSHandle/ElementHandle if realm provided
|
|
12
|
+
def self.deserialize: (untyped remote_value, ?untyped realm) -> untyped
|
|
13
|
+
|
|
14
|
+
# Deserialize a BiDi number value (handles special strings)
|
|
15
|
+
private def self.deserialize_number: (untyped value) -> untyped
|
|
16
|
+
|
|
17
|
+
# Deserialize BiDi object (array of [key, value] tuples) to Ruby Hash
|
|
18
|
+
private def self.deserialize_object: (untyped tuples, untyped realm) -> untyped
|
|
19
|
+
|
|
20
|
+
# Deserialize BiDi map (array of [key, value] tuples) to Ruby Hash
|
|
21
|
+
# Maps can have non-string keys, so we deserialize keys too
|
|
22
|
+
private def self.deserialize_map: (untyped tuples, untyped realm) -> untyped
|
|
23
|
+
|
|
24
|
+
# Deserialize BiDi regexp to Ruby Regexp
|
|
25
|
+
private def self.deserialize_regexp: (untyped value) -> untyped
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -63,75 +63,75 @@ module Puppeteer
|
|
|
63
63
|
end
|
|
64
64
|
|
|
65
65
|
# Factory method to create ElementHandle from remote value
|
|
66
|
-
# @rbs remote_value: Hash[String, untyped]
|
|
67
|
-
# @rbs realm: Core::Realm
|
|
68
|
-
# @rbs return: ElementHandle
|
|
66
|
+
# @rbs remote_value: Hash[String, untyped] -- BiDi RemoteValue
|
|
67
|
+
# @rbs realm: Core::Realm -- Associated realm
|
|
68
|
+
# @rbs return: ElementHandle -- ElementHandle instance
|
|
69
69
|
def self.from: (Hash[String, untyped] remote_value, Core::Realm realm) -> ElementHandle
|
|
70
70
|
|
|
71
71
|
# Query for a descendant element matching the selector
|
|
72
72
|
# Supports CSS selectors and prefixed selectors (xpath/, text/, aria/, pierce/)
|
|
73
|
-
# @rbs selector: String
|
|
74
|
-
# @rbs return: ElementHandle?
|
|
73
|
+
# @rbs selector: String -- Selector to query
|
|
74
|
+
# @rbs return: ElementHandle? -- Matching element or nil
|
|
75
75
|
def query_selector: (String selector) -> ElementHandle?
|
|
76
76
|
|
|
77
77
|
# Query for all descendant elements matching the selector
|
|
78
78
|
# Supports CSS selectors and prefixed selectors (xpath/, text/, aria/, pierce/)
|
|
79
|
-
# @rbs selector: String
|
|
80
|
-
# @rbs return: Array[ElementHandle]
|
|
79
|
+
# @rbs selector: String -- Selector to query
|
|
80
|
+
# @rbs return: Array[ElementHandle] -- All matching elements
|
|
81
81
|
def query_selector_all: (String selector) -> Array[ElementHandle]
|
|
82
82
|
|
|
83
83
|
# Evaluate a function on the first element matching the selector
|
|
84
|
-
# @rbs selector: String
|
|
85
|
-
# @rbs page_function: String
|
|
86
|
-
# @rbs *args: untyped
|
|
87
|
-
# @rbs return: untyped
|
|
84
|
+
# @rbs selector: String -- Selector to query
|
|
85
|
+
# @rbs page_function: String -- JavaScript function to evaluate
|
|
86
|
+
# @rbs *args: untyped -- Arguments to pass to the function
|
|
87
|
+
# @rbs return: untyped -- Evaluation result
|
|
88
88
|
def eval_on_selector: (String selector, String page_function, *untyped args) -> untyped
|
|
89
89
|
|
|
90
90
|
# Evaluate a function on all elements matching the selector
|
|
91
|
-
# @rbs selector: String
|
|
92
|
-
# @rbs page_function: String
|
|
93
|
-
# @rbs *args: untyped
|
|
94
|
-
# @rbs return: untyped
|
|
91
|
+
# @rbs selector: String -- Selector to query
|
|
92
|
+
# @rbs page_function: String -- JavaScript function to evaluate
|
|
93
|
+
# @rbs *args: untyped -- Arguments to pass to the function
|
|
94
|
+
# @rbs return: untyped -- Evaluation result
|
|
95
95
|
def eval_on_selector_all: (String selector, String page_function, *untyped args) -> untyped
|
|
96
96
|
|
|
97
97
|
# Wait for an element matching the selector to appear as a descendant of this element
|
|
98
|
-
# @rbs selector: String
|
|
99
|
-
# @rbs visible: bool?
|
|
100
|
-
# @rbs hidden: bool?
|
|
101
|
-
# @rbs timeout: Numeric?
|
|
102
|
-
# @rbs &block: ((ElementHandle?) -> void)?
|
|
103
|
-
# @rbs return: ElementHandle?
|
|
98
|
+
# @rbs selector: String -- Selector to wait for
|
|
99
|
+
# @rbs visible: bool? -- Wait for element to be visible
|
|
100
|
+
# @rbs hidden: bool? -- Wait for element to be hidden
|
|
101
|
+
# @rbs timeout: Numeric? -- Wait timeout in ms
|
|
102
|
+
# @rbs &block: ((ElementHandle?) -> void)? -- Optional block called with element
|
|
103
|
+
# @rbs return: ElementHandle? -- Element or nil if hidden
|
|
104
104
|
def wait_for_selector: (String selector, ?visible: bool?, ?hidden: bool?, ?timeout: Numeric?) ?{ (?) -> untyped } -> ElementHandle?
|
|
105
105
|
|
|
106
106
|
# Click the element
|
|
107
|
-
# @rbs button: String
|
|
108
|
-
# @rbs count: Integer
|
|
109
|
-
# @rbs delay: Numeric?
|
|
110
|
-
# @rbs offset: Hash[Symbol, Numeric]?
|
|
107
|
+
# @rbs button: String -- Mouse button ('left', 'right', 'middle')
|
|
108
|
+
# @rbs count: Integer -- Number of clicks
|
|
109
|
+
# @rbs delay: Numeric? -- Delay between clicks in ms
|
|
110
|
+
# @rbs offset: Hash[Symbol, Numeric]? -- Click offset from element center
|
|
111
111
|
# @rbs return: void
|
|
112
112
|
def click: (?button: String, ?count: Integer, ?delay: Numeric?, ?offset: Hash[Symbol, Numeric]?) -> void
|
|
113
113
|
|
|
114
114
|
# Type text into the element
|
|
115
|
-
# @rbs text: String
|
|
116
|
-
# @rbs delay: Numeric
|
|
115
|
+
# @rbs text: String -- Text to type
|
|
116
|
+
# @rbs delay: Numeric -- Delay between key presses in ms
|
|
117
117
|
# @rbs return: void
|
|
118
118
|
def type: (String text, ?delay: Numeric) -> void
|
|
119
119
|
|
|
120
120
|
# Press a key on the element
|
|
121
|
-
# @rbs key: String
|
|
122
|
-
# @rbs delay: Numeric?
|
|
123
|
-
# @rbs text: String?
|
|
121
|
+
# @rbs key: String -- Key to press
|
|
122
|
+
# @rbs delay: Numeric? -- Delay between keydown and keyup in ms
|
|
123
|
+
# @rbs text: String? -- Text to send with key press
|
|
124
124
|
# @rbs return: void
|
|
125
125
|
def press: (String key, ?delay: Numeric?, ?text: String?) -> void
|
|
126
126
|
|
|
127
127
|
# Get the frame this element belongs to
|
|
128
128
|
# Following Puppeteer's pattern: realm.environment
|
|
129
|
-
# @rbs return: Frame
|
|
129
|
+
# @rbs return: Frame -- Owning frame
|
|
130
130
|
def frame: () -> Frame
|
|
131
131
|
|
|
132
132
|
# Get the content frame for iframe/frame elements
|
|
133
133
|
# Returns the frame that the iframe/frame element refers to
|
|
134
|
-
# @rbs return: Frame?
|
|
134
|
+
# @rbs return: Frame? -- Content frame or nil
|
|
135
135
|
def content_frame: () -> Frame?
|
|
136
136
|
|
|
137
137
|
# Check if the element is visible
|
|
@@ -139,7 +139,7 @@ module Puppeteer
|
|
|
139
139
|
# - It has computed styles
|
|
140
140
|
# - Its visibility is not 'hidden' or 'collapse'
|
|
141
141
|
# - Its bounding box is not empty (width > 0 AND height > 0)
|
|
142
|
-
# @rbs return: bool
|
|
142
|
+
# @rbs return: bool -- Whether element is visible
|
|
143
143
|
def visible?: () -> bool
|
|
144
144
|
|
|
145
145
|
# Check if the element is hidden
|
|
@@ -147,13 +147,13 @@ module Puppeteer
|
|
|
147
147
|
# - It has no computed styles
|
|
148
148
|
# - Its visibility is 'hidden' or 'collapse'
|
|
149
149
|
# - Its bounding box is empty (width == 0 OR height == 0)
|
|
150
|
-
# @rbs return: bool
|
|
150
|
+
# @rbs return: bool -- Whether element is hidden
|
|
151
151
|
def hidden?: () -> bool
|
|
152
152
|
|
|
153
153
|
# Convert the current handle to the given element type
|
|
154
154
|
# Validates that the element matches the expected tag name
|
|
155
|
-
# @rbs tag_name: String
|
|
156
|
-
# @rbs return: ElementHandle
|
|
155
|
+
# @rbs tag_name: String -- Expected tag name
|
|
156
|
+
# @rbs return: ElementHandle -- This element if matching
|
|
157
157
|
def to_element: (String tag_name) -> ElementHandle
|
|
158
158
|
|
|
159
159
|
# Focus the element
|
|
@@ -167,12 +167,12 @@ module Puppeteer
|
|
|
167
167
|
|
|
168
168
|
# Upload files to this element (for <input type="file">)
|
|
169
169
|
# Following Puppeteer's implementation: ElementHandle.uploadFile -> Frame.setFiles
|
|
170
|
-
# @rbs *files: String
|
|
170
|
+
# @rbs *files: String -- File paths to upload
|
|
171
171
|
# @rbs return: void
|
|
172
172
|
def upload_file: (*String files) -> void
|
|
173
173
|
|
|
174
174
|
# Get the remote value as a SharedReference for BiDi commands
|
|
175
|
-
# @rbs return: Hash[Symbol, String]
|
|
175
|
+
# @rbs return: Hash[Symbol, String] -- SharedReference for BiDi
|
|
176
176
|
def remote_value_as_shared_reference: () -> Hash[Symbol, String]
|
|
177
177
|
|
|
178
178
|
# Scroll element into view if needed
|
|
@@ -184,54 +184,54 @@ module Puppeteer
|
|
|
184
184
|
def scroll_into_view: () -> void
|
|
185
185
|
|
|
186
186
|
# Check if element is intersecting the viewport
|
|
187
|
-
# @rbs threshold: Numeric
|
|
188
|
-
# @rbs return: bool
|
|
187
|
+
# @rbs threshold: Numeric -- Intersection ratio threshold
|
|
188
|
+
# @rbs return: bool -- Whether element intersects viewport
|
|
189
189
|
def intersecting_viewport?: (?threshold: Numeric) -> bool
|
|
190
190
|
|
|
191
191
|
# Get clickable point for the element
|
|
192
|
-
# @rbs offset: Hash[Symbol, Numeric]?
|
|
193
|
-
# @rbs return: Point
|
|
192
|
+
# @rbs offset: Hash[Symbol, Numeric]? -- Offset from element center
|
|
193
|
+
# @rbs return: Point -- Clickable point coordinates
|
|
194
194
|
def clickable_point: (?offset: Hash[Symbol, Numeric]?) -> Point
|
|
195
195
|
|
|
196
196
|
# Get the bounding box of the element
|
|
197
197
|
# Uses getBoundingClientRect() to get the element's position and size
|
|
198
|
-
# @rbs return: BoundingBox?
|
|
198
|
+
# @rbs return: BoundingBox? -- Bounding box or nil if not visible
|
|
199
199
|
def bounding_box: () -> BoundingBox?
|
|
200
200
|
|
|
201
201
|
# Get the box model of the element (content, padding, border, margin)
|
|
202
|
-
# @rbs return: BoxModel?
|
|
202
|
+
# @rbs return: BoxModel? -- Box model or nil if not visible
|
|
203
203
|
def box_model: () -> BoxModel?
|
|
204
204
|
|
|
205
205
|
# Get the clickable box for the element
|
|
206
206
|
# Uses getClientRects() to handle wrapped/multi-line elements correctly
|
|
207
207
|
# Following Puppeteer's implementation:
|
|
208
208
|
# https://github.com/puppeteer/puppeteer/blob/main/packages/puppeteer-core/src/api/ElementHandle.ts#clickableBox
|
|
209
|
-
# @rbs return: Hash[Symbol, Numeric]?
|
|
209
|
+
# @rbs return: Hash[Symbol, Numeric]? -- Clickable box or nil
|
|
210
210
|
def clickable_box: () -> Hash[Symbol, Numeric]?
|
|
211
211
|
|
|
212
212
|
private
|
|
213
213
|
|
|
214
214
|
# Intersect bounding boxes with frame viewport boundaries
|
|
215
215
|
# Modifies boxes in-place to clip them to visible area
|
|
216
|
-
# @rbs boxes: Array[Hash[String, Numeric]]
|
|
216
|
+
# @rbs boxes: Array[Hash[String, Numeric]] -- Bounding boxes to clip
|
|
217
217
|
# @rbs return: void
|
|
218
218
|
def intersect_bounding_boxes_with_frame: (Array[Hash[String, Numeric]] boxes) -> void
|
|
219
219
|
|
|
220
220
|
# Intersect a single bounding box with given width/height boundaries
|
|
221
221
|
# Modifies box in-place
|
|
222
|
-
# @rbs box: Hash[String, Numeric]
|
|
223
|
-
# @rbs width: Numeric
|
|
224
|
-
# @rbs height: Numeric
|
|
222
|
+
# @rbs box: Hash[String, Numeric] -- Box to clip
|
|
223
|
+
# @rbs width: Numeric -- Viewport width
|
|
224
|
+
# @rbs height: Numeric -- Viewport height
|
|
225
225
|
# @rbs return: void
|
|
226
226
|
def intersect_bounding_box: (Hash[String, Numeric] box, Numeric width, Numeric height) -> void
|
|
227
227
|
|
|
228
228
|
# Check element visibility
|
|
229
|
-
# @rbs visible: bool
|
|
230
|
-
# @rbs return: bool
|
|
229
|
+
# @rbs visible: bool -- Expected visibility state
|
|
230
|
+
# @rbs return: bool -- Whether element matches visibility state
|
|
231
231
|
def check_visibility: (bool visible) -> bool
|
|
232
232
|
|
|
233
233
|
# String representation includes element type
|
|
234
|
-
# @rbs return: String
|
|
234
|
+
# @rbs return: String -- String representation
|
|
235
235
|
def to_s: () -> String
|
|
236
236
|
end
|
|
237
237
|
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Generated from lib/puppeteer/bidi/errors.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Puppeteer
|
|
4
|
+
module Bidi
|
|
5
|
+
class Error < StandardError
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
# Raised when attempting to use a disposed JSHandle or ElementHandle
|
|
9
|
+
class JSHandleDisposedError < Error
|
|
10
|
+
def initialize: () -> untyped
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# Raised when attempting to use a closed Page
|
|
14
|
+
class PageClosedError < Error
|
|
15
|
+
def initialize: () -> untyped
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Raised when attempting to use a detached Frame
|
|
19
|
+
class FrameDetachedError < Error
|
|
20
|
+
def initialize: (?untyped message) -> untyped
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Raised when a selector does not match any elements
|
|
24
|
+
class SelectorNotFoundError < Error
|
|
25
|
+
attr_reader selector: untyped
|
|
26
|
+
|
|
27
|
+
def initialize: (untyped selector) -> untyped
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Raised when a timeout occurs (e.g., navigation timeout)
|
|
31
|
+
class TimeoutError < Error
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Generated from lib/puppeteer/bidi/file_chooser.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Puppeteer
|
|
4
|
+
module Bidi
|
|
5
|
+
# FileChooser represents a file chooser dialog opened by an input element
|
|
6
|
+
# Based on Puppeteer's FileChooser implementation
|
|
7
|
+
class FileChooser
|
|
8
|
+
# @param element [ElementHandle] The input element that opened the file chooser
|
|
9
|
+
# @param multiple [Boolean] Whether multiple files can be selected
|
|
10
|
+
def initialize: (untyped element, untyped multiple) -> untyped
|
|
11
|
+
|
|
12
|
+
# Check if multiple files can be selected
|
|
13
|
+
# @return [Boolean] True if multiple files can be selected
|
|
14
|
+
def multiple?: () -> untyped
|
|
15
|
+
|
|
16
|
+
# Accept the file chooser with the given file paths
|
|
17
|
+
# @param paths [Array<String>] File paths to accept
|
|
18
|
+
# @raise [RuntimeError] If the file chooser has already been handled
|
|
19
|
+
# @raise [RuntimeError] If multiple files passed to single-file input
|
|
20
|
+
def accept: (untyped paths) -> untyped
|
|
21
|
+
|
|
22
|
+
# Cancel the file chooser
|
|
23
|
+
# @raise [RuntimeError] If the file chooser has already been handled
|
|
24
|
+
def cancel: () -> untyped
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|