playwright-ruby-client 1.62.0 → 1.64.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.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/documentation/docs/api/api_request_context.md +50 -0
  3. data/documentation/docs/api/browser.md +2 -0
  4. data/documentation/docs/api/browser_context.md +3 -3
  5. data/documentation/docs/api/browser_type.md +1 -0
  6. data/documentation/docs/api/clock.md +1 -0
  7. data/documentation/docs/api/credentials.md +6 -3
  8. data/documentation/docs/api/frame.md +18 -2
  9. data/documentation/docs/api/frame_locator.md +20 -0
  10. data/documentation/docs/api/locator.md +66 -0
  11. data/documentation/docs/api/page.md +44 -2
  12. data/documentation/docs/api/request.md +1 -1
  13. data/documentation/docs/api/response.md +2 -1
  14. data/documentation/docs/api/tracing.md +5 -3
  15. data/documentation/docs/api/web_mcp.md +34 -0
  16. data/documentation/docs/article/guides/playwright_on_alpine_linux.md +1 -1
  17. data/documentation/docs/include/api_coverage.md +13 -0
  18. data/lib/playwright/api_request_impl.rb +3 -1
  19. data/lib/playwright/channel.rb +2 -1
  20. data/lib/playwright/channel_owners/api_request_context.rb +16 -0
  21. data/lib/playwright/channel_owners/browser.rb +1 -0
  22. data/lib/playwright/channel_owners/browser_context.rb +21 -33
  23. data/lib/playwright/channel_owners/frame.rb +6 -5
  24. data/lib/playwright/channel_owners/local_utils.rb +5 -0
  25. data/lib/playwright/channel_owners/page.rb +12 -3
  26. data/lib/playwright/channel_owners/tracing.rb +45 -13
  27. data/lib/playwright/connection.rb +6 -2
  28. data/lib/playwright/credentials_impl.rb +2 -1
  29. data/lib/playwright/errors.rb +4 -1
  30. data/lib/playwright/events.rb +2 -0
  31. data/lib/playwright/frame_locator_impl.rb +20 -5
  32. data/lib/playwright/locator_impl.rb +26 -8
  33. data/lib/playwright/screencast.rb +4 -2
  34. data/lib/playwright/transport.rb +21 -5
  35. data/lib/playwright/utils.rb +32 -0
  36. data/lib/playwright/version.rb +2 -2
  37. data/lib/playwright/web_mcp_impl.rb +21 -0
  38. data/lib/playwright_api/api_request_context.rb +47 -7
  39. data/lib/playwright_api/browser.rb +10 -8
  40. data/lib/playwright_api/browser_context.rb +17 -17
  41. data/lib/playwright_api/browser_type.rb +8 -7
  42. data/lib/playwright_api/cdp_session.rb +6 -6
  43. data/lib/playwright_api/clock.rb +1 -0
  44. data/lib/playwright_api/credentials.rb +7 -4
  45. data/lib/playwright_api/dialog.rb +6 -6
  46. data/lib/playwright_api/element_handle.rb +6 -6
  47. data/lib/playwright_api/frame.rb +33 -16
  48. data/lib/playwright_api/frame_locator.rb +20 -0
  49. data/lib/playwright_api/js_handle.rb +6 -6
  50. data/lib/playwright_api/locator.rb +63 -3
  51. data/lib/playwright_api/page.rb +57 -17
  52. data/lib/playwright_api/playwright.rb +6 -6
  53. data/lib/playwright_api/request.rb +7 -7
  54. data/lib/playwright_api/response.rb +8 -7
  55. data/lib/playwright_api/route.rb +6 -6
  56. data/lib/playwright_api/tracing.rb +12 -10
  57. data/lib/playwright_api/web_mcp.rb +26 -0
  58. data/lib/playwright_api/web_socket.rb +6 -6
  59. data/lib/playwright_api/worker.rb +6 -6
  60. data/sig/playwright.rbs +26 -12
  61. metadata +5 -2
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Playwright
4
- VERSION = '1.62.0'
5
- COMPATIBLE_PLAYWRIGHT_VERSION = '1.62.1'
4
+ VERSION = '1.64.0'
5
+ COMPATIBLE_PLAYWRIGHT_VERSION = '1.64.0'
6
6
  end
@@ -0,0 +1,21 @@
1
+ module Playwright
2
+ # https://github.com/microsoft/playwright/blob/v1.64.0/packages/playwright-core/src/client/webmcp.ts
3
+ define_api_implementation :WebMCPImpl do
4
+ def initialize(frame)
5
+ @frame = frame
6
+ end
7
+
8
+ def tools(timeout: nil)
9
+ @frame.channel.send_message_to_server('webmcpTools', timeout: @frame.send(:_timeout, timeout))
10
+ end
11
+
12
+ def call_tool(name, input: nil, timeout: nil)
13
+ result = @frame.channel.send_message_to_server('webmcpCallTool',
14
+ name: name,
15
+ input: JavaScript::ValueSerializer.new(input).serialize,
16
+ timeout: @frame.send(:_timeout, timeout),
17
+ )
18
+ JavaScript::ValueParser.new(result).parse
19
+ end
20
+ end
21
+ end
@@ -67,10 +67,50 @@ module Playwright
67
67
  # ```
