puppeteer-bidi 0.0.1.beta10 → 0.0.1
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/AGENTS.md +44 -0
- data/API_COVERAGE.md +345 -0
- data/CLAUDE/porting_puppeteer.md +20 -0
- data/CLAUDE.md +2 -1
- data/DEVELOPMENT.md +14 -0
- data/README.md +47 -415
- data/development/generate_api_coverage.rb +411 -0
- data/development/puppeteer_revision.txt +1 -0
- data/lib/puppeteer/bidi/browser.rb +118 -22
- data/lib/puppeteer/bidi/browser_context.rb +185 -2
- data/lib/puppeteer/bidi/connection.rb +16 -5
- data/lib/puppeteer/bidi/cookie_utils.rb +192 -0
- data/lib/puppeteer/bidi/core/browsing_context.rb +83 -40
- data/lib/puppeteer/bidi/core/realm.rb +6 -0
- data/lib/puppeteer/bidi/core/request.rb +79 -35
- data/lib/puppeteer/bidi/core/user_context.rb +5 -3
- data/lib/puppeteer/bidi/element_handle.rb +200 -8
- data/lib/puppeteer/bidi/errors.rb +4 -0
- data/lib/puppeteer/bidi/frame.rb +115 -11
- data/lib/puppeteer/bidi/http_request.rb +577 -0
- data/lib/puppeteer/bidi/http_response.rb +161 -10
- data/lib/puppeteer/bidi/locator.rb +792 -0
- data/lib/puppeteer/bidi/page.rb +859 -7
- data/lib/puppeteer/bidi/query_handler.rb +1 -1
- data/lib/puppeteer/bidi/version.rb +1 -1
- data/lib/puppeteer/bidi.rb +39 -6
- data/sig/puppeteer/bidi/browser.rbs +53 -6
- data/sig/puppeteer/bidi/browser_context.rbs +36 -0
- data/sig/puppeteer/bidi/cookie_utils.rbs +64 -0
- data/sig/puppeteer/bidi/core/browsing_context.rbs +16 -6
- data/sig/puppeteer/bidi/core/request.rbs +14 -11
- data/sig/puppeteer/bidi/core/user_context.rbs +2 -2
- data/sig/puppeteer/bidi/element_handle.rbs +28 -0
- data/sig/puppeteer/bidi/errors.rbs +4 -0
- data/sig/puppeteer/bidi/frame.rbs +17 -0
- data/sig/puppeteer/bidi/http_request.rbs +162 -0
- data/sig/puppeteer/bidi/http_response.rbs +67 -8
- data/sig/puppeteer/bidi/locator.rbs +267 -0
- data/sig/puppeteer/bidi/page.rbs +170 -0
- data/sig/puppeteer/bidi.rbs +15 -3
- metadata +12 -1
|
@@ -257,7 +257,7 @@ module Puppeteer
|
|
|
257
257
|
|
|
258
258
|
options = {}
|
|
259
259
|
options[:polling] = resolved_polling if resolved_polling
|
|
260
|
-
options[:timeout] = timeout
|
|
260
|
+
options[:timeout] = timeout unless timeout.nil?
|
|
261
261
|
|
|
262
262
|
begin
|
|
263
263
|
handle = frame.isolated_realm.wait_for_function(
|
data/lib/puppeteer/bidi.rb
CHANGED
|
@@ -11,11 +11,14 @@ require "puppeteer/bidi/serializer"
|
|
|
11
11
|
require "puppeteer/bidi/deserializer"
|
|
12
12
|
require "puppeteer/bidi/injected_source"
|
|
13
13
|
require "puppeteer/bidi/lazy_arg"
|
|
14
|
+
require "puppeteer/bidi/cookie_utils"
|
|
14
15
|
require "puppeteer/bidi/js_handle"
|
|
15
16
|
require "puppeteer/bidi/keyboard"
|
|
16
17
|
require "puppeteer/bidi/mouse"
|
|
18
|
+
require "puppeteer/bidi/http_request"
|
|
17
19
|
require "puppeteer/bidi/http_response"
|
|
18
20
|
require "puppeteer/bidi/element_handle"
|
|
21
|
+
require "puppeteer/bidi/locator"
|
|
19
22
|
require "puppeteer/bidi/query_handler"
|
|
20
23
|
require "puppeteer/bidi/wait_task"
|
|
21
24
|
require "puppeteer/bidi/realm"
|
|
@@ -38,9 +41,11 @@ module Puppeteer
|
|
|
38
41
|
# @rbs headless: bool -- Run browser in headless mode
|
|
39
42
|
# @rbs args: Array[String]? -- Additional browser arguments
|
|
40
43
|
# @rbs timeout: Numeric? -- Launch timeout in seconds
|
|
44
|
+
# @rbs accept_insecure_certs: bool -- Accept insecure certificates
|
|
41
45
|
# @rbs &block: (Browser) -> untyped -- Block to execute with the browser instance
|
|
42
46
|
# @rbs return: untyped
|
|
43
|
-
def self.launch(executable_path: nil, user_data_dir: nil, headless: true, args: nil, timeout: nil,
|
|
47
|
+
def self.launch(executable_path: nil, user_data_dir: nil, headless: true, args: nil, timeout: nil,
|
|
48
|
+
accept_insecure_certs: false, &block)
|
|
44
49
|
unless block
|
|
45
50
|
raise ArgumentError, 'Block is required for launch_with_sync'
|
|
46
51
|
end
|
|
@@ -52,7 +57,8 @@ module Puppeteer
|
|
|
52
57
|
user_data_dir: user_data_dir,
|
|
53
58
|
headless: headless,
|
|
54
59
|
args: args,
|
|
55
|
-
timeout: timeout
|
|
60
|
+
timeout: timeout,
|
|
61
|
+
accept_insecure_certs: accept_insecure_certs
|
|
56
62
|
)
|
|
57
63
|
block.call(browser)
|
|
58
64
|
ensure
|
|
@@ -67,22 +73,49 @@ module Puppeteer
|
|
|
67
73
|
# @rbs headless: bool -- Run browser in headless mode
|
|
68
74
|
# @rbs args: Array[String]? -- Additional browser arguments
|
|
69
75
|
# @rbs timeout: Numeric? -- Launch timeout in seconds
|
|
76
|
+
# @rbs accept_insecure_certs: bool -- Accept insecure certificates
|
|
70
77
|
# @rbs return: Browser -- Browser instance (if no block given)
|
|
71
|
-
def self.launch_browser_instance(executable_path: nil, user_data_dir: nil, headless: true, args: nil, timeout: nil
|
|
78
|
+
def self.launch_browser_instance(executable_path: nil, user_data_dir: nil, headless: true, args: nil, timeout: nil,
|
|
79
|
+
accept_insecure_certs: false)
|
|
72
80
|
Browser.launch(
|
|
73
81
|
executable_path: executable_path,
|
|
74
82
|
user_data_dir: user_data_dir,
|
|
75
83
|
headless: headless,
|
|
76
84
|
args: args,
|
|
77
|
-
timeout: timeout
|
|
85
|
+
timeout: timeout,
|
|
86
|
+
accept_insecure_certs: accept_insecure_certs
|
|
78
87
|
)
|
|
79
88
|
end
|
|
80
89
|
|
|
81
90
|
# Connect to an existing browser instance
|
|
82
91
|
# @rbs ws_endpoint: String -- WebSocket endpoint URL
|
|
92
|
+
# @rbs timeout: Numeric? -- Connect timeout in seconds
|
|
93
|
+
# @rbs accept_insecure_certs: bool -- Accept insecure certificates
|
|
94
|
+
# @rbs &block: (Browser) -> untyped -- Block to execute with the browser instance
|
|
95
|
+
# @rbs return: untyped
|
|
96
|
+
def self.connect(ws_endpoint, timeout: nil, accept_insecure_certs: false, &block)
|
|
97
|
+
unless block
|
|
98
|
+
raise ArgumentError, 'Block is required for connect_with_sync'
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
Sync do
|
|
102
|
+
begin
|
|
103
|
+
browser = connect_to_browser_instance(ws_endpoint, timeout: timeout,
|
|
104
|
+
accept_insecure_certs: accept_insecure_certs)
|
|
105
|
+
block.call(browser)
|
|
106
|
+
ensure
|
|
107
|
+
browser&.close
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
# Connect to an existing browser instance
|
|
113
|
+
# @rbs ws_endpoint: String -- WebSocket endpoint URL
|
|
114
|
+
# @rbs timeout: Numeric? -- Connect timeout in seconds
|
|
115
|
+
# @rbs accept_insecure_certs: bool -- Accept insecure certificates
|
|
83
116
|
# @rbs return: Browser -- Browser instance
|
|
84
|
-
def self.
|
|
85
|
-
Browser.connect(ws_endpoint)
|
|
117
|
+
def self.connect_to_browser_instance(ws_endpoint, timeout: nil, accept_insecure_certs: false)
|
|
118
|
+
Browser.connect(ws_endpoint, timeout: timeout, accept_insecure_certs: accept_insecure_certs)
|
|
86
119
|
end
|
|
87
120
|
end
|
|
88
121
|
end
|
|
@@ -10,17 +10,22 @@ module Puppeteer
|
|
|
10
10
|
|
|
11
11
|
attr_reader default_browser_context: BrowserContext
|
|
12
12
|
|
|
13
|
+
attr_reader ws_endpoint: String?
|
|
14
|
+
|
|
13
15
|
# @rbs connection: Connection -- BiDi connection
|
|
14
16
|
# @rbs launcher: BrowserLauncher? -- Browser launcher instance
|
|
17
|
+
# @rbs ws_endpoint: String? -- WebSocket endpoint URL
|
|
18
|
+
# @rbs accept_insecure_certs: bool -- Accept insecure certificates
|
|
15
19
|
# @rbs return: Browser -- Browser instance
|
|
16
|
-
def self.create: (connection: Connection, ?launcher: BrowserLauncher?) -> Browser
|
|
20
|
+
def self.create: (connection: Connection, ?launcher: BrowserLauncher?, ?ws_endpoint: String?, ?accept_insecure_certs: bool) -> Browser
|
|
17
21
|
|
|
18
22
|
# @rbs connection: Connection -- BiDi connection
|
|
19
23
|
# @rbs launcher: BrowserLauncher? -- Browser launcher instance
|
|
20
24
|
# @rbs core_browser: Core::Browser -- Core browser instance
|
|
21
25
|
# @rbs session: Core::Session -- BiDi session
|
|
26
|
+
# @rbs ws_endpoint: String? -- WebSocket endpoint URL
|
|
22
27
|
# @rbs return: void
|
|
23
|
-
def initialize: (connection: Connection, launcher: BrowserLauncher?, core_browser: Core::Browser, session: Core::Session) -> void
|
|
28
|
+
def initialize: (connection: Connection, launcher: BrowserLauncher?, core_browser: Core::Browser, session: Core::Session, ws_endpoint: String?) -> void
|
|
24
29
|
|
|
25
30
|
# Launch a new Firefox browser instance
|
|
26
31
|
# @rbs executable_path: String? -- Path to browser executable
|
|
@@ -28,26 +33,59 @@ module Puppeteer
|
|
|
28
33
|
# @rbs headless: bool -- Run browser in headless mode
|
|
29
34
|
# @rbs args: Array[String]? -- Additional browser arguments
|
|
30
35
|
# @rbs timeout: Numeric? -- Launch timeout in seconds
|
|
36
|
+
# @rbs accept_insecure_certs: bool -- Accept insecure certificates
|
|
31
37
|
# @rbs return: Browser -- Browser instance
|
|
32
|
-
def self.launch: (?executable_path: String?, ?user_data_dir: String?, ?headless: bool, ?args: Array[String]?, ?timeout: Numeric?) -> Browser
|
|
38
|
+
def self.launch: (?executable_path: String?, ?user_data_dir: String?, ?headless: bool, ?args: Array[String]?, ?timeout: Numeric?, ?accept_insecure_certs: bool) -> Browser
|
|
33
39
|
|
|
34
40
|
# Connect to an existing Firefox browser instance
|
|
35
41
|
# @rbs ws_endpoint: String -- WebSocket endpoint URL
|
|
42
|
+
# @rbs timeout: Numeric? -- Connect timeout in seconds
|
|
43
|
+
# @rbs accept_insecure_certs: bool -- Accept insecure certificates
|
|
36
44
|
# @rbs return: Browser -- Browser instance
|
|
37
|
-
def self.connect: (String ws_endpoint) -> Browser
|
|
45
|
+
def self.connect: (String ws_endpoint, ?timeout: Numeric?, ?accept_insecure_certs: bool) -> Browser
|
|
38
46
|
|
|
39
47
|
# Get BiDi session status
|
|
40
48
|
# @rbs return: untyped -- Session status
|
|
41
49
|
def status: () -> untyped
|
|
42
50
|
|
|
51
|
+
# Get the browser's original user agent
|
|
52
|
+
# @rbs return: String -- User agent string
|
|
53
|
+
def user_agent: () -> String
|
|
54
|
+
|
|
43
55
|
# Create a new page (Puppeteer-like API)
|
|
44
56
|
# @rbs return: Page -- New page instance
|
|
45
57
|
def new_page: () -> Page
|
|
46
58
|
|
|
59
|
+
# Create a new browser context
|
|
60
|
+
# @rbs return: BrowserContext -- New browser context
|
|
61
|
+
def create_browser_context: () -> BrowserContext
|
|
62
|
+
|
|
47
63
|
# Get all pages
|
|
48
64
|
# @rbs return: Array[Page] -- All pages
|
|
49
65
|
def pages: () -> Array[Page]
|
|
50
66
|
|
|
67
|
+
# Get all cookies in the default browser context.
|
|
68
|
+
# @rbs return: Array[Hash[String, untyped]] -- Cookies
|
|
69
|
+
def cookies: () -> Array[Hash[String, untyped]]
|
|
70
|
+
|
|
71
|
+
# Set cookies in the default browser context.
|
|
72
|
+
# @rbs *cookies: Array[Hash[String, untyped]] -- Cookie data
|
|
73
|
+
# @rbs **cookie: untyped -- Single cookie via keyword arguments
|
|
74
|
+
# @rbs return: void
|
|
75
|
+
def set_cookie: (*Array[Hash[String, untyped]] cookies, **untyped cookie) -> void
|
|
76
|
+
|
|
77
|
+
# Delete cookies in the default browser context.
|
|
78
|
+
# @rbs *cookies: Array[Hash[String, untyped]] -- Cookies to delete
|
|
79
|
+
# @rbs **cookie: untyped -- Single cookie via keyword arguments
|
|
80
|
+
# @rbs return: void
|
|
81
|
+
def delete_cookie: (*Array[Hash[String, untyped]] cookies, **untyped cookie) -> void
|
|
82
|
+
|
|
83
|
+
# Delete cookies matching the provided filters in the default browser context.
|
|
84
|
+
# @rbs *filters: Array[Hash[String, untyped]] -- Cookie filters
|
|
85
|
+
# @rbs **filter: untyped -- Single filter via keyword arguments
|
|
86
|
+
# @rbs return: void
|
|
87
|
+
def delete_matching_cookies: (*Array[Hash[String, untyped]] filters, **untyped filter) -> void
|
|
88
|
+
|
|
51
89
|
# Register event handler
|
|
52
90
|
# @rbs event: String | Symbol -- Event name
|
|
53
91
|
# @rbs &block: (untyped) -> void -- Event handler
|
|
@@ -58,9 +96,16 @@ module Puppeteer
|
|
|
58
96
|
# @rbs return: void
|
|
59
97
|
def close: () -> void
|
|
60
98
|
|
|
99
|
+
# Disconnect from the browser (does not close the browser process).
|
|
100
|
+
# @rbs return: void
|
|
101
|
+
def disconnect: () -> void
|
|
102
|
+
|
|
61
103
|
# @rbs return: bool
|
|
62
104
|
def closed?: () -> bool
|
|
63
105
|
|
|
106
|
+
# @rbs return: bool
|
|
107
|
+
def disconnected?: () -> bool
|
|
108
|
+
|
|
64
109
|
# Wait until a target (top-level browsing context) satisfies the predicate.
|
|
65
110
|
# @rbs timeout: Integer? -- Timeout in milliseconds (default: 30000)
|
|
66
111
|
# @rbs &predicate: (BrowserTarget | PageTarget | FrameTarget) -> boolish -- Predicate evaluated against each Target
|
|
@@ -73,6 +118,8 @@ module Puppeteer
|
|
|
73
118
|
|
|
74
119
|
private
|
|
75
120
|
|
|
121
|
+
def debug_error: (untyped error) -> untyped
|
|
122
|
+
|
|
76
123
|
# @rbs &block: (BrowserTarget | PageTarget | FrameTarget) -> void -- Block to yield each target to
|
|
77
124
|
# @rbs return: Enumerator[BrowserTarget | PageTarget | FrameTarget, void] -- Enumerator of targets
|
|
78
125
|
def each_target: () { (BrowserTarget | PageTarget | FrameTarget) -> void } -> Enumerator[BrowserTarget | PageTarget | FrameTarget, void]
|
|
@@ -82,8 +129,8 @@ module Puppeteer
|
|
|
82
129
|
def find_target: (^(BrowserTarget | PageTarget | FrameTarget) -> boolish predicate) -> (BrowserTarget | PageTarget | FrameTarget)?
|
|
83
130
|
|
|
84
131
|
# @rbs user_context: Core::UserContext -- User context to get browser context for
|
|
85
|
-
# @rbs return: BrowserContext
|
|
86
|
-
def browser_context_for: (Core::UserContext user_context) -> BrowserContext
|
|
132
|
+
# @rbs return: BrowserContext -- Browser context
|
|
133
|
+
def browser_context_for: (Core::UserContext user_context) -> BrowserContext
|
|
87
134
|
end
|
|
88
135
|
end
|
|
89
136
|
end
|
|
@@ -5,6 +5,10 @@ module Puppeteer
|
|
|
5
5
|
# BrowserContext represents an isolated browsing session
|
|
6
6
|
# This is a high-level wrapper around Core::UserContext
|
|
7
7
|
class BrowserContext
|
|
8
|
+
# Maps web permission names to protocol permission names
|
|
9
|
+
# Based on Puppeteer's WEB_PERMISSION_TO_PROTOCOL_PERMISSION
|
|
10
|
+
WEB_PERMISSION_TO_PROTOCOL_PERMISSION: untyped
|
|
11
|
+
|
|
8
12
|
attr_reader user_context: Core::UserContext
|
|
9
13
|
|
|
10
14
|
attr_reader browser: Browser
|
|
@@ -22,11 +26,39 @@ module Puppeteer
|
|
|
22
26
|
# @rbs return: Array[Page] -- All pages
|
|
23
27
|
def pages: () -> Array[Page]
|
|
24
28
|
|
|
29
|
+
# Get all cookies in this context.
|
|
30
|
+
# @rbs return: Array[Hash[String, untyped]] -- Cookies
|
|
31
|
+
def cookies: () -> Array[Hash[String, untyped]]
|
|
32
|
+
|
|
33
|
+
# Set cookies in this context.
|
|
34
|
+
# @rbs *cookies: Array[Hash[String, untyped]] -- Cookie data
|
|
35
|
+
# @rbs **cookie: untyped -- Single cookie via keyword arguments
|
|
36
|
+
# @rbs return: void
|
|
37
|
+
def set_cookie: (*Array[Hash[String, untyped]] cookies, **untyped cookie) -> void
|
|
38
|
+
|
|
39
|
+
# Delete cookies in this context.
|
|
40
|
+
# @rbs *cookies: Array[Hash[String, untyped]] -- Cookies to delete
|
|
41
|
+
# @rbs **cookie: untyped -- Single cookie via keyword arguments
|
|
42
|
+
# @rbs return: void
|
|
43
|
+
def delete_cookie: (*Array[Hash[String, untyped]] cookies, **untyped cookie) -> void
|
|
44
|
+
|
|
45
|
+
# Delete cookies matching the provided filters.
|
|
46
|
+
# @rbs *filters: Array[Hash[String, untyped]] -- Cookie filters
|
|
47
|
+
# @rbs **filter: untyped -- Single cookie filter via keyword arguments
|
|
48
|
+
# @rbs return: void
|
|
49
|
+
def delete_matching_cookies: (*Array[Hash[String, untyped]] filters, **untyped filter) -> void
|
|
50
|
+
|
|
25
51
|
# Get or create a Page for the given browsing context
|
|
26
52
|
# @rbs browsing_context: Core::BrowsingContext -- Browsing context
|
|
27
53
|
# @rbs return: Page -- Page instance
|
|
28
54
|
def page_for: (Core::BrowsingContext browsing_context) -> Page
|
|
29
55
|
|
|
56
|
+
# Override permissions for an origin
|
|
57
|
+
# @rbs origin: String -- Origin URL
|
|
58
|
+
# @rbs permissions: Array[String] -- Permissions to grant
|
|
59
|
+
# @rbs return: void
|
|
60
|
+
def override_permissions: (String origin, Array[String] permissions) -> void
|
|
61
|
+
|
|
30
62
|
# Close the browser context
|
|
31
63
|
# @rbs return: void
|
|
32
64
|
def close: () -> void
|
|
@@ -34,6 +66,10 @@ module Puppeteer
|
|
|
34
66
|
# Check if context is closed
|
|
35
67
|
# @rbs return: bool -- Whether the context is closed
|
|
36
68
|
def closed?: () -> bool
|
|
69
|
+
|
|
70
|
+
private
|
|
71
|
+
|
|
72
|
+
def cookie_matches_filter?: (untyped cookie, untyped raw_filter) -> untyped
|
|
37
73
|
end
|
|
38
74
|
end
|
|
39
75
|
end
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Generated from lib/puppeteer/bidi/cookie_utils.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Puppeteer
|
|
4
|
+
module Bidi
|
|
5
|
+
module CookieUtils
|
|
6
|
+
CDP_SPECIFIC_PREFIX: ::String
|
|
7
|
+
|
|
8
|
+
# @rbs cookie: Hash[untyped, untyped] -- Cookie with symbol or string keys
|
|
9
|
+
# @rbs return: Hash[String, untyped] -- Cookie with string keys
|
|
10
|
+
def self.normalize_cookie_input: (Hash[untyped, untyped] cookie) -> Hash[String, untyped]
|
|
11
|
+
|
|
12
|
+
# @rbs bidi_cookie: Hash[String, untyped] -- BiDi cookie
|
|
13
|
+
# @rbs return_composite_partition_key: bool -- Whether to return composite partition key
|
|
14
|
+
# @rbs return: Hash[String, untyped] -- Puppeteer cookie
|
|
15
|
+
def self.bidi_to_puppeteer_cookie: (Hash[String, untyped] bidi_cookie, ?return_composite_partition_key: bool) -> Hash[String, untyped]
|
|
16
|
+
|
|
17
|
+
# @rbs same_site: String? -- BiDi SameSite value
|
|
18
|
+
# @rbs return: String -- Puppeteer SameSite
|
|
19
|
+
def self.convert_cookies_same_site_bidi_to_cdp: (String? same_site) -> String
|
|
20
|
+
|
|
21
|
+
# @rbs same_site: String? -- Puppeteer SameSite
|
|
22
|
+
# @rbs return: String? -- BiDi SameSite
|
|
23
|
+
def self.convert_cookies_same_site_cdp_to_bidi: (String? same_site) -> String?
|
|
24
|
+
|
|
25
|
+
# @rbs expiry: Numeric? -- Cookie expiry
|
|
26
|
+
# @rbs return: Numeric? -- BiDi expiry
|
|
27
|
+
def self.convert_cookies_expiry_cdp_to_bidi: (Numeric? expiry) -> Numeric?
|
|
28
|
+
|
|
29
|
+
# @rbs partition_key: String | Hash[String, untyped] | Hash[Symbol, untyped] | nil -- Partition key
|
|
30
|
+
# @rbs return: String? -- BiDi partition key
|
|
31
|
+
def self.convert_cookies_partition_key_from_puppeteer_to_bidi: (String | Hash[String, untyped] | Hash[Symbol, untyped] | nil partition_key) -> String?
|
|
32
|
+
|
|
33
|
+
# @rbs cookie: Hash[String, untyped] -- Cookie data
|
|
34
|
+
# @rbs *property_names: Array[String] -- Cookie property names
|
|
35
|
+
# @rbs return: Hash[String, untyped] -- CDP-specific properties with goog: prefix
|
|
36
|
+
def self.cdp_specific_cookie_properties_from_puppeteer_to_bidi: (Hash[String, untyped] cookie, *Array[String] property_names) -> Hash[String, untyped]
|
|
37
|
+
|
|
38
|
+
# @rbs cookie: Hash[String, untyped] -- BiDi cookie data
|
|
39
|
+
# @rbs *property_names: Array[String] -- Cookie property names
|
|
40
|
+
# @rbs return: Hash[String, untyped] -- CDP-specific properties
|
|
41
|
+
def self.cdp_specific_cookie_properties_from_bidi: (Hash[String, untyped] cookie, *Array[String] property_names) -> Hash[String, untyped]
|
|
42
|
+
|
|
43
|
+
# @rbs cookie: Hash[String, untyped] -- Puppeteer cookie
|
|
44
|
+
# @rbs normalized_url: URI::Generic -- URL to match
|
|
45
|
+
# @rbs return: bool -- Whether cookie matches URL
|
|
46
|
+
def self.test_url_match_cookie: (Hash[String, untyped] cookie, URI::Generic normalized_url) -> bool
|
|
47
|
+
|
|
48
|
+
# @rbs cookie: Hash[String, untyped] -- Puppeteer cookie
|
|
49
|
+
# @rbs normalized_url: URI::Generic -- URL to match
|
|
50
|
+
# @rbs return: bool -- Whether hostname matches
|
|
51
|
+
def self.test_url_match_cookie_hostname: (Hash[String, untyped] cookie, URI::Generic normalized_url) -> bool
|
|
52
|
+
|
|
53
|
+
# @rbs cookie: Hash[String, untyped] -- Puppeteer cookie
|
|
54
|
+
# @rbs normalized_url: URI::Generic -- URL to match
|
|
55
|
+
# @rbs return: bool -- Whether path matches
|
|
56
|
+
def self.test_url_match_cookie_path: (Hash[String, untyped] cookie, URI::Generic normalized_url) -> bool
|
|
57
|
+
|
|
58
|
+
# @rbs partition_key: untyped -- BiDi partition key
|
|
59
|
+
# @rbs return_composite_partition_key: bool -- Whether to return composite partition key
|
|
60
|
+
# @rbs return: Hash[String, untyped] -- Partition key info
|
|
61
|
+
def self.partition_key_from_bidi: (untyped partition_key, bool return_composite_partition_key) -> Hash[String, untyped]
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
@@ -128,13 +128,18 @@ module Puppeteer
|
|
|
128
128
|
|
|
129
129
|
# Add network intercept
|
|
130
130
|
# @rbs **options: untyped -- Intercept options
|
|
131
|
-
# @rbs return: String -- Intercept ID
|
|
132
|
-
def add_intercept: (**untyped options) -> String
|
|
131
|
+
# @rbs return: Async::Task[String] -- Intercept ID
|
|
132
|
+
def add_intercept: (**untyped options) -> Async::Task[String]
|
|
133
|
+
|
|
134
|
+
# Set extra HTTP headers for this context
|
|
135
|
+
# @rbs headers: Hash[String, String] -- Extra headers
|
|
136
|
+
# @rbs return: Async::Task[untyped]
|
|
137
|
+
def set_extra_http_headers: (Hash[String, String] headers) -> Async::Task[untyped]
|
|
133
138
|
|
|
134
139
|
# Get cookies
|
|
135
140
|
# @rbs **options: untyped -- Cookie filter options
|
|
136
|
-
# @rbs return: Array[Hash[String, untyped]] -- Cookies
|
|
137
|
-
def get_cookies: (**untyped options) -> Array[Hash[String, untyped]]
|
|
141
|
+
# @rbs return: Async::Task[Array[Hash[String, untyped]]] -- Cookies
|
|
142
|
+
def get_cookies: (**untyped options) -> Async::Task[Array[Hash[String, untyped]]]
|
|
138
143
|
|
|
139
144
|
# Set a cookie
|
|
140
145
|
# @rbs cookie: Hash[String, untyped] -- Cookie data
|
|
@@ -143,14 +148,19 @@ module Puppeteer
|
|
|
143
148
|
|
|
144
149
|
# Delete cookies
|
|
145
150
|
# @rbs *cookie_filters: Hash[String, untyped] -- Cookie filters
|
|
146
|
-
# @rbs return:
|
|
147
|
-
def delete_cookie: (*Hash[String, untyped] cookie_filters) ->
|
|
151
|
+
# @rbs return: Async::Task[untyped]
|
|
152
|
+
def delete_cookie: (*Hash[String, untyped] cookie_filters) -> Async::Task[untyped]
|
|
148
153
|
|
|
149
154
|
# Set geolocation override
|
|
150
155
|
# @rbs **options: untyped -- Geolocation options
|
|
151
156
|
# @rbs return: Async::Task[untyped]
|
|
152
157
|
def set_geolocation_override: (**untyped options) -> Async::Task[untyped]
|
|
153
158
|
|
|
159
|
+
# Set user agent override
|
|
160
|
+
# @rbs user_agent: String? -- User agent string or nil to restore original
|
|
161
|
+
# @rbs return: Async::Task[void]
|
|
162
|
+
def set_user_agent: (String? user_agent) -> Async::Task[void]
|
|
163
|
+
|
|
154
164
|
# Set timezone override
|
|
155
165
|
# @rbs timezone_id: String? -- Timezone ID
|
|
156
166
|
# @rbs return: Async::Task[untyped]
|
|
@@ -5,6 +5,8 @@ module Puppeteer
|
|
|
5
5
|
module Core
|
|
6
6
|
# Request represents a network request
|
|
7
7
|
class Request < EventEmitter
|
|
8
|
+
DESTINATION_RESOURCE_TYPES: untyped
|
|
9
|
+
|
|
8
10
|
include Disposable::DisposableMixin
|
|
9
11
|
|
|
10
12
|
# Create a request instance from a beforeRequestSent event
|
|
@@ -79,33 +81,34 @@ module Puppeteer
|
|
|
79
81
|
# @rbs headers: Array[Hash[String, untyped]]? -- Modified headers
|
|
80
82
|
# @rbs cookies: Array[Hash[String, untyped]]? -- Modified cookies
|
|
81
83
|
# @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
|
+
# @rbs return: Async::Task[untyped]
|
|
85
|
+
def continue_request: (?url: String?, ?method: String?, ?headers: Array[Hash[String, untyped]]?, ?cookies: Array[Hash[String, untyped]]?, ?body: Hash[String, untyped]?) -> Async::Task[untyped]
|
|
84
86
|
|
|
85
87
|
# Fail the request
|
|
86
|
-
|
|
88
|
+
# @rbs return: Async::Task[untyped]
|
|
89
|
+
def fail_request: () -> Async::Task[untyped]
|
|
87
90
|
|
|
88
91
|
# Provide a response for the request
|
|
89
92
|
# @rbs status_code: Integer? -- Response status code
|
|
90
93
|
# @rbs reason_phrase: String? -- Response reason phrase
|
|
91
94
|
# @rbs headers: Array[Hash[String, untyped]]? -- Response headers
|
|
92
95
|
# @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
|
|
96
|
+
# @rbs return: Async::Task[untyped]
|
|
97
|
+
def provide_response: (?status_code: Integer?, ?reason_phrase: String?, ?headers: Array[Hash[String, untyped]]?, ?body: Hash[String, untyped]?) -> Async::Task[untyped]
|
|
95
98
|
|
|
96
99
|
# Fetch POST data for the request
|
|
97
|
-
# @rbs return: String? -- POST data
|
|
98
|
-
def fetch_post_data: () -> String?
|
|
100
|
+
# @rbs return: Async::Task[String?] -- POST data
|
|
101
|
+
def fetch_post_data: () -> Async::Task[String?]
|
|
99
102
|
|
|
100
103
|
# Get response content
|
|
101
|
-
# @rbs return: String -- Response content as binary string
|
|
102
|
-
def response_content: () -> String
|
|
104
|
+
# @rbs return: Async::Task[String] -- Response content as binary string
|
|
105
|
+
def response_content: () -> Async::Task[String]
|
|
103
106
|
|
|
104
107
|
# Continue with authentication
|
|
105
108
|
# @rbs action: String -- 'provideCredentials', 'default', or 'cancel'
|
|
106
109
|
# @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
|
|
110
|
+
# @rbs return: Async::Task[untyped]
|
|
111
|
+
def continue_with_auth: (action: String, ?credentials: Hash[String, untyped]?) -> Async::Task[untyped]
|
|
109
112
|
|
|
110
113
|
def perform_dispose: () -> untyped
|
|
111
114
|
|
|
@@ -41,8 +41,8 @@ module Puppeteer
|
|
|
41
41
|
|
|
42
42
|
# Get cookies for this user context
|
|
43
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]]
|
|
44
|
+
# @rbs return: Async::Task[Array[Hash[String, untyped]]] -- Cookies
|
|
45
|
+
def get_cookies: (**untyped options) -> Async::Task[Array[Hash[String, untyped]]]
|
|
46
46
|
|
|
47
47
|
# Set a cookie in this user context
|
|
48
48
|
# @rbs cookie: Hash[String, untyped] -- Cookie data
|
|
@@ -160,6 +160,13 @@ module Puppeteer
|
|
|
160
160
|
# @rbs return: void
|
|
161
161
|
def focus: () -> void
|
|
162
162
|
|
|
163
|
+
# Select options on a <select> element
|
|
164
|
+
# Triggers 'change' and 'input' events once all options are selected.
|
|
165
|
+
# If not a select element, throws an error.
|
|
166
|
+
# @rbs *values: String -- Option values to select
|
|
167
|
+
# @rbs return: Array[String] -- Actually selected option values
|
|
168
|
+
def select: (*String values) -> Array[String]
|
|
169
|
+
|
|
163
170
|
# Hover over the element
|
|
164
171
|
# Scrolls element into view if needed and moves mouse to element center
|
|
165
172
|
# @rbs return: void
|
|
@@ -183,6 +190,19 @@ module Puppeteer
|
|
|
183
190
|
# @rbs return: void
|
|
184
191
|
def scroll_into_view: () -> void
|
|
185
192
|
|
|
193
|
+
# Create a locator based on this element handle.
|
|
194
|
+
# @rbs return: Locator -- Locator instance
|
|
195
|
+
def as_locator: () -> Locator
|
|
196
|
+
|
|
197
|
+
# Take a screenshot of the element.
|
|
198
|
+
# Following Puppeteer's implementation: ElementHandle.screenshot
|
|
199
|
+
# @rbs path: String? -- File path to save screenshot
|
|
200
|
+
# @rbs type: String -- Image type ('png' or 'jpeg')
|
|
201
|
+
# @rbs clip: Hash[Symbol, Numeric]? -- Clip region relative to element
|
|
202
|
+
# @rbs scroll_into_view: bool -- Scroll element into view before screenshot
|
|
203
|
+
# @rbs return: String -- Base64-encoded image data
|
|
204
|
+
def screenshot: (?path: String?, ?type: String, ?clip: Hash[Symbol, Numeric]?, ?scroll_into_view: bool) -> String
|
|
205
|
+
|
|
186
206
|
# Check if element is intersecting the viewport
|
|
187
207
|
# @rbs threshold: Numeric -- Intersection ratio threshold
|
|
188
208
|
# @rbs return: bool -- Whether element intersects viewport
|
|
@@ -230,6 +250,14 @@ module Puppeteer
|
|
|
230
250
|
# @rbs return: bool -- Whether element matches visibility state
|
|
231
251
|
def check_visibility: (bool visible) -> bool
|
|
232
252
|
|
|
253
|
+
# Get bounding box ensuring it's non-empty and visible
|
|
254
|
+
# @rbs return: BoundingBox -- Non-empty bounding box
|
|
255
|
+
def non_empty_visible_bounding_box: () -> BoundingBox
|
|
256
|
+
|
|
257
|
+
# Get top-left corner offset of the element's frame relative to the main frame
|
|
258
|
+
# @rbs return: Hash[Symbol, Numeric]? -- Offset hash or nil if not visible
|
|
259
|
+
def top_left_corner_of_frame: () -> Hash[Symbol, Numeric]?
|
|
260
|
+
|
|
233
261
|
# String representation includes element type
|
|
234
262
|
# @rbs return: String -- String representation
|
|
235
263
|
def to_s: () -> String
|
|
@@ -64,6 +64,12 @@ module Puppeteer
|
|
|
64
64
|
# @rbs return: Array[ElementHandle] -- All matching elements
|
|
65
65
|
def query_selector_all: (String selector) -> Array[ElementHandle]
|
|
66
66
|
|
|
67
|
+
# Create a locator for a selector or function.
|
|
68
|
+
# @rbs selector: String? -- Selector to locate
|
|
69
|
+
# @rbs function: String? -- JavaScript function for function locator
|
|
70
|
+
# @rbs return: Locator -- Locator instance
|
|
71
|
+
def locator: (?String? selector, ?function: String?) -> Locator
|
|
72
|
+
|
|
67
73
|
# Evaluate a function on the first element matching the selector
|
|
68
74
|
# @rbs selector: String -- Selector to query
|
|
69
75
|
# @rbs page_function: String -- JavaScript function to evaluate
|
|
@@ -99,6 +105,13 @@ module Puppeteer
|
|
|
99
105
|
# @rbs return: void
|
|
100
106
|
def hover: (String selector) -> void
|
|
101
107
|
|
|
108
|
+
# Select options on a <select> element matching the selector
|
|
109
|
+
# Triggers 'change' and 'input' events once all options are selected.
|
|
110
|
+
# @rbs selector: String -- Selector for <select> element
|
|
111
|
+
# @rbs *values: String -- Option values to select
|
|
112
|
+
# @rbs return: Array[String] -- Actually selected option values
|
|
113
|
+
def select: (String selector, *String values) -> Array[String]
|
|
114
|
+
|
|
102
115
|
# Get the frame URL
|
|
103
116
|
# @rbs return: String -- Current URL
|
|
104
117
|
def url: () -> String
|
|
@@ -200,6 +213,10 @@ module Puppeteer
|
|
|
200
213
|
# Check if this frame is detached and raise error if so
|
|
201
214
|
# @rbs return: void
|
|
202
215
|
def assert_not_detached: () -> void
|
|
216
|
+
|
|
217
|
+
def navigation_response_for: (untyped navigation) -> untyped
|
|
218
|
+
|
|
219
|
+
def wait_for_request_completion: (untyped request) -> untyped
|
|
203
220
|
end
|
|
204
221
|
end
|
|
205
222
|
end
|