playwright-ruby-client 1.60.0 → 1.61.0
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/documentation/docs/api/api_response.md +18 -0
- data/documentation/docs/api/browser_context.md +6 -0
- data/documentation/docs/api/browser_type.md +1 -0
- data/documentation/docs/api/credentials.md +132 -0
- data/documentation/docs/api/frame.md +4 -4
- data/documentation/docs/api/page.md +12 -2
- data/documentation/docs/api/touchscreen.md +1 -1
- data/documentation/docs/api/web_storage.md +65 -0
- data/documentation/docs/include/api_coverage.md +20 -0
- data/lib/playwright/api_response_impl.rb +8 -0
- data/lib/playwright/channel_owners/browser_context.rb +2 -1
- data/lib/playwright/channel_owners/browser_type.rb +2 -1
- data/lib/playwright/channel_owners/frame.rb +36 -17
- data/lib/playwright/channel_owners/page.rb +12 -2
- data/lib/playwright/connection.rb +7 -1
- data/lib/playwright/credentials_impl.rb +35 -0
- data/lib/playwright/errors.rb +4 -1
- data/lib/playwright/locator_utils.rb +9 -1
- data/lib/playwright/screencast.rb +3 -1
- data/lib/playwright/version.rb +2 -2
- data/lib/playwright/waiter.rb +9 -41
- data/lib/playwright/web_storage_impl.rb +34 -0
- data/lib/playwright_api/api_request_context.rb +6 -6
- data/lib/playwright_api/api_response.rb +12 -0
- data/lib/playwright_api/browser.rb +6 -6
- data/lib/playwright_api/browser_context.rb +23 -16
- data/lib/playwright_api/browser_type.rb +8 -7
- data/lib/playwright_api/cdp_session.rb +6 -6
- data/lib/playwright_api/credentials.rb +120 -0
- data/lib/playwright_api/dialog.rb +6 -6
- data/lib/playwright_api/element_handle.rb +6 -6
- data/lib/playwright_api/frame.rb +14 -14
- data/lib/playwright_api/js_handle.rb +6 -6
- data/lib/playwright_api/locator.rb +5 -5
- data/lib/playwright_api/page.rb +32 -20
- data/lib/playwright_api/playwright.rb +6 -6
- data/lib/playwright_api/request.rb +8 -8
- data/lib/playwright_api/response.rb +6 -6
- data/lib/playwright_api/route.rb +6 -6
- data/lib/playwright_api/touchscreen.rb +1 -1
- data/lib/playwright_api/tracing.rb +6 -6
- data/lib/playwright_api/web_socket.rb +6 -6
- data/lib/playwright_api/web_storage.rb +48 -0
- data/lib/playwright_api/worker.rb +8 -8
- data/sig/playwright.rbs +21 -1
- metadata +8 -2
data/lib/playwright/waiter.rb
CHANGED
|
@@ -12,33 +12,14 @@ module Playwright
|
|
|
12
12
|
@registered_listeners = Set.new
|
|
13
13
|
@listeners_mutex = Mutex.new
|
|
14
14
|
@logs = []
|
|
15
|
-
|
|
15
|
+
send_wait_info(waitId: @wait_id, phase: 'before', event: @event)
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
private def
|
|
19
|
-
@channel.async_send_message_to_server(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"waitId": @wait_id,
|
|
24
|
-
"phase": "before",
|
|
25
|
-
"event": @event,
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
)
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
private def wait_for_event_info_after(error: nil)
|
|
32
|
-
@channel.async_send_message_to_server(
|
|
33
|
-
"waitForEventInfo",
|
|
34
|
-
{
|
|
35
|
-
"info": {
|
|
36
|
-
"waitId": @wait_id,
|
|
37
|
-
"phase": "after",
|
|
38
|
-
"error": error,
|
|
39
|
-
}.compact,
|
|
40
|
-
},
|
|
41
|
-
)
|
|
18
|
+
private def send_wait_info(params)
|
|
19
|
+
@channel.async_send_message_to_server('__waitInfo__', params.compact)
|
|
20
|
+
rescue
|
|
21
|
+
# Fire-and-forget. The server intentionally does not reply and this must
|
|
22
|
+
# not affect the API call that is being waited for.
|
|
42
23
|
end
|
|
43
24
|
|
|
44
25
|
def reject_on_event(emitter, event, error_or_proc, predicate: nil)
|
|
@@ -89,7 +70,7 @@ module Playwright
|
|
|
89
70
|
cleanup
|
|
90
71
|
return if @result.resolved?
|
|
91
72
|
@result.fulfill(result)
|
|
92
|
-
|
|
73
|
+
send_wait_info(waitId: @wait_id, phase: 'after')
|
|
93
74
|
end
|
|
94
75
|
|
|
95
76
|
private def reject(error)
|
|
@@ -98,7 +79,7 @@ module Playwright
|
|
|
98
79
|
klass = error.is_a?(TimeoutError) ? TimeoutError : Error
|
|
99
80
|
ex = klass.new(message: "#{error.message}#{format_log_recording(@logs)}")
|
|
100
81
|
@result.reject(ex)
|
|
101
|
-
|
|
82
|
+
send_wait_info(waitId: @wait_id, phase: 'after', error: ex.message)
|
|
102
83
|
end
|
|
103
84
|
|
|
104
85
|
# @param [Playwright::EventEmitter]
|
|
@@ -135,20 +116,7 @@ module Playwright
|
|
|
135
116
|
|
|
136
117
|
def log(message)
|
|
137
118
|
@logs << message
|
|
138
|
-
|
|
139
|
-
@channel.async_send_message_to_server(
|
|
140
|
-
"waitForEventInfo",
|
|
141
|
-
{
|
|
142
|
-
"info": {
|
|
143
|
-
"waitId": @wait_id,
|
|
144
|
-
"phase": "log",
|
|
145
|
-
"message": message,
|
|
146
|
-
},
|
|
147
|
-
},
|
|
148
|
-
)
|
|
149
|
-
rescue => err
|
|
150
|
-
# ignore
|
|
151
|
-
end
|
|
119
|
+
send_wait_info(waitId: @wait_id, phase: 'log', message: message)
|
|
152
120
|
end
|
|
153
121
|
|
|
154
122
|
# @param logs [Array<String>]
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
module Playwright
|
|
2
|
+
# ref: https://github.com/microsoft/playwright/blob/main/packages/playwright-core/src/client/webStorage.ts
|
|
3
|
+
define_api_implementation :WebStorageImpl do
|
|
4
|
+
# @param page [ChannelOwners::Page]
|
|
5
|
+
# @param kind [String] 'local' or 'session'
|
|
6
|
+
def initialize(page, kind)
|
|
7
|
+
@page = page
|
|
8
|
+
@kind = kind
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def items
|
|
12
|
+
@page.channel.send_message_to_server('webStorageItems', kind: @kind)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def get_item(name)
|
|
16
|
+
@page.channel.send_message_to_server('webStorageGetItem', kind: @kind, name: name)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def set_item(name, value)
|
|
20
|
+
@page.channel.send_message_to_server('webStorageSetItem', kind: @kind, name: name, value: value)
|
|
21
|
+
nil
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def remove_item(name)
|
|
25
|
+
@page.channel.send_message_to_server('webStorageRemoveItem', kind: @kind, name: name)
|
|
26
|
+
nil
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def clear
|
|
30
|
+
@page.channel.send_message_to_server('webStorageClear', kind: @kind)
|
|
31
|
+
nil
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -290,12 +290,6 @@ module Playwright
|
|
|
290
290
|
raise NotImplementedError.new('storage_state is not implemented yet.')
|
|
291
291
|
end
|
|
292
292
|
|
|
293
|
-
# -- inherited from EventEmitter --
|
|
294
|
-
# @nodoc
|
|
295
|
-
def on(event, callback)
|
|
296
|
-
event_emitter_proxy.on(event, callback)
|
|
297
|
-
end
|
|
298
|
-
|
|
299
293
|
# -- inherited from EventEmitter --
|
|
300
294
|
# @nodoc
|
|
301
295
|
def off(event, callback)
|
|
@@ -308,6 +302,12 @@ module Playwright
|
|
|
308
302
|
event_emitter_proxy.once(event, callback)
|
|
309
303
|
end
|
|
310
304
|
|
|
305
|
+
# -- inherited from EventEmitter --
|
|
306
|
+
# @nodoc
|
|
307
|
+
def on(event, callback)
|
|
308
|
+
event_emitter_proxy.on(event, callback)
|
|
309
|
+
end
|
|
310
|
+
|
|
311
311
|
private def event_emitter_proxy
|
|
312
312
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
|
313
313
|
end
|
|
@@ -55,6 +55,18 @@ module Playwright
|
|
|
55
55
|
wrap_impl(@impl.ok)
|
|
56
56
|
end
|
|
57
57
|
|
|
58
|
+
#
|
|
59
|
+
# Returns SSL and other security information. Resolves to `null` for non-HTTPS responses. For redirected requests, returns the information for the last request in the redirect chain.
|
|
60
|
+
def security_details
|
|
61
|
+
wrap_impl(@impl.security_details)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
#
|
|
65
|
+
# Returns the IP address and port of the server. Resolves to `null` if the server address is not available. For redirected requests, returns the information for the last request in the redirect chain.
|
|
66
|
+
def server_addr
|
|
67
|
+
wrap_impl(@impl.server_addr)
|
|
68
|
+
end
|
|
69
|
+
|
|
58
70
|
#
|
|
59
71
|
# Contains the status code of the response (e.g., 200 for a success).
|
|
60
72
|
def status
|
|
@@ -215,12 +215,6 @@ module Playwright
|
|
|
215
215
|
wrap_impl(@impl.version)
|
|
216
216
|
end
|
|
217
217
|
|
|
218
|
-
# -- inherited from EventEmitter --
|
|
219
|
-
# @nodoc
|
|
220
|
-
def on(event, callback)
|
|
221
|
-
event_emitter_proxy.on(event, callback)
|
|
222
|
-
end
|
|
223
|
-
|
|
224
218
|
# -- inherited from EventEmitter --
|
|
225
219
|
# @nodoc
|
|
226
220
|
def off(event, callback)
|
|
@@ -233,6 +227,12 @@ module Playwright
|
|
|
233
227
|
event_emitter_proxy.once(event, callback)
|
|
234
228
|
end
|
|
235
229
|
|
|
230
|
+
# -- inherited from EventEmitter --
|
|
231
|
+
# @nodoc
|
|
232
|
+
def on(event, callback)
|
|
233
|
+
event_emitter_proxy.on(event, callback)
|
|
234
|
+
end
|
|
235
|
+
|
|
236
236
|
private def event_emitter_proxy
|
|
237
237
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
|
238
238
|
end
|
|
@@ -25,6 +25,13 @@ module Playwright
|
|
|
25
25
|
wrap_impl(@impl.clock)
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
+
#
|
|
29
|
+
# Virtual WebAuthn authenticator for this context. Lets tests seed credentials and intercept
|
|
30
|
+
# `navigator.credentials.create()` / `navigator.credentials.get()` ceremonies.
|
|
31
|
+
def credentials # property
|
|
32
|
+
wrap_impl(@impl.credentials)
|
|
33
|
+
end
|
|
34
|
+
|
|
28
35
|
#
|
|
29
36
|
# Debugger allows to pause and resume the execution.
|
|
30
37
|
def debugger # property
|
|
@@ -490,34 +497,28 @@ module Playwright
|
|
|
490
497
|
end
|
|
491
498
|
|
|
492
499
|
# @nodoc
|
|
493
|
-
def
|
|
494
|
-
wrap_impl(@impl.
|
|
495
|
-
end
|
|
496
|
-
|
|
497
|
-
# @nodoc
|
|
498
|
-
def owner_page=(req)
|
|
499
|
-
wrap_impl(@impl.owner_page=(unwrap_impl(req)))
|
|
500
|
+
def browser=(req)
|
|
501
|
+
wrap_impl(@impl.browser=(unwrap_impl(req)))
|
|
500
502
|
end
|
|
501
503
|
|
|
502
504
|
# @nodoc
|
|
503
|
-
def
|
|
504
|
-
wrap_impl(@impl.
|
|
505
|
+
def enable_debug_console!
|
|
506
|
+
wrap_impl(@impl.enable_debug_console!)
|
|
505
507
|
end
|
|
506
508
|
|
|
507
509
|
# @nodoc
|
|
508
|
-
def
|
|
509
|
-
wrap_impl(@impl.
|
|
510
|
+
def pause
|
|
511
|
+
wrap_impl(@impl.pause)
|
|
510
512
|
end
|
|
511
513
|
|
|
512
514
|
# @nodoc
|
|
513
|
-
def
|
|
514
|
-
wrap_impl(@impl.
|
|
515
|
+
def owner_page=(req)
|
|
516
|
+
wrap_impl(@impl.owner_page=(unwrap_impl(req)))
|
|
515
517
|
end
|
|
516
518
|
|
|
517
|
-
# -- inherited from EventEmitter --
|
|
518
519
|
# @nodoc
|
|
519
|
-
def
|
|
520
|
-
|
|
520
|
+
def options=(req)
|
|
521
|
+
wrap_impl(@impl.options=(unwrap_impl(req)))
|
|
521
522
|
end
|
|
522
523
|
|
|
523
524
|
# -- inherited from EventEmitter --
|
|
@@ -532,6 +533,12 @@ module Playwright
|
|
|
532
533
|
event_emitter_proxy.once(event, callback)
|
|
533
534
|
end
|
|
534
535
|
|
|
536
|
+
# -- inherited from EventEmitter --
|
|
537
|
+
# @nodoc
|
|
538
|
+
def on(event, callback)
|
|
539
|
+
event_emitter_proxy.on(event, callback)
|
|
540
|
+
end
|
|
541
|
+
|
|
535
542
|
private def event_emitter_proxy
|
|
536
543
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
|
537
544
|
end
|
|
@@ -51,13 +51,14 @@ module Playwright
|
|
|
51
51
|
# ```
|
|
52
52
|
def connect_over_cdp(
|
|
53
53
|
endpointURL,
|
|
54
|
+
artifactsDir: nil,
|
|
54
55
|
headers: nil,
|
|
55
56
|
isLocal: nil,
|
|
56
57
|
noDefaults: nil,
|
|
57
58
|
slowMo: nil,
|
|
58
59
|
timeout: nil,
|
|
59
60
|
&block)
|
|
60
|
-
wrap_impl(@impl.connect_over_cdp(unwrap_impl(endpointURL), headers: unwrap_impl(headers), isLocal: unwrap_impl(isLocal), noDefaults: unwrap_impl(noDefaults), slowMo: unwrap_impl(slowMo), timeout: unwrap_impl(timeout), &wrap_block_call(block)))
|
|
61
|
+
wrap_impl(@impl.connect_over_cdp(unwrap_impl(endpointURL), artifactsDir: unwrap_impl(artifactsDir), headers: unwrap_impl(headers), isLocal: unwrap_impl(isLocal), noDefaults: unwrap_impl(noDefaults), slowMo: unwrap_impl(slowMo), timeout: unwrap_impl(timeout), &wrap_block_call(block)))
|
|
61
62
|
end
|
|
62
63
|
|
|
63
64
|
#
|
|
@@ -183,12 +184,6 @@ module Playwright
|
|
|
183
184
|
wrap_impl(@impl.name)
|
|
184
185
|
end
|
|
185
186
|
|
|
186
|
-
# -- inherited from EventEmitter --
|
|
187
|
-
# @nodoc
|
|
188
|
-
def on(event, callback)
|
|
189
|
-
event_emitter_proxy.on(event, callback)
|
|
190
|
-
end
|
|
191
|
-
|
|
192
187
|
# -- inherited from EventEmitter --
|
|
193
188
|
# @nodoc
|
|
194
189
|
def off(event, callback)
|
|
@@ -201,6 +196,12 @@ module Playwright
|
|
|
201
196
|
event_emitter_proxy.once(event, callback)
|
|
202
197
|
end
|
|
203
198
|
|
|
199
|
+
# -- inherited from EventEmitter --
|
|
200
|
+
# @nodoc
|
|
201
|
+
def on(event, callback)
|
|
202
|
+
event_emitter_proxy.on(event, callback)
|
|
203
|
+
end
|
|
204
|
+
|
|
204
205
|
private def event_emitter_proxy
|
|
205
206
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
|
206
207
|
end
|
|
@@ -31,12 +31,6 @@ module Playwright
|
|
|
31
31
|
wrap_impl(@impl.send_message(unwrap_impl(method), params: unwrap_impl(params)))
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
-
# -- inherited from EventEmitter --
|
|
35
|
-
# @nodoc
|
|
36
|
-
def on(event, callback)
|
|
37
|
-
event_emitter_proxy.on(event, callback)
|
|
38
|
-
end
|
|
39
|
-
|
|
40
34
|
# -- inherited from EventEmitter --
|
|
41
35
|
# @nodoc
|
|
42
36
|
def off(event, callback)
|
|
@@ -49,6 +43,12 @@ module Playwright
|
|
|
49
43
|
event_emitter_proxy.once(event, callback)
|
|
50
44
|
end
|
|
51
45
|
|
|
46
|
+
# -- inherited from EventEmitter --
|
|
47
|
+
# @nodoc
|
|
48
|
+
def on(event, callback)
|
|
49
|
+
event_emitter_proxy.on(event, callback)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
52
|
private def event_emitter_proxy
|
|
53
53
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
|
54
54
|
end
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
module Playwright
|
|
2
|
+
#
|
|
3
|
+
# `Credentials` is a virtual WebAuthn authenticator scoped to a `BrowserContext`. It lets tests
|
|
4
|
+
# register passkeys and answer `navigator.credentials.create()` / `navigator.credentials.get()`
|
|
5
|
+
# ceremonies in the page, without a real authenticator or hardware security key.
|
|
6
|
+
#
|
|
7
|
+
# There are two common ways to use it:
|
|
8
|
+
#
|
|
9
|
+
# **Usage: seed a known credential**
|
|
10
|
+
#
|
|
11
|
+
# ```python sync
|
|
12
|
+
# context = browser.new_context()
|
|
13
|
+
#
|
|
14
|
+
# # A passkey your backend already provisioned for a test user.
|
|
15
|
+
# context.credentials.create(
|
|
16
|
+
# "example.com",
|
|
17
|
+
# id=known_credential_id, # base64url
|
|
18
|
+
# user_handle=known_user_handle, # base64url
|
|
19
|
+
# private_key=known_private_key, # base64url PKCS#8 (DER)
|
|
20
|
+
# public_key=known_public_key, # base64url SPKI (DER)
|
|
21
|
+
# )
|
|
22
|
+
# context.credentials.install()
|
|
23
|
+
#
|
|
24
|
+
# page = context.new_page()
|
|
25
|
+
# page.goto("https://example.com/login")
|
|
26
|
+
# # The page's navigator.credentials.get() is answered with the seeded passkey.
|
|
27
|
+
# ```
|
|
28
|
+
#
|
|
29
|
+
# **Usage: capture a passkey, then reuse it**
|
|
30
|
+
#
|
|
31
|
+
# ```python sync
|
|
32
|
+
# # setup test: let the app register a passkey, then save it.
|
|
33
|
+
# context = browser.new_context()
|
|
34
|
+
# context.credentials.install()
|
|
35
|
+
#
|
|
36
|
+
# page = context.new_page()
|
|
37
|
+
# page.goto("https://example.com/register")
|
|
38
|
+
# page.get_by_role("button", name="Create a passkey").click()
|
|
39
|
+
#
|
|
40
|
+
# # Read back the passkey the page registered — it includes the private key.
|
|
41
|
+
# [credential] = context.credentials.get(rp_id="example.com")
|
|
42
|
+
# with open("playwright/.auth/passkey.json", "w") as f:
|
|
43
|
+
# json.dump(credential, f)
|
|
44
|
+
# ```
|
|
45
|
+
#
|
|
46
|
+
# ```python sync
|
|
47
|
+
# # later test: seed the captured passkey so the app starts already enrolled.
|
|
48
|
+
# with open("playwright/.auth/passkey.json") as f:
|
|
49
|
+
# credential = json.load(f)
|
|
50
|
+
# context = browser.new_context()
|
|
51
|
+
# context.credentials.create(
|
|
52
|
+
# credential["rpId"],
|
|
53
|
+
# id=credential["id"],
|
|
54
|
+
# user_handle=credential["userHandle"],
|
|
55
|
+
# private_key=credential["privateKey"],
|
|
56
|
+
# public_key=credential["publicKey"],
|
|
57
|
+
# )
|
|
58
|
+
# context.credentials.install()
|
|
59
|
+
#
|
|
60
|
+
# page = context.new_page()
|
|
61
|
+
# page.goto("https://example.com/login")
|
|
62
|
+
# # navigator.credentials.get() resolves the captured passkey — already signed in.
|
|
63
|
+
# ```
|
|
64
|
+
#
|
|
65
|
+
# **Defaults**
|
|
66
|
+
class Credentials < PlaywrightApi
|
|
67
|
+
|
|
68
|
+
#
|
|
69
|
+
# Installs the virtual WebAuthn authenticator into the context, overriding
|
|
70
|
+
# `navigator.credentials.create()` and `navigator.credentials.get()` in all current
|
|
71
|
+
# and future pages. Call this before the page first touches `navigator.credentials`.
|
|
72
|
+
#
|
|
73
|
+
# Required: until [`method: Credentials.install`] is called, no interception is in place and the page sees
|
|
74
|
+
# the platform's native (or absent) WebAuthn behaviour. Seeding credentials with
|
|
75
|
+
# [`method: Credentials.create`] without installing populates the authenticator, but the
|
|
76
|
+
# page will never see those credentials.
|
|
77
|
+
def install
|
|
78
|
+
wrap_impl(@impl.install)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
#
|
|
82
|
+
# Seeds a virtual WebAuthn credential and returns it.
|
|
83
|
+
#
|
|
84
|
+
# With only `rpId`, generates a fresh **ECDSA P-256** keypair, credential id and user handle. The
|
|
85
|
+
# seeded credential is discoverable (resident), so the page can resolve it from both
|
|
86
|
+
# username-then-passkey and usernameless passkey flows. The returned object carries the private and public keys, so it can be persisted to disk and re-seeded in a later test.
|
|
87
|
+
#
|
|
88
|
+
# To **import a known credential**, supply all four of `id`, `userHandle`, `privateKey` and
|
|
89
|
+
# `publicKey` together.
|
|
90
|
+
#
|
|
91
|
+
# Call [`method: Credentials.install`] before navigating to a page that uses WebAuthn.
|
|
92
|
+
def create(
|
|
93
|
+
rpId,
|
|
94
|
+
id: nil,
|
|
95
|
+
privateKey: nil,
|
|
96
|
+
publicKey: nil,
|
|
97
|
+
userHandle: nil)
|
|
98
|
+
wrap_impl(@impl.create(unwrap_impl(rpId), id: unwrap_impl(id), privateKey: unwrap_impl(privateKey), publicKey: unwrap_impl(publicKey), userHandle: unwrap_impl(userHandle)))
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
#
|
|
102
|
+
# Removes a credential from the authenticator by its id. Works for any credential currently held —
|
|
103
|
+
# both those seeded with [`method: Credentials.create`] and those the page registered itself by
|
|
104
|
+
# calling `navigator.credentials.create()`.
|
|
105
|
+
def delete(id)
|
|
106
|
+
wrap_impl(@impl.delete(unwrap_impl(id)))
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
#
|
|
110
|
+
# Returns every credential currently held by the authenticator, optionally filtered by `rpId` or
|
|
111
|
+
# `id`. This includes both credentials seeded with [`method: Credentials.create`] and credentials
|
|
112
|
+
# the page registered itself by calling `navigator.credentials.create()`.
|
|
113
|
+
#
|
|
114
|
+
# Each returned credential includes its private and public keys, so a passkey the app just
|
|
115
|
+
# registered can be saved and re-seeded into a later test with [`method: Credentials.create`] — see the second example in the class overview.
|
|
116
|
+
def get(id: nil, rpId: nil)
|
|
117
|
+
wrap_impl(@impl.get(id: unwrap_impl(id), rpId: unwrap_impl(rpId)))
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
end
|
|
@@ -68,12 +68,6 @@ module Playwright
|
|
|
68
68
|
wrap_impl(@impl.accept_async(promptText: unwrap_impl(promptText)))
|
|
69
69
|
end
|
|
70
70
|
|
|
71
|
-
# -- inherited from EventEmitter --
|
|
72
|
-
# @nodoc
|
|
73
|
-
def on(event, callback)
|
|
74
|
-
event_emitter_proxy.on(event, callback)
|
|
75
|
-
end
|
|
76
|
-
|
|
77
71
|
# -- inherited from EventEmitter --
|
|
78
72
|
# @nodoc
|
|
79
73
|
def off(event, callback)
|
|
@@ -86,6 +80,12 @@ module Playwright
|
|
|
86
80
|
event_emitter_proxy.once(event, callback)
|
|
87
81
|
end
|
|
88
82
|
|
|
83
|
+
# -- inherited from EventEmitter --
|
|
84
|
+
# @nodoc
|
|
85
|
+
def on(event, callback)
|
|
86
|
+
event_emitter_proxy.on(event, callback)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
89
|
private def event_emitter_proxy
|
|
90
90
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
|
91
91
|
end
|
|
@@ -574,12 +574,6 @@ module Playwright
|
|
|
574
574
|
wrap_impl(@impl.wait_for_selector(unwrap_impl(selector), state: unwrap_impl(state), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
|
|
575
575
|
end
|
|
576
576
|
|
|
577
|
-
# -- inherited from EventEmitter --
|
|
578
|
-
# @nodoc
|
|
579
|
-
def on(event, callback)
|
|
580
|
-
event_emitter_proxy.on(event, callback)
|
|
581
|
-
end
|
|
582
|
-
|
|
583
577
|
# -- inherited from EventEmitter --
|
|
584
578
|
# @nodoc
|
|
585
579
|
def off(event, callback)
|
|
@@ -592,6 +586,12 @@ module Playwright
|
|
|
592
586
|
event_emitter_proxy.once(event, callback)
|
|
593
587
|
end
|
|
594
588
|
|
|
589
|
+
# -- inherited from EventEmitter --
|
|
590
|
+
# @nodoc
|
|
591
|
+
def on(event, callback)
|
|
592
|
+
event_emitter_proxy.on(event, callback)
|
|
593
|
+
end
|
|
594
|
+
|
|
595
595
|
private def event_emitter_proxy
|
|
596
596
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
|
597
597
|
end
|
data/lib/playwright_api/frame.rb
CHANGED
|
@@ -255,7 +255,7 @@ module Playwright
|
|
|
255
255
|
# `ElementHandle` instances can be passed as an argument to the [`method: Frame.evaluate`]:
|
|
256
256
|
#
|
|
257
257
|
# ```python sync
|
|
258
|
-
# body_handle = frame.
|
|
258
|
+
# body_handle = frame.evaluate_handle("document.body")
|
|
259
259
|
# html = frame.evaluate("([body, suffix]) => body.innerHTML + suffix", [body_handle, "hello"])
|
|
260
260
|
# body_handle.dispose()
|
|
261
261
|
# ```
|
|
@@ -282,14 +282,14 @@ module Playwright
|
|
|
282
282
|
# A string can also be passed in instead of a function.
|
|
283
283
|
#
|
|
284
284
|
# ```python sync
|
|
285
|
-
# a_handle =
|
|
285
|
+
# a_handle = frame.evaluate_handle("document") # handle for the "document"
|
|
286
286
|
# ```
|
|
287
287
|
#
|
|
288
288
|
# `JSHandle` instances can be passed as an argument to the [`method: Frame.evaluateHandle`]:
|
|
289
289
|
#
|
|
290
290
|
# ```python sync
|
|
291
|
-
# a_handle =
|
|
292
|
-
# result_handle =
|
|
291
|
+
# a_handle = frame.evaluate_handle("document.body")
|
|
292
|
+
# result_handle = frame.evaluate_handle("body => body.innerHTML", a_handle)
|
|
293
293
|
# print(result_handle.json_value())
|
|
294
294
|
# result_handle.dispose()
|
|
295
295
|
# ```
|
|
@@ -1042,13 +1042,13 @@ module Playwright
|
|
|
1042
1042
|
end
|
|
1043
1043
|
|
|
1044
1044
|
# @nodoc
|
|
1045
|
-
def
|
|
1046
|
-
wrap_impl(@impl.
|
|
1045
|
+
def drop(selector, payload, position: nil, strict: nil, timeout: nil)
|
|
1046
|
+
wrap_impl(@impl.drop(unwrap_impl(selector), unwrap_impl(payload), position: unwrap_impl(position), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
|
|
1047
1047
|
end
|
|
1048
1048
|
|
|
1049
1049
|
# @nodoc
|
|
1050
|
-
def
|
|
1051
|
-
wrap_impl(@impl.
|
|
1050
|
+
def detached=(req)
|
|
1051
|
+
wrap_impl(@impl.detached=(unwrap_impl(req)))
|
|
1052
1052
|
end
|
|
1053
1053
|
|
|
1054
1054
|
# @nodoc
|
|
@@ -1066,12 +1066,6 @@ module Playwright
|
|
|
1066
1066
|
wrap_impl(@impl.expect(unwrap_impl(selector), unwrap_impl(expression), unwrap_impl(options), unwrap_impl(title)))
|
|
1067
1067
|
end
|
|
1068
1068
|
|
|
1069
|
-
# -- inherited from EventEmitter --
|
|
1070
|
-
# @nodoc
|
|
1071
|
-
def on(event, callback)
|
|
1072
|
-
event_emitter_proxy.on(event, callback)
|
|
1073
|
-
end
|
|
1074
|
-
|
|
1075
1069
|
# -- inherited from EventEmitter --
|
|
1076
1070
|
# @nodoc
|
|
1077
1071
|
def off(event, callback)
|
|
@@ -1084,6 +1078,12 @@ module Playwright
|
|
|
1084
1078
|
event_emitter_proxy.once(event, callback)
|
|
1085
1079
|
end
|
|
1086
1080
|
|
|
1081
|
+
# -- inherited from EventEmitter --
|
|
1082
|
+
# @nodoc
|
|
1083
|
+
def on(event, callback)
|
|
1084
|
+
event_emitter_proxy.on(event, callback)
|
|
1085
|
+
end
|
|
1086
|
+
|
|
1087
1087
|
private def event_emitter_proxy
|
|
1088
1088
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
|
1089
1089
|
end
|
|
@@ -98,12 +98,6 @@ module Playwright
|
|
|
98
98
|
wrap_impl(@impl.to_s)
|
|
99
99
|
end
|
|
100
100
|
|
|
101
|
-
# -- inherited from EventEmitter --
|
|
102
|
-
# @nodoc
|
|
103
|
-
def on(event, callback)
|
|
104
|
-
event_emitter_proxy.on(event, callback)
|
|
105
|
-
end
|
|
106
|
-
|
|
107
101
|
# -- inherited from EventEmitter --
|
|
108
102
|
# @nodoc
|
|
109
103
|
def off(event, callback)
|
|
@@ -116,6 +110,12 @@ module Playwright
|
|
|
116
110
|
event_emitter_proxy.once(event, callback)
|
|
117
111
|
end
|
|
118
112
|
|
|
113
|
+
# -- inherited from EventEmitter --
|
|
114
|
+
# @nodoc
|
|
115
|
+
def on(event, callback)
|
|
116
|
+
event_emitter_proxy.on(event, callback)
|
|
117
|
+
end
|
|
118
|
+
|
|
119
119
|
private def event_emitter_proxy
|
|
120
120
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
|
121
121
|
end
|
|
@@ -1325,6 +1325,11 @@ module Playwright
|
|
|
1325
1325
|
wrap_impl(@impl.wait_for(state: unwrap_impl(state), timeout: unwrap_impl(timeout)))
|
|
1326
1326
|
end
|
|
1327
1327
|
|
|
1328
|
+
# @nodoc
|
|
1329
|
+
def _assertions(timeout, is_not, message)
|
|
1330
|
+
wrap_impl(@impl._assertions(unwrap_impl(timeout), unwrap_impl(is_not), unwrap_impl(message)))
|
|
1331
|
+
end
|
|
1332
|
+
|
|
1328
1333
|
# @nodoc
|
|
1329
1334
|
def resolve_selector
|
|
1330
1335
|
wrap_impl(@impl.resolve_selector)
|
|
@@ -1335,11 +1340,6 @@ module Playwright
|
|
|
1335
1340
|
wrap_impl(@impl.expect(unwrap_impl(expression), unwrap_impl(options), unwrap_impl(title)))
|
|
1336
1341
|
end
|
|
1337
1342
|
|
|
1338
|
-
# @nodoc
|
|
1339
|
-
def _assertions(timeout, is_not, message)
|
|
1340
|
-
wrap_impl(@impl._assertions(unwrap_impl(timeout), unwrap_impl(is_not), unwrap_impl(message)))
|
|
1341
|
-
end
|
|
1342
|
-
|
|
1343
1343
|
# @nodoc
|
|
1344
1344
|
def to_s
|
|
1345
1345
|
wrap_impl(@impl.to_s)
|