puppeteer-bidi 0.0.1.beta1
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 +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +13 -0
- data/CLAUDE/README.md +158 -0
- data/CLAUDE/async_programming.md +158 -0
- data/CLAUDE/click_implementation.md +340 -0
- data/CLAUDE/core_layer_gotchas.md +136 -0
- data/CLAUDE/error_handling.md +232 -0
- data/CLAUDE/file_chooser.md +95 -0
- data/CLAUDE/frame_architecture.md +346 -0
- data/CLAUDE/javascript_evaluation.md +341 -0
- data/CLAUDE/jshandle_implementation.md +505 -0
- data/CLAUDE/keyboard_implementation.md +250 -0
- data/CLAUDE/mouse_implementation.md +140 -0
- data/CLAUDE/navigation_waiting.md +234 -0
- data/CLAUDE/porting_puppeteer.md +214 -0
- data/CLAUDE/query_handler.md +194 -0
- data/CLAUDE/rspec_pending_vs_skip.md +262 -0
- data/CLAUDE/selector_evaluation.md +198 -0
- data/CLAUDE/test_server_routes.md +263 -0
- data/CLAUDE/testing_strategy.md +236 -0
- data/CLAUDE/two_layer_architecture.md +180 -0
- data/CLAUDE/wrapped_element_click.md +247 -0
- data/CLAUDE.md +185 -0
- data/LICENSE.txt +21 -0
- data/README.md +488 -0
- data/Rakefile +21 -0
- data/lib/puppeteer/bidi/async_utils.rb +151 -0
- data/lib/puppeteer/bidi/browser.rb +285 -0
- data/lib/puppeteer/bidi/browser_context.rb +53 -0
- data/lib/puppeteer/bidi/browser_launcher.rb +240 -0
- data/lib/puppeteer/bidi/connection.rb +182 -0
- data/lib/puppeteer/bidi/core/README.md +169 -0
- data/lib/puppeteer/bidi/core/browser.rb +230 -0
- data/lib/puppeteer/bidi/core/browsing_context.rb +601 -0
- data/lib/puppeteer/bidi/core/disposable.rb +69 -0
- data/lib/puppeteer/bidi/core/errors.rb +64 -0
- data/lib/puppeteer/bidi/core/event_emitter.rb +83 -0
- data/lib/puppeteer/bidi/core/navigation.rb +128 -0
- data/lib/puppeteer/bidi/core/realm.rb +315 -0
- data/lib/puppeteer/bidi/core/request.rb +300 -0
- data/lib/puppeteer/bidi/core/session.rb +153 -0
- data/lib/puppeteer/bidi/core/user_context.rb +208 -0
- data/lib/puppeteer/bidi/core/user_prompt.rb +102 -0
- data/lib/puppeteer/bidi/core.rb +45 -0
- data/lib/puppeteer/bidi/deserializer.rb +132 -0
- data/lib/puppeteer/bidi/element_handle.rb +602 -0
- data/lib/puppeteer/bidi/errors.rb +42 -0
- data/lib/puppeteer/bidi/file_chooser.rb +52 -0
- data/lib/puppeteer/bidi/frame.rb +597 -0
- data/lib/puppeteer/bidi/http_response.rb +23 -0
- data/lib/puppeteer/bidi/injected.js +1 -0
- data/lib/puppeteer/bidi/injected_source.rb +21 -0
- data/lib/puppeteer/bidi/js_handle.rb +302 -0
- data/lib/puppeteer/bidi/keyboard.rb +265 -0
- data/lib/puppeteer/bidi/lazy_arg.rb +23 -0
- data/lib/puppeteer/bidi/mouse.rb +170 -0
- data/lib/puppeteer/bidi/page.rb +613 -0
- data/lib/puppeteer/bidi/query_handler.rb +397 -0
- data/lib/puppeteer/bidi/realm.rb +242 -0
- data/lib/puppeteer/bidi/serializer.rb +139 -0
- data/lib/puppeteer/bidi/target.rb +81 -0
- data/lib/puppeteer/bidi/task_manager.rb +44 -0
- data/lib/puppeteer/bidi/timeout_settings.rb +20 -0
- data/lib/puppeteer/bidi/transport.rb +129 -0
- data/lib/puppeteer/bidi/version.rb +7 -0
- data/lib/puppeteer/bidi/wait_task.rb +322 -0
- data/lib/puppeteer/bidi.rb +49 -0
- data/scripts/update_injected_source.rb +57 -0
- data/sig/puppeteer/bidi/browser.rbs +80 -0
- data/sig/puppeteer/bidi/element_handle.rbs +238 -0
- data/sig/puppeteer/bidi/frame.rbs +205 -0
- data/sig/puppeteer/bidi/js_handle.rbs +90 -0
- data/sig/puppeteer/bidi/page.rbs +247 -0
- data/sig/puppeteer/bidi.rbs +15 -0
- metadata +176 -0
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
# Generated from lib/puppeteer/bidi/element_handle.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Puppeteer
|
|
4
|
+
module Bidi
|
|
5
|
+
# ElementHandle represents a reference to a DOM element
|
|
6
|
+
# Based on Puppeteer's BidiElementHandle implementation
|
|
7
|
+
# This extends JSHandle with DOM-specific methods
|
|
8
|
+
class ElementHandle < JSHandle
|
|
9
|
+
# Bounding box data class representing element position and dimensions
|
|
10
|
+
class BoundingBox < Data
|
|
11
|
+
attr_reader x(): untyped
|
|
12
|
+
|
|
13
|
+
attr_reader y(): untyped
|
|
14
|
+
|
|
15
|
+
attr_reader width(): untyped
|
|
16
|
+
|
|
17
|
+
attr_reader height(): untyped
|
|
18
|
+
|
|
19
|
+
def self.new: (untyped x, untyped y, untyped width, untyped height) -> instance
|
|
20
|
+
| (x: untyped, y: untyped, width: untyped, height: untyped) -> instance
|
|
21
|
+
|
|
22
|
+
def self.members: () -> [ :x, :y, :width, :height ]
|
|
23
|
+
|
|
24
|
+
def members: () -> [ :x, :y, :width, :height ]
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Point data class representing a coordinate
|
|
28
|
+
class Point < Data
|
|
29
|
+
attr_reader x(): untyped
|
|
30
|
+
|
|
31
|
+
attr_reader y(): untyped
|
|
32
|
+
|
|
33
|
+
def self.new: (untyped x, untyped y) -> instance
|
|
34
|
+
| (x: untyped, y: untyped) -> instance
|
|
35
|
+
|
|
36
|
+
def self.members: () -> [ :x, :y ]
|
|
37
|
+
|
|
38
|
+
def members: () -> [ :x, :y ]
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Box model data class representing element's CSS box model
|
|
42
|
+
# Each quad (content, padding, border, margin) contains 4 Points representing corners
|
|
43
|
+
# Corners are ordered: top-left, top-right, bottom-right, bottom-left
|
|
44
|
+
class BoxModel < Data
|
|
45
|
+
attr_reader content(): untyped
|
|
46
|
+
|
|
47
|
+
attr_reader padding(): untyped
|
|
48
|
+
|
|
49
|
+
attr_reader border(): untyped
|
|
50
|
+
|
|
51
|
+
attr_reader margin(): untyped
|
|
52
|
+
|
|
53
|
+
attr_reader width(): untyped
|
|
54
|
+
|
|
55
|
+
attr_reader height(): untyped
|
|
56
|
+
|
|
57
|
+
def self.new: (untyped content, untyped padding, untyped border, untyped margin, untyped width, untyped height) -> instance
|
|
58
|
+
| (content: untyped, padding: untyped, border: untyped, margin: untyped, width: untyped, height: untyped) -> instance
|
|
59
|
+
|
|
60
|
+
def self.members: () -> [ :content, :padding, :border, :margin, :width, :height ]
|
|
61
|
+
|
|
62
|
+
def members: () -> [ :content, :padding, :border, :margin, :width, :height ]
|
|
63
|
+
end
|
|
64
|
+
|
|
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
|
|
69
|
+
def self.from: (Hash[String, untyped] remote_value, Core::Realm realm) -> ElementHandle
|
|
70
|
+
|
|
71
|
+
# Query for a descendant element matching the selector
|
|
72
|
+
# Supports CSS selectors and prefixed selectors (xpath/, text/, aria/, pierce/)
|
|
73
|
+
# @rbs selector: String
|
|
74
|
+
# @rbs return: ElementHandle?
|
|
75
|
+
def query_selector: (String selector) -> ElementHandle?
|
|
76
|
+
|
|
77
|
+
# Query for all descendant elements matching the selector
|
|
78
|
+
# Supports CSS selectors and prefixed selectors (xpath/, text/, aria/, pierce/)
|
|
79
|
+
# @rbs selector: String
|
|
80
|
+
# @rbs return: Array[ElementHandle]
|
|
81
|
+
def query_selector_all: (String selector) -> Array[ElementHandle]
|
|
82
|
+
|
|
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
|
|
88
|
+
def eval_on_selector: (String selector, String page_function, *untyped args) -> untyped
|
|
89
|
+
|
|
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
|
|
95
|
+
def eval_on_selector_all: (String selector, String page_function, *untyped args) -> untyped
|
|
96
|
+
|
|
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?
|
|
104
|
+
def wait_for_selector: (String selector, ?visible: bool?, ?hidden: bool?, ?timeout: Numeric?) ?{ (?) -> untyped } -> ElementHandle?
|
|
105
|
+
|
|
106
|
+
# Click the element
|
|
107
|
+
# @rbs button: String
|
|
108
|
+
# @rbs count: Integer
|
|
109
|
+
# @rbs delay: Numeric?
|
|
110
|
+
# @rbs offset: Hash[Symbol, Numeric]?
|
|
111
|
+
# @rbs return: void
|
|
112
|
+
def click: (?button: String, ?count: Integer, ?delay: Numeric?, ?offset: Hash[Symbol, Numeric]?) -> void
|
|
113
|
+
|
|
114
|
+
# Type text into the element
|
|
115
|
+
# @rbs text: String
|
|
116
|
+
# @rbs delay: Numeric
|
|
117
|
+
# @rbs return: void
|
|
118
|
+
def type: (String text, ?delay: Numeric) -> void
|
|
119
|
+
|
|
120
|
+
# Press a key on the element
|
|
121
|
+
# @rbs key: String
|
|
122
|
+
# @rbs delay: Numeric?
|
|
123
|
+
# @rbs text: String?
|
|
124
|
+
# @rbs return: void
|
|
125
|
+
def press: (String key, ?delay: Numeric?, ?text: String?) -> void
|
|
126
|
+
|
|
127
|
+
# Get the frame this element belongs to
|
|
128
|
+
# Following Puppeteer's pattern: realm.environment
|
|
129
|
+
# @rbs return: Frame
|
|
130
|
+
def frame: () -> Frame
|
|
131
|
+
|
|
132
|
+
# Get the content frame for iframe/frame elements
|
|
133
|
+
# Returns the frame that the iframe/frame element refers to
|
|
134
|
+
# @rbs return: Frame?
|
|
135
|
+
def content_frame: () -> Frame?
|
|
136
|
+
|
|
137
|
+
# Check if the element is visible
|
|
138
|
+
# An element is considered visible if:
|
|
139
|
+
# - It has computed styles
|
|
140
|
+
# - Its visibility is not 'hidden' or 'collapse'
|
|
141
|
+
# - Its bounding box is not empty (width > 0 AND height > 0)
|
|
142
|
+
# @rbs return: bool
|
|
143
|
+
def visible?: () -> bool
|
|
144
|
+
|
|
145
|
+
# Check if the element is hidden
|
|
146
|
+
# An element is considered hidden if:
|
|
147
|
+
# - It has no computed styles
|
|
148
|
+
# - Its visibility is 'hidden' or 'collapse'
|
|
149
|
+
# - Its bounding box is empty (width == 0 OR height == 0)
|
|
150
|
+
# @rbs return: bool
|
|
151
|
+
def hidden?: () -> bool
|
|
152
|
+
|
|
153
|
+
# Convert the current handle to the given element type
|
|
154
|
+
# Validates that the element matches the expected tag name
|
|
155
|
+
# @rbs tag_name: String
|
|
156
|
+
# @rbs return: ElementHandle
|
|
157
|
+
def to_element: (String tag_name) -> ElementHandle
|
|
158
|
+
|
|
159
|
+
# Focus the element
|
|
160
|
+
# @rbs return: void
|
|
161
|
+
def focus: () -> void
|
|
162
|
+
|
|
163
|
+
# Hover over the element
|
|
164
|
+
# Scrolls element into view if needed and moves mouse to element center
|
|
165
|
+
# @rbs return: void
|
|
166
|
+
def hover: () -> void
|
|
167
|
+
|
|
168
|
+
# Upload files to this element (for <input type="file">)
|
|
169
|
+
# Following Puppeteer's implementation: ElementHandle.uploadFile -> Frame.setFiles
|
|
170
|
+
# @rbs *files: String
|
|
171
|
+
# @rbs return: void
|
|
172
|
+
def upload_file: (*String files) -> void
|
|
173
|
+
|
|
174
|
+
# Get the remote value as a SharedReference for BiDi commands
|
|
175
|
+
# @rbs return: Hash[Symbol, String]
|
|
176
|
+
def remote_value_as_shared_reference: () -> Hash[Symbol, String]
|
|
177
|
+
|
|
178
|
+
# Scroll element into view if needed
|
|
179
|
+
# @rbs return: void
|
|
180
|
+
def scroll_into_view_if_needed: () -> void
|
|
181
|
+
|
|
182
|
+
# Scroll element into view
|
|
183
|
+
# @rbs return: void
|
|
184
|
+
def scroll_into_view: () -> void
|
|
185
|
+
|
|
186
|
+
# Check if element is intersecting the viewport
|
|
187
|
+
# @rbs threshold: Numeric
|
|
188
|
+
# @rbs return: bool
|
|
189
|
+
def intersecting_viewport?: (?threshold: Numeric) -> bool
|
|
190
|
+
|
|
191
|
+
# Get clickable point for the element
|
|
192
|
+
# @rbs offset: Hash[Symbol, Numeric]?
|
|
193
|
+
# @rbs return: Point
|
|
194
|
+
def clickable_point: (?offset: Hash[Symbol, Numeric]?) -> Point
|
|
195
|
+
|
|
196
|
+
# Get the bounding box of the element
|
|
197
|
+
# Uses getBoundingClientRect() to get the element's position and size
|
|
198
|
+
# @rbs return: BoundingBox?
|
|
199
|
+
def bounding_box: () -> BoundingBox?
|
|
200
|
+
|
|
201
|
+
# Get the box model of the element (content, padding, border, margin)
|
|
202
|
+
# @rbs return: BoxModel?
|
|
203
|
+
def box_model: () -> BoxModel?
|
|
204
|
+
|
|
205
|
+
# Get the clickable box for the element
|
|
206
|
+
# Uses getClientRects() to handle wrapped/multi-line elements correctly
|
|
207
|
+
# Following Puppeteer's implementation:
|
|
208
|
+
# https://github.com/puppeteer/puppeteer/blob/main/packages/puppeteer-core/src/api/ElementHandle.ts#clickableBox
|
|
209
|
+
# @rbs return: Hash[Symbol, Numeric]?
|
|
210
|
+
def clickable_box: () -> Hash[Symbol, Numeric]?
|
|
211
|
+
|
|
212
|
+
private
|
|
213
|
+
|
|
214
|
+
# Intersect bounding boxes with frame viewport boundaries
|
|
215
|
+
# Modifies boxes in-place to clip them to visible area
|
|
216
|
+
# @rbs boxes: Array[Hash[String, Numeric]]
|
|
217
|
+
# @rbs return: void
|
|
218
|
+
def intersect_bounding_boxes_with_frame: (Array[Hash[String, Numeric]] boxes) -> void
|
|
219
|
+
|
|
220
|
+
# Intersect a single bounding box with given width/height boundaries
|
|
221
|
+
# Modifies box in-place
|
|
222
|
+
# @rbs box: Hash[String, Numeric]
|
|
223
|
+
# @rbs width: Numeric
|
|
224
|
+
# @rbs height: Numeric
|
|
225
|
+
# @rbs return: void
|
|
226
|
+
def intersect_bounding_box: (Hash[String, Numeric] box, Numeric width, Numeric height) -> void
|
|
227
|
+
|
|
228
|
+
# Check element visibility
|
|
229
|
+
# @rbs visible: bool
|
|
230
|
+
# @rbs return: bool
|
|
231
|
+
def check_visibility: (bool visible) -> bool
|
|
232
|
+
|
|
233
|
+
# String representation includes element type
|
|
234
|
+
# @rbs return: String
|
|
235
|
+
def to_s: () -> String
|
|
236
|
+
end
|
|
237
|
+
end
|
|
238
|
+
end
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
# Generated from lib/puppeteer/bidi/frame.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Puppeteer
|
|
4
|
+
module Bidi
|
|
5
|
+
# Frame represents a frame (main frame or iframe) in the page
|
|
6
|
+
# This is a high-level wrapper around Core::BrowsingContext
|
|
7
|
+
# Following Puppeteer's BidiFrame implementation
|
|
8
|
+
class Frame
|
|
9
|
+
attr_reader browsing_context: Core::BrowsingContext
|
|
10
|
+
|
|
11
|
+
# Factory method following Puppeteer's BidiFrame.from pattern
|
|
12
|
+
# @rbs parent: Page | Frame
|
|
13
|
+
# @rbs browsing_context: Core::BrowsingContext
|
|
14
|
+
# @rbs return: Frame
|
|
15
|
+
def self.from: (Page | Frame parent, Core::BrowsingContext browsing_context) -> Frame
|
|
16
|
+
|
|
17
|
+
# @rbs parent: Page | Frame
|
|
18
|
+
# @rbs browsing_context: Core::BrowsingContext
|
|
19
|
+
# @rbs return: void
|
|
20
|
+
def initialize: (Page | Frame parent, Core::BrowsingContext browsing_context) -> void
|
|
21
|
+
|
|
22
|
+
# @rbs return: FrameRealm
|
|
23
|
+
def main_realm: () -> FrameRealm
|
|
24
|
+
|
|
25
|
+
# @rbs return: FrameRealm
|
|
26
|
+
def isolated_realm: () -> FrameRealm
|
|
27
|
+
|
|
28
|
+
# Backwards compatibility for call sites that previously accessed Frame#realm.
|
|
29
|
+
# @rbs return: FrameRealm
|
|
30
|
+
def realm: () -> FrameRealm
|
|
31
|
+
|
|
32
|
+
# Get the page that owns this frame
|
|
33
|
+
# Traverses up the parent chain until reaching a Page
|
|
34
|
+
# @rbs return: Page
|
|
35
|
+
def page: () -> Page
|
|
36
|
+
|
|
37
|
+
# Get the parent frame
|
|
38
|
+
# @rbs return: Frame?
|
|
39
|
+
def parent_frame: () -> Frame?
|
|
40
|
+
|
|
41
|
+
# Evaluate JavaScript in the frame context
|
|
42
|
+
# @rbs script: String
|
|
43
|
+
# @rbs *args: untyped
|
|
44
|
+
# @rbs return: untyped
|
|
45
|
+
def evaluate: (String script, *untyped args) -> untyped
|
|
46
|
+
|
|
47
|
+
# Evaluate JavaScript and return a handle to the result
|
|
48
|
+
# @rbs script: String
|
|
49
|
+
# @rbs *args: untyped
|
|
50
|
+
# @rbs return: JSHandle
|
|
51
|
+
def evaluate_handle: (String script, *untyped args) -> JSHandle
|
|
52
|
+
|
|
53
|
+
# Get the document element handle
|
|
54
|
+
# @rbs return: ElementHandle
|
|
55
|
+
def document: () -> ElementHandle
|
|
56
|
+
|
|
57
|
+
# Query for an element matching the selector
|
|
58
|
+
# @rbs selector: String
|
|
59
|
+
# @rbs return: ElementHandle?
|
|
60
|
+
def query_selector: (String selector) -> ElementHandle?
|
|
61
|
+
|
|
62
|
+
# Query for all elements matching the selector
|
|
63
|
+
# @rbs selector: String
|
|
64
|
+
# @rbs return: Array[ElementHandle]
|
|
65
|
+
def query_selector_all: (String selector) -> Array[ElementHandle]
|
|
66
|
+
|
|
67
|
+
# Evaluate a function on the first element matching the selector
|
|
68
|
+
# @rbs selector: String
|
|
69
|
+
# @rbs page_function: String
|
|
70
|
+
# @rbs *args: untyped
|
|
71
|
+
# @rbs return: untyped
|
|
72
|
+
def eval_on_selector: (String selector, String page_function, *untyped args) -> untyped
|
|
73
|
+
|
|
74
|
+
# Evaluate a function on all elements matching the selector
|
|
75
|
+
# @rbs selector: String
|
|
76
|
+
# @rbs page_function: String
|
|
77
|
+
# @rbs *args: untyped
|
|
78
|
+
# @rbs return: untyped
|
|
79
|
+
def eval_on_selector_all: (String selector, String page_function, *untyped args) -> untyped
|
|
80
|
+
|
|
81
|
+
# Click an element matching the selector
|
|
82
|
+
# @rbs selector: String
|
|
83
|
+
# @rbs button: String
|
|
84
|
+
# @rbs count: Integer
|
|
85
|
+
# @rbs delay: Numeric?
|
|
86
|
+
# @rbs offset: Hash[Symbol, Numeric]?
|
|
87
|
+
# @rbs return: void
|
|
88
|
+
def click: (String selector, ?button: String, ?count: Integer, ?delay: Numeric?, ?offset: Hash[Symbol, Numeric]?) -> void
|
|
89
|
+
|
|
90
|
+
# Type text into an element matching the selector
|
|
91
|
+
# @rbs selector: String
|
|
92
|
+
# @rbs text: String
|
|
93
|
+
# @rbs delay: Numeric
|
|
94
|
+
# @rbs return: void
|
|
95
|
+
def type: (String selector, String text, ?delay: Numeric) -> void
|
|
96
|
+
|
|
97
|
+
# Hover over an element matching the selector
|
|
98
|
+
# @rbs selector: String
|
|
99
|
+
# @rbs return: void
|
|
100
|
+
def hover: (String selector) -> void
|
|
101
|
+
|
|
102
|
+
# Get the frame URL
|
|
103
|
+
# @rbs return: String
|
|
104
|
+
def url: () -> String
|
|
105
|
+
|
|
106
|
+
# Navigate to a URL
|
|
107
|
+
# @rbs url: String
|
|
108
|
+
# @rbs wait_until: String
|
|
109
|
+
# @rbs timeout: Numeric
|
|
110
|
+
# @rbs return: HTTPResponse?
|
|
111
|
+
def goto: (String url, ?wait_until: String, ?timeout: Numeric) -> HTTPResponse?
|
|
112
|
+
|
|
113
|
+
# Set frame content
|
|
114
|
+
# @rbs html: String
|
|
115
|
+
# @rbs wait_until: String
|
|
116
|
+
# @rbs return: void
|
|
117
|
+
def set_content: (String html, ?wait_until: String) -> void
|
|
118
|
+
|
|
119
|
+
# Set frame content using document.open/write/close
|
|
120
|
+
# This is a low-level method that doesn't wait for load events
|
|
121
|
+
# @rbs content: String
|
|
122
|
+
# @rbs return: void
|
|
123
|
+
def set_frame_content: (String content) -> void
|
|
124
|
+
|
|
125
|
+
# Get the frame name
|
|
126
|
+
# @rbs return: String
|
|
127
|
+
def name: () -> String
|
|
128
|
+
|
|
129
|
+
# Check if frame is detached
|
|
130
|
+
# @rbs return: bool
|
|
131
|
+
def detached?: () -> bool
|
|
132
|
+
|
|
133
|
+
# Get child frames
|
|
134
|
+
# Returns cached frame instances following Puppeteer's pattern
|
|
135
|
+
# @rbs return: Array[Frame]
|
|
136
|
+
def child_frames: () -> Array[Frame]
|
|
137
|
+
|
|
138
|
+
# Get the frame element (iframe/frame DOM element) for this frame
|
|
139
|
+
# Returns nil for the main frame
|
|
140
|
+
# Following Puppeteer's Frame.frameElement() implementation exactly
|
|
141
|
+
# @rbs return: ElementHandle?
|
|
142
|
+
def frame_element: () -> ElementHandle?
|
|
143
|
+
|
|
144
|
+
# Wait for navigation to complete
|
|
145
|
+
# @rbs timeout: Numeric
|
|
146
|
+
# @rbs wait_until: String | Array[String]
|
|
147
|
+
# @rbs &block: (-> void)?
|
|
148
|
+
# @rbs return: HTTPResponse?
|
|
149
|
+
def wait_for_navigation: (?timeout: Numeric, ?wait_until: String | Array[String]) ?{ (?) -> untyped } -> HTTPResponse?
|
|
150
|
+
|
|
151
|
+
# Wait for a function to return a truthy value
|
|
152
|
+
# @rbs page_function: String
|
|
153
|
+
# @rbs options: Hash[Symbol, untyped]
|
|
154
|
+
# @rbs *args: untyped
|
|
155
|
+
# @rbs &block: ((JSHandle) -> void)?
|
|
156
|
+
# @rbs return: JSHandle
|
|
157
|
+
def wait_for_function: (String page_function, ?Hash[Symbol, untyped] options, *untyped args) ?{ (?) -> untyped } -> JSHandle
|
|
158
|
+
|
|
159
|
+
# Wait for an element matching the selector to appear in the frame
|
|
160
|
+
# @rbs selector: String
|
|
161
|
+
# @rbs visible: bool?
|
|
162
|
+
# @rbs hidden: bool?
|
|
163
|
+
# @rbs timeout: Numeric?
|
|
164
|
+
# @rbs &block: ((ElementHandle?) -> void)?
|
|
165
|
+
# @rbs return: ElementHandle?
|
|
166
|
+
def wait_for_selector: (String selector, ?visible: bool?, ?hidden: bool?, ?timeout: Numeric?) ?{ (?) -> untyped } -> ElementHandle?
|
|
167
|
+
|
|
168
|
+
# Set files on an input element
|
|
169
|
+
# @rbs element: ElementHandle
|
|
170
|
+
# @rbs files: Array[String]
|
|
171
|
+
# @rbs return: void
|
|
172
|
+
def set_files: (ElementHandle element, Array[String] files) -> void
|
|
173
|
+
|
|
174
|
+
# Get the frame ID (browsing context ID)
|
|
175
|
+
# Following Puppeteer's _id pattern
|
|
176
|
+
# @rbs return: String
|
|
177
|
+
def _id: () -> String
|
|
178
|
+
|
|
179
|
+
private
|
|
180
|
+
|
|
181
|
+
# Initialize the frame by setting up child frame tracking
|
|
182
|
+
# Following Puppeteer's BidiFrame.#initialize pattern exactly
|
|
183
|
+
# @rbs return: void
|
|
184
|
+
def initialize_frame: () -> void
|
|
185
|
+
|
|
186
|
+
# Create a Frame for a child browsing context
|
|
187
|
+
# Following Puppeteer's BidiFrame.#createFrameTarget pattern exactly:
|
|
188
|
+
# const frame = BidiFrame.from(this, browsingContext);
|
|
189
|
+
# this.#frames.set(browsingContext, frame);
|
|
190
|
+
# this.page().trustedEmitter.emit(PageEvent.FrameAttached, frame);
|
|
191
|
+
# browsingContext.on('closed', () => {
|
|
192
|
+
# this.#frames.delete(browsingContext);
|
|
193
|
+
# });
|
|
194
|
+
# Note: FrameDetached is NOT emitted here - it's emitted in #initialize
|
|
195
|
+
# when the frame's own browsing context closes
|
|
196
|
+
# @rbs browsing_context: Core::BrowsingContext
|
|
197
|
+
# @rbs return: Frame
|
|
198
|
+
def create_frame_target: (Core::BrowsingContext browsing_context) -> Frame
|
|
199
|
+
|
|
200
|
+
# Check if this frame is detached and raise error if so
|
|
201
|
+
# @rbs return: void
|
|
202
|
+
def assert_not_detached: () -> void
|
|
203
|
+
end
|
|
204
|
+
end
|
|
205
|
+
end
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Generated from lib/puppeteer/bidi/js_handle.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Puppeteer
|
|
4
|
+
module Bidi
|
|
5
|
+
# JSHandle represents a reference to a JavaScript object
|
|
6
|
+
# Based on Puppeteer's BidiJSHandle implementation
|
|
7
|
+
class JSHandle
|
|
8
|
+
attr_reader realm: Core::Realm
|
|
9
|
+
|
|
10
|
+
# @rbs remote_value: Hash[String, untyped]
|
|
11
|
+
# @rbs realm: Core::Realm
|
|
12
|
+
# @rbs return: void
|
|
13
|
+
def initialize: (Core::Realm realm, Hash[String, untyped] remote_value) -> void
|
|
14
|
+
|
|
15
|
+
# Factory method to create JSHandle from remote value
|
|
16
|
+
# @rbs remote_value: Hash[String, untyped]
|
|
17
|
+
# @rbs realm: Core::Realm
|
|
18
|
+
# @rbs return: JSHandle | ElementHandle
|
|
19
|
+
def self.from: (Hash[String, untyped] remote_value, Core::Realm realm) -> (JSHandle | ElementHandle)
|
|
20
|
+
|
|
21
|
+
# Get the remote value (BiDi Script.RemoteValue)
|
|
22
|
+
# @rbs return: Hash[String, untyped]
|
|
23
|
+
def remote_value: () -> Hash[String, untyped]
|
|
24
|
+
|
|
25
|
+
# Get the remote object (alias for remote_value)
|
|
26
|
+
# @rbs return: Hash[String, untyped]
|
|
27
|
+
def remote_object: () -> Hash[String, untyped]
|
|
28
|
+
|
|
29
|
+
# Check if handle has been disposed
|
|
30
|
+
# @rbs return: bool
|
|
31
|
+
def disposed?: () -> bool
|
|
32
|
+
|
|
33
|
+
# Dispose this handle by releasing the remote object
|
|
34
|
+
# @rbs return: void
|
|
35
|
+
def dispose: () -> void
|
|
36
|
+
|
|
37
|
+
# Get the handle ID (handle or sharedId)
|
|
38
|
+
# @rbs return: String?
|
|
39
|
+
def id: () -> String?
|
|
40
|
+
|
|
41
|
+
# Evaluate JavaScript function with this handle as the first argument
|
|
42
|
+
# @rbs script: String
|
|
43
|
+
# @rbs *args: untyped
|
|
44
|
+
# @rbs return: untyped
|
|
45
|
+
def evaluate: (String script, *untyped args) -> untyped
|
|
46
|
+
|
|
47
|
+
# Evaluate JavaScript function and return a handle to the result
|
|
48
|
+
# @rbs script: String
|
|
49
|
+
# @rbs *args: untyped
|
|
50
|
+
# @rbs return: JSHandle
|
|
51
|
+
def evaluate_handle: (String script, *untyped args) -> JSHandle
|
|
52
|
+
|
|
53
|
+
# Get a property of the object
|
|
54
|
+
# @rbs property_name: String
|
|
55
|
+
# @rbs return: JSHandle
|
|
56
|
+
def get_property: (String property_name) -> JSHandle
|
|
57
|
+
|
|
58
|
+
# Get all properties of the object
|
|
59
|
+
# @rbs return: Hash[String, JSHandle]
|
|
60
|
+
def get_properties: () -> Hash[String, JSHandle]
|
|
61
|
+
|
|
62
|
+
# Convert this handle to a JSON-serializable value
|
|
63
|
+
# @rbs return: untyped
|
|
64
|
+
def json_value: () -> untyped
|
|
65
|
+
|
|
66
|
+
# Convert to ElementHandle if this is an element
|
|
67
|
+
# @rbs return: ElementHandle?
|
|
68
|
+
def as_element: () -> ElementHandle?
|
|
69
|
+
|
|
70
|
+
# Check if this is a primitive value
|
|
71
|
+
# @rbs return: bool
|
|
72
|
+
def primitive_value?: () -> bool
|
|
73
|
+
|
|
74
|
+
# String representation of this handle
|
|
75
|
+
# @rbs return: String
|
|
76
|
+
def to_s: () -> String
|
|
77
|
+
|
|
78
|
+
private
|
|
79
|
+
|
|
80
|
+
# Check if this handle has been disposed and raise error if so
|
|
81
|
+
# @rbs return: void
|
|
82
|
+
def assert_not_disposed: () -> void
|
|
83
|
+
|
|
84
|
+
# Handle evaluation exceptions
|
|
85
|
+
# @rbs result: Hash[String, untyped]
|
|
86
|
+
# @rbs return: void
|
|
87
|
+
def handle_evaluation_exception: (Hash[String, untyped] result) -> void
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|