68
68
  class APIRequestContext < PlaywrightApi
69
69
 
70
+ #
71
+ # Tracing recorder for requests made through this API request context.
70
72
  def tracing # property
71
73
  wrap_impl(@impl.tracing)
72
74
  end
73
75
 
76
+ #
77
+ # Adds cookies into this request context. They will be sent with matching subsequent requests. For [`property: BrowserContext.request`]
78
+ # and [`property: Page.request`], this is equivalent to calling [`method: BrowserContext.addCookies`] on the corresponding browser context.
79
+ #
80
+ # **Usage**
81
+ #
82
+ # ```python sync
83
+ # request.add_cookies([cookie_object1, cookie_object2])
84
+ # ```
85
+ def add_cookies(cookies)
86
+ wrap_impl(@impl.add_cookies(unwrap_impl(cookies)))
87
+ end
88
+
89
+ #
90
+ # Removes cookies from this request context. Accepts optional filter. For [`property: BrowserContext.request`]
91
+ # and [`property: Page.request`], this is equivalent to calling [`method: BrowserContext.clearCookies`] on the corresponding browser context.
92
+ #
93
+ # **Usage**
94
+ #
95
+ # ```python sync
96
+ # request.clear_cookies()
97
+ # request.clear_cookies(name="session-id")
98
+ # request.clear_cookies(domain="my-origin.com")
99
+ # request.clear_cookies(path="/api/v1")
100
+ # request.clear_cookies(name="session-id", domain="my-origin.com")
101
+ # ```
102
+ def clear_cookies(domain: nil, name: nil, path: nil)
103
+ wrap_impl(@impl.clear_cookies(domain: unwrap_impl(domain), name: unwrap_impl(name), path: unwrap_impl(path)))
104
+ end
105
+
106
+ #
107
+ # If no URLs are specified, this method returns all cookies. If URLs are specified, only cookies that affect those URLs
108
+ # are returned. For [`property: BrowserContext.request`] and [`property: Page.request`], this is equivalent to calling
109
+ # [`method: BrowserContext.cookies`] on the corresponding browser context.
110
+ def cookies(urls: nil)
111
+ wrap_impl(@impl.cookies(urls: unwrap_impl(urls)))
112
+ end
113
+
74
114
  #
75
115
  # Sends HTTP(S) [DELETE](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/DELETE) request and returns its response.
76
116
  # The method will populate request cookies from the context and update
@@ -286,26 +326,26 @@ module Playwright
286
326
 
287
327
  #
288
328
  # Returns storage state for this request context, contains current cookies and local storage snapshot if it was passed to the constructor.
289
- def storage_state(indexedDB: nil, path: nil)
329
+ def storage_state(indexedDB: nil, opfs: nil, path: nil)
290
330
  raise NotImplementedError.new('storage_state is not implemented yet.')
291
331
  end
292
332
 
293
333
  # -- inherited from EventEmitter --
294
334
  # @nodoc
295
- def once(event, callback)
296
- event_emitter_proxy.once(event, callback)
335
+ def off(event, callback)
336
+ event_emitter_proxy.off(event, callback)
297
337
  end
298
338
 
299
339
  # -- inherited from EventEmitter --
300
340
  # @nodoc
301
- def on(event, callback)
302
- event_emitter_proxy.on(event, callback)
341
+ def once(event, callback)
342
+ event_emitter_proxy.once(event, callback)
303
343
  end
304
344
 
305
345
  # -- inherited from EventEmitter --
306
346
  # @nodoc
307
- def off(event, callback)
308
- event_emitter_proxy.off(event, callback)
347
+ def on(event, callback)
348
+ event_emitter_proxy.on(event, callback)
309
349
  end
310
350
 
311
351
  private def event_emitter_proxy
@@ -113,6 +113,7 @@ module Playwright
113
113
  record_har_path: nil,
114
114
  record_har_url_filter: nil,
115
115
  record_video_dir: nil,
116
+ record_video_fps: nil,
116
117
  record_video_size: nil,
117
118
  reducedMotion: nil,
118
119
  screen: nil,
@@ -123,7 +124,7 @@ module Playwright
123
124
  userAgent: nil,
124
125
  viewport: nil,
125
126
  &block)
126
- wrap_impl(@impl.new_context(acceptDownloads: unwrap_impl(acceptDownloads), baseURL: unwrap_impl(baseURL), bypassCSP: unwrap_impl(bypassCSP), clientCertificates: unwrap_impl(clientCertificates), colorScheme: unwrap_impl(colorScheme), contrast: unwrap_impl(contrast), deviceScaleFactor: unwrap_impl(deviceScaleFactor), extraHTTPHeaders: unwrap_impl(extraHTTPHeaders), forcedColors: unwrap_impl(forcedColors), geolocation: unwrap_impl(geolocation), hasTouch: unwrap_impl(hasTouch), httpCredentials: unwrap_impl(httpCredentials), ignoreHTTPSErrors: unwrap_impl(ignoreHTTPSErrors), isMobile: unwrap_impl(isMobile), javaScriptEnabled: unwrap_impl(javaScriptEnabled), locale: unwrap_impl(locale), noViewport: unwrap_impl(noViewport), offline: unwrap_impl(offline), permissions: unwrap_impl(permissions), proxy: unwrap_impl(proxy), record_har_content: unwrap_impl(record_har_content), record_har_mode: unwrap_impl(record_har_mode), record_har_omit_content: unwrap_impl(record_har_omit_content), record_har_path: unwrap_impl(record_har_path), record_har_url_filter: unwrap_impl(record_har_url_filter), record_video_dir: unwrap_impl(record_video_dir), record_video_size: unwrap_impl(record_video_size), reducedMotion: unwrap_impl(reducedMotion), screen: unwrap_impl(screen), serviceWorkers: unwrap_impl(serviceWorkers), storageState: unwrap_impl(storageState), strictSelectors: unwrap_impl(strictSelectors), timezoneId: unwrap_impl(timezoneId), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
127
+ wrap_impl(@impl.new_context(acceptDownloads: unwrap_impl(acceptDownloads), baseURL: unwrap_impl(baseURL), bypassCSP: unwrap_impl(bypassCSP), clientCertificates: unwrap_impl(clientCertificates), colorScheme: unwrap_impl(colorScheme), contrast: unwrap_impl(contrast), deviceScaleFactor: unwrap_impl(deviceScaleFactor), extraHTTPHeaders: unwrap_impl(extraHTTPHeaders), forcedColors: unwrap_impl(forcedColors), geolocation: unwrap_impl(geolocation), hasTouch: unwrap_impl(hasTouch), httpCredentials: unwrap_impl(httpCredentials), ignoreHTTPSErrors: unwrap_impl(ignoreHTTPSErrors), isMobile: unwrap_impl(isMobile), javaScriptEnabled: unwrap_impl(javaScriptEnabled), locale: unwrap_impl(locale), noViewport: unwrap_impl(noViewport), offline: unwrap_impl(offline), permissions: unwrap_impl(permissions), proxy: unwrap_impl(proxy), record_har_content: unwrap_impl(record_har_content), record_har_mode: unwrap_impl(record_har_mode), record_har_omit_content: unwrap_impl(record_har_omit_content), record_har_path: unwrap_impl(record_har_path), record_har_url_filter: unwrap_impl(record_har_url_filter), record_video_dir: unwrap_impl(record_video_dir), record_video_fps: unwrap_impl(record_video_fps), record_video_size: unwrap_impl(record_video_size), reducedMotion: unwrap_impl(reducedMotion), screen: unwrap_impl(screen), serviceWorkers: unwrap_impl(serviceWorkers), storageState: unwrap_impl(storageState), strictSelectors: unwrap_impl(strictSelectors), timezoneId: unwrap_impl(timezoneId), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
127
128
  end
128
129
 
129
130
  #
@@ -159,6 +160,7 @@ module Playwright
159
160
  record_har_path: nil,
160
161
  record_har_url_filter: nil,
161
162
  record_video_dir: nil,
163
+ record_video_fps: nil,
162
164
  record_video_size: nil,
163
165
  reducedMotion: nil,
164
166
  screen: nil,
@@ -169,7 +171,7 @@ module Playwright
169
171
  userAgent: nil,
170
172
  viewport: nil,
171
173
  &block)
172
- wrap_impl(@impl.new_page(acceptDownloads: unwrap_impl(acceptDownloads), baseURL: unwrap_impl(baseURL), bypassCSP: unwrap_impl(bypassCSP), clientCertificates: unwrap_impl(clientCertificates), colorScheme: unwrap_impl(colorScheme), contrast: unwrap_impl(contrast), deviceScaleFactor: unwrap_impl(deviceScaleFactor), extraHTTPHeaders: unwrap_impl(extraHTTPHeaders), forcedColors: unwrap_impl(forcedColors), geolocation: unwrap_impl(geolocation), hasTouch: unwrap_impl(hasTouch), httpCredentials: unwrap_impl(httpCredentials), ignoreHTTPSErrors: unwrap_impl(ignoreHTTPSErrors), isMobile: unwrap_impl(isMobile), javaScriptEnabled: unwrap_impl(javaScriptEnabled), locale: unwrap_impl(locale), noViewport: unwrap_impl(noViewport), offline: unwrap_impl(offline), permissions: unwrap_impl(permissions), proxy: unwrap_impl(proxy), record_har_content: unwrap_impl(record_har_content), record_har_mode: unwrap_impl(record_har_mode), record_har_omit_content: unwrap_impl(record_har_omit_content), record_har_path: unwrap_impl(record_har_path), record_har_url_filter: unwrap_impl(record_har_url_filter), record_video_dir: unwrap_impl(record_video_dir), record_video_size: unwrap_impl(record_video_size), reducedMotion: unwrap_impl(reducedMotion), screen: unwrap_impl(screen), serviceWorkers: unwrap_impl(serviceWorkers), storageState: unwrap_impl(storageState), strictSelectors: unwrap_impl(strictSelectors), timezoneId: unwrap_impl(timezoneId), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
174
+ wrap_impl(@impl.new_page(acceptDownloads: unwrap_impl(acceptDownloads), baseURL: unwrap_impl(baseURL), bypassCSP: unwrap_impl(bypassCSP), clientCertificates: unwrap_impl(clientCertificates), colorScheme: unwrap_impl(colorScheme), contrast: unwrap_impl(contrast), deviceScaleFactor: unwrap_impl(deviceScaleFactor), extraHTTPHeaders: unwrap_impl(extraHTTPHeaders), forcedColors: unwrap_impl(forcedColors), geolocation: unwrap_impl(geolocation), hasTouch: unwrap_impl(hasTouch), httpCredentials: unwrap_impl(httpCredentials), ignoreHTTPSErrors: unwrap_impl(ignoreHTTPSErrors), isMobile: unwrap_impl(isMobile), javaScriptEnabled: unwrap_impl(javaScriptEnabled), locale: unwrap_impl(locale), noViewport: unwrap_impl(noViewport), offline: unwrap_impl(offline), permissions: unwrap_impl(permissions), proxy: unwrap_impl(proxy), record_har_content: unwrap_impl(record_har_content), record_har_mode: unwrap_impl(record_har_mode), record_har_omit_content: unwrap_impl(record_har_omit_content), record_har_path: unwrap_impl(record_har_path), record_har_url_filter: unwrap_impl(record_har_url_filter), record_video_dir: unwrap_impl(record_video_dir), record_video_fps: unwrap_impl(record_video_fps), record_video_size: unwrap_impl(record_video_size), reducedMotion: unwrap_impl(reducedMotion), screen: unwrap_impl(screen), serviceWorkers: unwrap_impl(serviceWorkers), storageState: unwrap_impl(storageState), strictSelectors: unwrap_impl(strictSelectors), timezoneId: unwrap_impl(timezoneId), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
173
175
  end
174
176
 
175
177
  #
@@ -217,20 +219,20 @@ module Playwright
217
219
 
218
220
  # -- inherited from EventEmitter --
219
221
  # @nodoc
220
- def once(event, callback)
221
- event_emitter_proxy.once(event, callback)
222
+ def off(event, callback)
223
+ event_emitter_proxy.off(event, callback)
222
224
  end
223
225
 
224
226
  # -- inherited from EventEmitter --
225
227
  # @nodoc
226
- def on(event, callback)
227
- event_emitter_proxy.on(event, callback)
228
+ def once(event, callback)
229
+ event_emitter_proxy.once(event, callback)
228
230
  end
229
231
 
230
232
  # -- inherited from EventEmitter --
231
233
  # @nodoc
232
- def off(event, callback)
233
- event_emitter_proxy.off(event, callback)
234
+ def on(event, callback)
235
+ event_emitter_proxy.on(event, callback)
234
236
  end
235
237
 
236
238
  private def event_emitter_proxy
@@ -423,13 +423,13 @@ module Playwright
423
423
  alias_method :offline=, :set_offline
424
424
 
425
425
  #
426
- # Returns storage state for this browser context, contains current cookies, local storage snapshot, IndexedDB snapshot and virtual WebAuthn credentials.
427
- def storage_state(credentials: nil, indexedDB: nil, path: nil)
428
- wrap_impl(@impl.storage_state(credentials: unwrap_impl(credentials), indexedDB: unwrap_impl(indexedDB), path: unwrap_impl(path)))
426
+ # Returns storage state for this browser context, contains current cookies, local storage snapshot, IndexedDB snapshot, origin private file system snapshot and virtual WebAuthn credentials.
427
+ def storage_state(credentials: nil, indexedDB: nil, opfs: nil, path: nil)
428
+ wrap_impl(@impl.storage_state(credentials: unwrap_impl(credentials), indexedDB: unwrap_impl(indexedDB), opfs: unwrap_impl(opfs), path: unwrap_impl(path)))
429
429
  end
430
430
 
431
431
  #
432
- # Clears the existing cookies, local storage, IndexedDB entries and virtual WebAuthn credentials, and sets the new storage
432
+ # Clears the existing cookies, local storage, IndexedDB entries, origin private file system entries and virtual WebAuthn credentials, and sets the new storage
433
433
  # state. When the storage state contains credentials, the virtual WebAuthn authenticator is installed (equivalent to
434
434
  # [`method: Credentials.install`]), preventing all real authenticators from working in this context.
435
435
  #
@@ -498,6 +498,16 @@ module Playwright
498
498
  raise NotImplementedError.new('wait_for_event is not implemented yet.')
499
499
  end
500
500
 
501
+ # @nodoc
502
+ def owner_page=(req)
503
+ wrap_impl(@impl.owner_page=(unwrap_impl(req)))
504
+ end
505
+
506
+ # @nodoc
507
+ def options=(req)
508
+ wrap_impl(@impl.options=(unwrap_impl(req)))
509
+ end
510
+
501
511
  # @nodoc
502
512
  def browser=(req)
503
513
  wrap_impl(@impl.browser=(unwrap_impl(req)))
@@ -513,14 +523,10 @@ module Playwright
513
523
  wrap_impl(@impl.pause)
514
524
  end
515
525
 
526
+ # -- inherited from EventEmitter --
516
527
  # @nodoc
517
- def options=(req)
518
- wrap_impl(@impl.options=(unwrap_impl(req)))
519
- end
520
-
521
- # @nodoc
522
- def owner_page=(req)
523
- wrap_impl(@impl.owner_page=(unwrap_impl(req)))
528
+ def off(event, callback)
529
+ event_emitter_proxy.off(event, callback)
524
530
  end
525
531
 
526
532
  # -- inherited from EventEmitter --
@@ -535,12 +541,6 @@ module Playwright
535
541
  event_emitter_proxy.on(event, callback)
536
542
  end
537
543
 
538
- # -- inherited from EventEmitter --
539
- # @nodoc
540
- def off(event, callback)
541
- event_emitter_proxy.off(event, callback)
542
- end
543
-
544
544
  private def event_emitter_proxy
545
545
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
546
546
  end
@@ -165,6 +165,7 @@ module Playwright
165
165
  record_har_path: nil,
166
166
  record_har_url_filter: nil,
167
167
  record_video_dir: nil,
168
+ record_video_fps: nil,
168
169
  record_video_size: nil,
169
170
  reducedMotion: nil,
170
171
  screen: nil,
@@ -177,7 +178,7 @@ module Playwright
177
178
  userAgent: nil,
178
179
  viewport: nil,
179
180
  &block)
180
- wrap_impl(@impl.launch_persistent_context(unwrap_impl(userDataDir), acceptDownloads: unwrap_impl(acceptDownloads), args: unwrap_impl(args), artifactsDir: unwrap_impl(artifactsDir), baseURL: unwrap_impl(baseURL), bypassCSP: unwrap_impl(bypassCSP), channel: unwrap_impl(channel), chromiumSandbox: unwrap_impl(chromiumSandbox), clientCertificates: unwrap_impl(clientCertificates), colorScheme: unwrap_impl(colorScheme), contrast: unwrap_impl(contrast), deviceScaleFactor: unwrap_impl(deviceScaleFactor), downloadsPath: unwrap_impl(downloadsPath), env: unwrap_impl(env), executablePath: unwrap_impl(executablePath), extraHTTPHeaders: unwrap_impl(extraHTTPHeaders), firefoxUserPrefs: unwrap_impl(firefoxUserPrefs), forcedColors: unwrap_impl(forcedColors), geolocation: unwrap_impl(geolocation), handleSIGHUP: unwrap_impl(handleSIGHUP), handleSIGINT: unwrap_impl(handleSIGINT), handleSIGTERM: unwrap_impl(handleSIGTERM), hasTouch: unwrap_impl(hasTouch), headless: unwrap_impl(headless), httpCredentials: unwrap_impl(httpCredentials), ignoreDefaultArgs: unwrap_impl(ignoreDefaultArgs), ignoreHTTPSErrors: unwrap_impl(ignoreHTTPSErrors), isMobile: unwrap_impl(isMobile), javaScriptEnabled: unwrap_impl(javaScriptEnabled), locale: unwrap_impl(locale), noViewport: unwrap_impl(noViewport), offline: unwrap_impl(offline), permissions: unwrap_impl(permissions), proxy: unwrap_impl(proxy), record_har_content: unwrap_impl(record_har_content), record_har_mode: unwrap_impl(record_har_mode), record_har_omit_content: unwrap_impl(record_har_omit_content), record_har_path: unwrap_impl(record_har_path), record_har_url_filter: unwrap_impl(record_har_url_filter), record_video_dir: unwrap_impl(record_video_dir), record_video_size: unwrap_impl(record_video_size), reducedMotion: unwrap_impl(reducedMotion), screen: unwrap_impl(screen), serviceWorkers: unwrap_impl(serviceWorkers), slowMo: unwrap_impl(slowMo), strictSelectors: unwrap_impl(strictSelectors), timeout: unwrap_impl(timeout), timezoneId: unwrap_impl(timezoneId), tracesDir: unwrap_impl(tracesDir), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
181
+ wrap_impl(@impl.launch_persistent_context(unwrap_impl(userDataDir), acceptDownloads: unwrap_impl(acceptDownloads), args: unwrap_impl(args), artifactsDir: unwrap_impl(artifactsDir), baseURL: unwrap_impl(baseURL), bypassCSP: unwrap_impl(bypassCSP), channel: unwrap_impl(channel), chromiumSandbox: unwrap_impl(chromiumSandbox), clientCertificates: unwrap_impl(clientCertificates), colorScheme: unwrap_impl(colorScheme), contrast: unwrap_impl(contrast), deviceScaleFactor: unwrap_impl(deviceScaleFactor), downloadsPath: unwrap_impl(downloadsPath), env: unwrap_impl(env), executablePath: unwrap_impl(executablePath), extraHTTPHeaders: unwrap_impl(extraHTTPHeaders), firefoxUserPrefs: unwrap_impl(firefoxUserPrefs), forcedColors: unwrap_impl(forcedColors), geolocation: unwrap_impl(geolocation), handleSIGHUP: unwrap_impl(handleSIGHUP), handleSIGINT: unwrap_impl(handleSIGINT), handleSIGTERM: unwrap_impl(handleSIGTERM), hasTouch: unwrap_impl(hasTouch), headless: unwrap_impl(headless), httpCredentials: unwrap_impl(httpCredentials), ignoreDefaultArgs: unwrap_impl(ignoreDefaultArgs), ignoreHTTPSErrors: unwrap_impl(ignoreHTTPSErrors), isMobile: unwrap_impl(isMobile), javaScriptEnabled: unwrap_impl(javaScriptEnabled), locale: unwrap_impl(locale), noViewport: unwrap_impl(noViewport), offline: unwrap_impl(offline), permissions: unwrap_impl(permissions), proxy: unwrap_impl(proxy), record_har_content: unwrap_impl(record_har_content), record_har_mode: unwrap_impl(record_har_mode), record_har_omit_content: unwrap_impl(record_har_omit_content), record_har_path: unwrap_impl(record_har_path), record_har_url_filter: unwrap_impl(record_har_url_filter), record_video_dir: unwrap_impl(record_video_dir), record_video_fps: unwrap_impl(record_video_fps), record_video_size: unwrap_impl(record_video_size), reducedMotion: unwrap_impl(reducedMotion), screen: unwrap_impl(screen), serviceWorkers: unwrap_impl(serviceWorkers), slowMo: unwrap_impl(slowMo), strictSelectors: unwrap_impl(strictSelectors), timeout: unwrap_impl(timeout), timezoneId: unwrap_impl(timezoneId), tracesDir: unwrap_impl(tracesDir), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
181
182
  end
182
183
 
183
184
  #
@@ -188,20 +189,20 @@ module Playwright
188
189
 
189
190
  # -- inherited from EventEmitter --
190
191
  # @nodoc
191
- def once(event, callback)
192
- event_emitter_proxy.once(event, callback)
192
+ def off(event, callback)
193
+ event_emitter_proxy.off(event, callback)
193
194
  end
194
195
 
195
196
  # -- inherited from EventEmitter --
196
197
  # @nodoc
197
- def on(event, callback)
198
- event_emitter_proxy.on(event, callback)
198
+ def once(event, callback)
199
+ event_emitter_proxy.once(event, callback)
199
200
  end
200
201
 
201
202
  # -- inherited from EventEmitter --
202
203
  # @nodoc
203
- def off(event, callback)
204
- event_emitter_proxy.off(event, callback)
204
+ def on(event, callback)
205
+ event_emitter_proxy.on(event, callback)
205
206
  end
206
207
 
207
208
  private def event_emitter_proxy
@@ -33,20 +33,20 @@ module Playwright
33
33
 
34
34
  # -- inherited from EventEmitter --
35
35
  # @nodoc
36
- def once(event, callback)
37
- event_emitter_proxy.once(event, callback)
36
+ def off(event, callback)
37
+ event_emitter_proxy.off(event, callback)
38
38
  end
39
39
 
40
40
  # -- inherited from EventEmitter --
41
41
  # @nodoc
42
- def on(event, callback)
43
- event_emitter_proxy.on(event, callback)
42
+ def once(event, callback)
43
+ event_emitter_proxy.once(event, callback)
44
44
  end
45
45
 
46
46
  # -- inherited from EventEmitter --
47
47
  # @nodoc
48
- def off(event, callback)
49
- event_emitter_proxy.off(event, callback)
48
+ def on(event, callback)
49
+ event_emitter_proxy.on(event, callback)
50
50
  end
51
51
 
52
52
  private def event_emitter_proxy
@@ -23,6 +23,7 @@ module Playwright
23
23
  #
24
24
  # Install fake implementations for the following time-related functions:
25
25
  # - `Date`
26
+ # - `Temporal.Now`
26
27
  # - `setTimeout`
27
28
  # - `clearTimeout`
28
29
  # - `setInterval`
@@ -54,6 +54,7 @@ module Playwright
54
54
  # user_handle=credential["userHandle"],
55
55
  # private_key=credential["privateKey"],
56
56
  # public_key=credential["publicKey"],
57
+ # sign_count=credential["signCount"],
57
58
  # )
58
59
  # context.credentials.install()
59
60
  #
@@ -64,7 +65,7 @@ module Playwright
64
65
  #
65
66
  # **Usage: save credentials in the storage state, restore later**
66
67
  #
67
- # See [authentication guide](../auth.md) for examples of using saving and resotring the storage state.
68
+ # See [authentication guide](../auth.md) for examples of using saving and restoring the storage state.
68
69
  #
69
70
  # **Defaults**
70
71
  class Credentials < PlaywrightApi
@@ -90,7 +91,8 @@ module Playwright
90
91
  # 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.
91
92
  #
92
93
  # To **import a known credential**, supply all four of `id`, `userHandle`, `privateKey` and
93
- # `publicKey` together.
94
+ # `publicKey` together. Pass `signCount` as well to continue from the
95
+ # signature counter the relying party has already seen.
94
96
  #
95
97
  # Call [`method: Credentials.install`] before navigating to a page that uses WebAuthn.
96
98
  def create(
@@ -98,8 +100,9 @@ module Playwright
98
100
  id: nil,
99
101
  privateKey: nil,
100
102
  publicKey: nil,
103
+ signCount: nil,
101
104
  userHandle: nil)
102
- wrap_impl(@impl.create(unwrap_impl(rpId), id: unwrap_impl(id), privateKey: unwrap_impl(privateKey), publicKey: unwrap_impl(publicKey), userHandle: unwrap_impl(userHandle)))
105
+ wrap_impl(@impl.create(unwrap_impl(rpId), id: unwrap_impl(id), privateKey: unwrap_impl(privateKey), publicKey: unwrap_impl(publicKey), signCount: unwrap_impl(signCount), userHandle: unwrap_impl(userHandle)))
103
106
  end
104
107
 
105
108
  #
@@ -115,7 +118,7 @@ module Playwright
115
118
  # `id`. This includes both credentials seeded with [`method: Credentials.create`] and credentials
116
119
  # the page registered itself by calling `navigator.credentials.create()`.
117
120
  #
118
- # Each returned credential includes its private and public keys, so a passkey the app just
121
+ # Each returned credential includes its private and public keys and the current signature counter, so a passkey the app just
119
122
  # registered can be saved and re-seeded into a later test with [`method: Credentials.create`] — see the second example in the class overview.
120
123
  def get(id: nil, rpId: nil)
121
124
  wrap_impl(@impl.get(id: unwrap_impl(id), rpId: unwrap_impl(rpId)))
@@ -70,20 +70,20 @@ module Playwright
70
70
 
71
71
  # -- inherited from EventEmitter --
72
72
  # @nodoc
73
- def once(event, callback)
74
- event_emitter_proxy.once(event, callback)
73
+ def off(event, callback)
74
+ event_emitter_proxy.off(event, callback)
75
75
  end
76
76
 
77
77
  # -- inherited from EventEmitter --
78
78
  # @nodoc
79
- def on(event, callback)
80
- event_emitter_proxy.on(event, callback)
79
+ def once(event, callback)
80
+ event_emitter_proxy.once(event, callback)
81
81
  end
82
82
 
83
83
  # -- inherited from EventEmitter --
84
84
  # @nodoc
85
- def off(event, callback)
86
- event_emitter_proxy.off(event, callback)
85
+ def on(event, callback)
86
+ event_emitter_proxy.on(event, callback)
87
87
  end
88
88
 
89
89
  private def event_emitter_proxy
@@ -583,20 +583,20 @@ module Playwright
583
583
 
584
584
  # -- inherited from EventEmitter --
585
585
  # @nodoc
586
- def once(event, callback)
587
- event_emitter_proxy.once(event, callback)
586
+ def off(event, callback)
587
+ event_emitter_proxy.off(event, callback)
588
588
  end
589
589
 
590
590
  # -- inherited from EventEmitter --
591
591
  # @nodoc
592
- def on(event, callback)
593
- event_emitter_proxy.on(event, callback)
592
+ def once(event, callback)
593
+ event_emitter_proxy.once(event, callback)
594
594
  end
595
595
 
596
596
  # -- inherited from EventEmitter --
597
597
  # @nodoc
598
- def off(event, callback)
599
- event_emitter_proxy.off(event, callback)
598
+ def on(event, callback)
599
+ event_emitter_proxy.on(event, callback)
600
600
  end
601
601
 
602
602
  private def event_emitter_proxy
@@ -31,6 +31,12 @@ module Playwright
31
31
  # ```
32
32
  class Frame < PlaywrightApi
33
33
 
34
+ #
35
+ # Tools that the frame registers through the experimental `WebMCP` browser API. See `WebMCP` for details.
36
+ def webmcp # property
37
+ wrap_impl(@impl.webmcp)
38
+ end
39
+
34
40
  #
35
41
  # Returns the added tag when the script's onload fires or when the script content was injected into frame.
36
42
  #
@@ -103,8 +109,8 @@ module Playwright
103
109
 
104
110
  #
105
111
  # Gets the full HTML contents of the frame, including the doctype.
106
- def content
107
- wrap_impl(@impl.content)
112
+ def content(includeShadow: nil)
113
+ wrap_impl(@impl.content(includeShadow: unwrap_impl(includeShadow)))
108
114
  end
109
115
 
110
116
  #
@@ -347,6 +353,10 @@ module Playwright
347
353
  # When working with iframes, you can create a frame locator that will enter the iframe and allow selecting elements
348
354
  # in that iframe.
349
355
  #
356
+ # When called without `selector`, the search starts in this frame or in any of the iframes inside it,
357
+ # so that you don't need to locate each iframe first. Note that the rest of the locator is resolved inside a single
358
+ # frame, just like any other locator. If it matches elements inside multiple frames, an error is thrown.
359
+ #
350
360
  # **Usage**
351
361
  #
352
362
  # Following snippet locates element with text "Submit" in the iframe with id `my-frame`, like `<iframe id="my-frame">`:
@@ -355,7 +365,14 @@ module Playwright
355
365
  # locator = frame.frame_locator("#my-iframe").get_by_text("Submit")
356
366
  # locator.click()
357
367
  # ```
358
- def frame_locator(selector)
368
+ #
369
+ # Following snippet locates a button, either in the frame or in one of the iframes inside it:
370
+ #
371
+ # ```python sync
372
+ # locator = frame.frame_locator().get_by_role("button")
373
+ # locator.click()
374
+ # ```
375
+ def frame_locator(selector = nil)
359
376
  wrap_impl(@impl.frame_locator(unwrap_impl(selector)))
360
377
  end
361
378
 
@@ -1054,6 +1071,16 @@ module Playwright
1054
1071
  wrap_impl(@impl.drop(unwrap_impl(selector), unwrap_impl(payload), position: unwrap_impl(position), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
1055
1072
  end
1056
1073
 
1074
+ # @nodoc
1075
+ def detached=(req)
1076
+ wrap_impl(@impl.detached=(unwrap_impl(req)))
1077
+ end
1078
+
1079
+ # @nodoc
1080
+ def highlight(selector, style: nil)
1081
+ wrap_impl(@impl.highlight(unwrap_impl(selector), style: unwrap_impl(style)))
1082
+ end
1083
+
1057
1084
  # @nodoc
1058
1085
  def hide_highlight(selector)
1059
1086
  wrap_impl(@impl.hide_highlight(unwrap_impl(selector)))
@@ -1064,14 +1091,10 @@ module Playwright
1064
1091
  wrap_impl(@impl.expect(unwrap_impl(selector), unwrap_impl(expression), unwrap_impl(options), unwrap_impl(title)))
1065
1092
  end
1066
1093
 
1094
+ # -- inherited from EventEmitter --
1067
1095
  # @nodoc
1068
- def detached=(req)
1069
- wrap_impl(@impl.detached=(unwrap_impl(req)))
1070
- end
1071
-
1072
- # @nodoc
1073
- def highlight(selector, style: nil)
1074
- wrap_impl(@impl.highlight(unwrap_impl(selector), style: unwrap_impl(style)))
1096
+ def off(event, callback)
1097
+ event_emitter_proxy.off(event, callback)
1075
1098
  end
1076
1099
 
1077
1100
  # -- inherited from EventEmitter --
@@ -1086,12 +1109,6 @@ module Playwright
1086
1109
  event_emitter_proxy.on(event, callback)
1087
1110
  end
1088
1111
 
1089
- # -- inherited from EventEmitter --
1090
- # @nodoc
1091
- def off(event, callback)
1092
- event_emitter_proxy.off(event, callback)
1093
- end
1094
-
1095
1112
  private def event_emitter_proxy
1096
1113
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
1097
1114
  end
@@ -19,6 +19,26 @@ module Playwright
19
19
  # page.locator('.result-frame').first.content_frame.get_by_role('button').click()
20
20
  # ```
21
21
  #
22
+ # **Any frame**
23
+ #
24
+ # Calling [`method: Page.frameLocator`] or [`method: Frame.frameLocator`] without a selector creates a frame locator that
25
+ # starts the search in any frame of the subtree - so that you don't
26
+ # need to locate the iframe first.
27
+ #
28
+ # ```python sync
29
+ # # Finds the button in any frame on the page:
30
+ # page.frame_locator().get_by_role("button").click()
31
+ #
32
+ # # Finds the iframe with id "my-frame" anywhere on the page, and clicks the button inside it:
33
+ # page.frame_locator().locator("#my-frame").content_frame.get_by_role("button").click()
34
+ # ```
35
+ #
36
+ # Only the start of the search is affected - the rest of the locator is resolved inside a single frame, just like any
37
+ # other locator. Following the strictness rules above, an error is thrown when elements are matched in multiple frames.
38
+ #
39
+ # Such a frame locator does not point to a particular `iframe`, so [`method: FrameLocator.owner`],
40
+ # [`method: FrameLocator.first`], [`method: FrameLocator.last`] and [`method: FrameLocator.nth`] are not supported on it.
41
+ #
22
42
  # **Converting Locator to FrameLocator**
23
43
  #
24
44
  # If you have a `Locator` object pointing to an `iframe` it can be converted to `FrameLocator` using [`method: Locator.contentFrame`].
@@ -100,20 +100,20 @@ module Playwright
100
100
 
101
101
  # -- inherited from EventEmitter --
102
102
  # @nodoc
103
- def once(event, callback)
104
- event_emitter_proxy.once(event, callback)
103
+ def off(event, callback)
104
+ event_emitter_proxy.off(event, callback)
105
105
  end
106
106
 
107
107
  # -- inherited from EventEmitter --
108
108
  # @nodoc
109
- def on(event, callback)
110
- event_emitter_proxy.on(event, callback)
109
+ def once(event, callback)
110
+ event_emitter_proxy.once(event, callback)
111
111
  end
112
112
 
113
113
  # -- inherited from EventEmitter --
114
114
  # @nodoc
115
- def off(event, callback)
116
- event_emitter_proxy.off(event, callback)
115
+ def on(event, callback)
116
+ event_emitter_proxy.on(event, callback)
117
117
  end
118
118
 
119
119
  private def event_emitter_proxy