playwright-ruby-client 1.57.0 → 1.59.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 (76) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +7 -7
  3. data/documentation/docs/api/browser_context.md +26 -0
  4. data/documentation/docs/api/browser_type.md +3 -2
  5. data/documentation/docs/api/console_message.md +9 -0
  6. data/documentation/docs/api/frame.md +2 -2
  7. data/documentation/docs/api/frame_locator.md +2 -2
  8. data/documentation/docs/api/locator.md +17 -4
  9. data/documentation/docs/api/locator_assertions.md +1 -1
  10. data/documentation/docs/api/page.md +68 -5
  11. data/documentation/docs/api/request.md +13 -0
  12. data/documentation/docs/api/response.md +9 -0
  13. data/documentation/docs/api/route.md +4 -1
  14. data/documentation/docs/api/tracing.md +1 -0
  15. data/documentation/docs/article/getting_started.md +1 -1
  16. data/documentation/docs/article/guides/inspector.md +1 -1
  17. data/documentation/docs/article/guides/launch_browser.md +5 -5
  18. data/documentation/docs/article/guides/rails_integration.md +3 -3
  19. data/documentation/docs/article/guides/rails_integration_with_null_driver.md +46 -0
  20. data/documentation/docs/article/guides/recording_video.md +2 -2
  21. data/documentation/docs/article/guides/semi_automation.md +1 -1
  22. data/documentation/docs/include/api_coverage.md +16 -0
  23. data/lib/playwright/channel_owners/api_request_context.rb +24 -2
  24. data/lib/playwright/channel_owners/binding_call.rb +37 -3
  25. data/lib/playwright/channel_owners/browser_context.rb +24 -4
  26. data/lib/playwright/channel_owners/browser_type.rb +2 -1
  27. data/lib/playwright/channel_owners/debugger.rb +4 -0
  28. data/lib/playwright/channel_owners/dialog.rb +3 -1
  29. data/lib/playwright/channel_owners/disposable.rb +9 -0
  30. data/lib/playwright/channel_owners/overlay.rb +4 -0
  31. data/lib/playwright/channel_owners/page.rb +58 -32
  32. data/lib/playwright/channel_owners/request.rb +8 -0
  33. data/lib/playwright/channel_owners/response.rb +5 -0
  34. data/lib/playwright/channel_owners/stream.rb +4 -0
  35. data/lib/playwright/channel_owners/tracing.rb +17 -7
  36. data/lib/playwright/channel_owners/web_socket.rb +14 -0
  37. data/lib/playwright/connection.rb +25 -20
  38. data/lib/playwright/console_message_impl.rb +4 -0
  39. data/lib/playwright/disposable.rb +11 -0
  40. data/lib/playwright/har_router.rb +16 -1
  41. data/lib/playwright/javascript/value_serializer.rb +2 -1
  42. data/lib/playwright/locator_assertions_impl.rb +1 -1
  43. data/lib/playwright/locator_impl.rb +19 -3
  44. data/lib/playwright/page_assertions_impl.rb +1 -1
  45. data/lib/playwright/screencast.rb +91 -0
  46. data/lib/playwright/utils.rb +19 -0
  47. data/lib/playwright/version.rb +2 -2
  48. data/lib/playwright/video.rb +6 -4
  49. data/lib/playwright/waiter.rb +24 -6
  50. data/lib/playwright.rb +2 -0
  51. data/lib/playwright_api/android.rb +7 -7
  52. data/lib/playwright_api/android_device.rb +8 -8
  53. data/lib/playwright_api/api_request_context.rb +6 -6
  54. data/lib/playwright_api/browser.rb +18 -6
  55. data/lib/playwright_api/browser_context.rb +32 -6
  56. data/lib/playwright_api/browser_type.rb +13 -12
  57. data/lib/playwright_api/cdp_session.rb +6 -6
  58. data/lib/playwright_api/console_message.rb +6 -0
  59. data/lib/playwright_api/dialog.rb +6 -6
  60. data/lib/playwright_api/element_handle.rb +6 -6
  61. data/lib/playwright_api/frame.rb +8 -8
  62. data/lib/playwright_api/frame_locator.rb +2 -2
  63. data/lib/playwright_api/js_handle.rb +6 -6
  64. data/lib/playwright_api/locator.rb +19 -9
  65. data/lib/playwright_api/locator_assertions.rb +1 -1
  66. data/lib/playwright_api/page.rb +72 -23
  67. data/lib/playwright_api/playwright.rb +6 -6
  68. data/lib/playwright_api/request.rb +28 -6
  69. data/lib/playwright_api/response.rb +12 -6
  70. data/lib/playwright_api/route.rb +10 -7
  71. data/lib/playwright_api/tracing.rb +8 -7
  72. data/lib/playwright_api/web_socket.rb +6 -6
  73. data/lib/playwright_api/worker.rb +6 -6
  74. data/playwright.gemspec +9 -1
  75. data/sig/playwright.rbs +30 -17
  76. metadata +35 -2
@@ -25,6 +25,12 @@ module Playwright
25
25
  wrap_impl(@impl.clock)
26
26
  end
27
27
 
28
+ #
29
+ # Debugger allows to pause and resume the execution.
30
+ def debugger # property
31
+ raise NotImplementedError.new('debugger is not implemented yet.')
32
+ end
33
+
28
34
  #
29
35
  # API testing helper associated with this context. Requests made with this API will use context cookies.
30
36
  def request # property
@@ -226,6 +232,12 @@ module Playwright
226
232
  wrap_impl(@impl.grant_permissions(unwrap_impl(permissions), origin: unwrap_impl(origin)))
227
233
  end
228
234
 
235
+ #
236
+ # Indicates that the browser context is in the process of closing or has already been closed.
237
+ def closed?
238
+ wrap_impl(@impl.closed?)
239
+ end
240
+
229
241
  #
230
242
  # **NOTE**: CDP sessions are only supported on Chromium-based browsers.
231
243
  #
@@ -409,6 +421,20 @@ module Playwright
409
421
  wrap_impl(@impl.storage_state(indexedDB: unwrap_impl(indexedDB), path: unwrap_impl(path)))
410
422
  end
411
423
 
424
+ #
425
+ # Clears the existing cookies, local storage and IndexedDB entries for all origins and sets the new storage state.
426
+ #
427
+ # **Usage**
428
+ #
429
+ # ```python sync
430
+ # # Load storage state from a file and apply it to the context.
431
+ # context.set_storage_state("state.json")
432
+ # ```
433
+ def set_storage_state(storageState)
434
+ wrap_impl(@impl.set_storage_state(unwrap_impl(storageState)))
435
+ end
436
+ alias_method :storage_state=, :set_storage_state
437
+
412
438
  #
413
439
  # Removes all routes created with [`method: BrowserContext.route`] and [`method: BrowserContext.routeFromHAR`].
414
440
  def unroute_all(behavior: nil)
@@ -488,12 +514,6 @@ module Playwright
488
514
  wrap_impl(@impl.browser=(unwrap_impl(req)))
489
515
  end
490
516
 
491
- # -- inherited from EventEmitter --
492
- # @nodoc
493
- def once(event, callback)
494
- event_emitter_proxy.once(event, callback)
495
- end
496
-
497
517
  # -- inherited from EventEmitter --
498
518
  # @nodoc
499
519
  def on(event, callback)
@@ -506,6 +526,12 @@ module Playwright
506
526
  event_emitter_proxy.off(event, callback)
507
527
  end
508
528
 
529
+ # -- inherited from EventEmitter --
530
+ # @nodoc
531
+ def once(event, callback)
532
+ event_emitter_proxy.once(event, callback)
533
+ end
534
+
509
535
  private def event_emitter_proxy
510
536
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
511
537
  end
@@ -24,7 +24,7 @@ module Playwright
24
24
  #
25
25
  # **NOTE**: The major and minor version of the Playwright instance that connects needs to match the version of Playwright that launches the browser (1.2.3 → is compatible with 1.2.x).
26
26
  def connect(
27
- wsEndpoint,
27
+ endpoint,
28
28
  exposeNetwork: nil,
29
29
  headers: nil,
30
30
  slowMo: nil,
@@ -51,10 +51,11 @@ module Playwright
51
51
  def connect_over_cdp(
52
52
  endpointURL,
53
53
  headers: nil,
54
+ isLocal: nil,
54
55
  slowMo: nil,
55
56
  timeout: nil,
56
57
  &block)
57
- wrap_impl(@impl.connect_over_cdp(unwrap_impl(endpointURL), headers: unwrap_impl(headers), slowMo: unwrap_impl(slowMo), timeout: unwrap_impl(timeout), &wrap_block_call(block)))
58
+ wrap_impl(@impl.connect_over_cdp(unwrap_impl(endpointURL), headers: unwrap_impl(headers), isLocal: unwrap_impl(isLocal), slowMo: unwrap_impl(slowMo), timeout: unwrap_impl(timeout), &wrap_block_call(block)))
58
59
  end
59
60
 
60
61
  #
@@ -93,9 +94,9 @@ module Playwright
93
94
  # describes some differences for Linux users.
94
95
  def launch(
95
96
  args: nil,
97
+ artifactsDir: nil,
96
98
  channel: nil,
97
99
  chromiumSandbox: nil,
98
- devtools: nil,
99
100
  downloadsPath: nil,
100
101
  env: nil,
101
102
  executablePath: nil,
@@ -110,7 +111,7 @@ module Playwright
110
111
  timeout: nil,
111
112
  tracesDir: nil,
112
113
  &block)
113
- wrap_impl(@impl.launch(args: unwrap_impl(args), channel: unwrap_impl(channel), chromiumSandbox: unwrap_impl(chromiumSandbox), devtools: unwrap_impl(devtools), downloadsPath: unwrap_impl(downloadsPath), env: unwrap_impl(env), executablePath: unwrap_impl(executablePath), firefoxUserPrefs: unwrap_impl(firefoxUserPrefs), handleSIGHUP: unwrap_impl(handleSIGHUP), handleSIGINT: unwrap_impl(handleSIGINT), handleSIGTERM: unwrap_impl(handleSIGTERM), headless: unwrap_impl(headless), ignoreDefaultArgs: unwrap_impl(ignoreDefaultArgs), proxy: unwrap_impl(proxy), slowMo: unwrap_impl(slowMo), timeout: unwrap_impl(timeout), tracesDir: unwrap_impl(tracesDir), &wrap_block_call(block)))
114
+ wrap_impl(@impl.launch(args: unwrap_impl(args), artifactsDir: unwrap_impl(artifactsDir), channel: unwrap_impl(channel), chromiumSandbox: unwrap_impl(chromiumSandbox), downloadsPath: unwrap_impl(downloadsPath), env: unwrap_impl(env), executablePath: unwrap_impl(executablePath), firefoxUserPrefs: unwrap_impl(firefoxUserPrefs), handleSIGHUP: unwrap_impl(handleSIGHUP), handleSIGINT: unwrap_impl(handleSIGINT), handleSIGTERM: unwrap_impl(handleSIGTERM), headless: unwrap_impl(headless), ignoreDefaultArgs: unwrap_impl(ignoreDefaultArgs), proxy: unwrap_impl(proxy), slowMo: unwrap_impl(slowMo), timeout: unwrap_impl(timeout), tracesDir: unwrap_impl(tracesDir), &wrap_block_call(block)))
114
115
  end
115
116
 
116
117
  #
@@ -122,6 +123,7 @@ module Playwright
122
123
  userDataDir,
123
124
  acceptDownloads: nil,
124
125
  args: nil,
126
+ artifactsDir: nil,
125
127
  baseURL: nil,
126
128
  bypassCSP: nil,
127
129
  channel: nil,
@@ -130,7 +132,6 @@ module Playwright
130
132
  colorScheme: nil,
131
133
  contrast: nil,
132
134
  deviceScaleFactor: nil,
133
- devtools: nil,
134
135
  downloadsPath: nil,
135
136
  env: nil,
136
137
  executablePath: nil,
@@ -171,7 +172,7 @@ module Playwright
171
172
  userAgent: nil,
172
173
  viewport: nil,
173
174
  &block)
174
- wrap_impl(@impl.launch_persistent_context(unwrap_impl(userDataDir), acceptDownloads: unwrap_impl(acceptDownloads), args: unwrap_impl(args), 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), devtools: unwrap_impl(devtools), 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)))
175
+ 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)))
175
176
  end
176
177
 
177
178
  #
@@ -180,12 +181,6 @@ module Playwright
180
181
  wrap_impl(@impl.name)
181
182
  end
182
183
 
183
- # -- inherited from EventEmitter --
184
- # @nodoc
185
- def once(event, callback)
186
- event_emitter_proxy.once(event, callback)
187
- end
188
-
189
184
  # -- inherited from EventEmitter --
190
185
  # @nodoc
191
186
  def on(event, callback)
@@ -198,6 +193,12 @@ module Playwright
198
193
  event_emitter_proxy.off(event, callback)
199
194
  end
200
195
 
196
+ # -- inherited from EventEmitter --
197
+ # @nodoc
198
+ def once(event, callback)
199
+ event_emitter_proxy.once(event, callback)
200
+ end
201
+
201
202
  private def event_emitter_proxy
202
203
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
203
204
  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 once(event, callback)
37
- event_emitter_proxy.once(event, callback)
38
- end
39
-
40
34
  # -- inherited from EventEmitter --
41
35
  # @nodoc
42
36
  def on(event, callback)
@@ -49,6 +43,12 @@ module Playwright
49
43
  event_emitter_proxy.off(event, callback)
50
44
  end
51
45
 
46
+ # -- inherited from EventEmitter --
47
+ # @nodoc
48
+ def once(event, callback)
49
+ event_emitter_proxy.once(event, callback)
50
+ end
51
+
52
52
  private def event_emitter_proxy
53
53
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
54
54
  end
@@ -45,6 +45,12 @@ module Playwright
45
45
  wrap_impl(@impl.text)
46
46
  end
47
47
 
48
+ #
49
+ # The timestamp of the console message in milliseconds since the Unix epoch.
50
+ def timestamp
51
+ wrap_impl(@impl.timestamp)
52
+ end
53
+
48
54
  def type
49
55
  wrap_impl(@impl.type)
50
56
  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 once(event, callback)
74
- event_emitter_proxy.once(event, callback)
75
- end
76
-
77
71
  # -- inherited from EventEmitter --
78
72
  # @nodoc
79
73
  def on(event, callback)
@@ -86,6 +80,12 @@ module Playwright
86
80
  event_emitter_proxy.off(event, callback)
87
81
  end
88
82
 
83
+ # -- inherited from EventEmitter --
84
+ # @nodoc
85
+ def once(event, callback)
86
+ event_emitter_proxy.once(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 once(event, callback)
580
- event_emitter_proxy.once(event, callback)
581
- end
582
-
583
577
  # -- inherited from EventEmitter --
584
578
  # @nodoc
585
579
  def on(event, callback)
@@ -592,6 +586,12 @@ module Playwright
592
586
  event_emitter_proxy.off(event, callback)
593
587
  end
594
588
 
589
+ # -- inherited from EventEmitter --
590
+ # @nodoc
591
+ def once(event, callback)
592
+ event_emitter_proxy.once(event, callback)
593
+ end
594
+
595
595
  private def event_emitter_proxy
596
596
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
597
597
  end
@@ -436,7 +436,7 @@ module Playwright
436
436
  # <button>Submit</button>
437
437
  # ```
438
438
  #
439
- # You can locate each element by it's implicit role:
439
+ # You can locate each element by its implicit role:
440
440
  #
441
441
  # ```python sync
442
442
  # expect(page.get_by_role("heading", name="Sign up")).to_be_visible()
@@ -476,7 +476,7 @@ module Playwright
476
476
  # <button data-testid="directions">Itinéraire</button>
477
477
  # ```
478
478
  #
479
- # You can locate the element by it's test id:
479
+ # You can locate the element by its test id:
480
480
  #
481
481
  # ```python sync
482
482
  # page.get_by_test_id("directions").click()
@@ -1055,12 +1055,6 @@ module Playwright
1055
1055
  wrap_impl(@impl.detached=(unwrap_impl(req)))
1056
1056
  end
1057
1057
 
1058
- # -- inherited from EventEmitter --
1059
- # @nodoc
1060
- def once(event, callback)
1061
- event_emitter_proxy.once(event, callback)
1062
- end
1063
-
1064
1058
  # -- inherited from EventEmitter --
1065
1059
  # @nodoc
1066
1060
  def on(event, callback)
@@ -1073,6 +1067,12 @@ module Playwright
1073
1067
  event_emitter_proxy.off(event, callback)
1074
1068
  end
1075
1069
 
1070
+ # -- inherited from EventEmitter --
1071
+ # @nodoc
1072
+ def once(event, callback)
1073
+ event_emitter_proxy.once(event, callback)
1074
+ end
1075
+
1076
1076
  private def event_emitter_proxy
1077
1077
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
1078
1078
  end
@@ -118,7 +118,7 @@ module Playwright
118
118
  # <button>Submit</button>
119
119
  # ```
120
120
  #
121
- # You can locate each element by it's implicit role:
121
+ # You can locate each element by its implicit role:
122
122
  #
123
123
  # ```python sync
124
124
  # expect(page.get_by_role("heading", name="Sign up")).to_be_visible()
@@ -158,7 +158,7 @@ module Playwright
158
158
  # <button data-testid="directions">Itinéraire</button>
159
159
  # ```
160
160
  #
161
- # You can locate the element by it's test id:
161
+ # You can locate the element by its test id:
162
162
  #
163
163
  # ```python sync
164
164
  # page.get_by_test_id("directions").click()
@@ -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 once(event, callback)
104
- event_emitter_proxy.once(event, callback)
105
- end
106
-
107
101
  # -- inherited from EventEmitter --
108
102
  # @nodoc
109
103
  def on(event, callback)
@@ -116,6 +110,12 @@ module Playwright
116
110
  event_emitter_proxy.off(event, callback)
117
111
  end
118
112
 
113
+ # -- inherited from EventEmitter --
114
+ # @nodoc
115
+ def once(event, callback)
116
+ event_emitter_proxy.once(event, callback)
117
+ end
118
+
119
119
  private def event_emitter_proxy
120
120
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
121
121
  end
@@ -103,8 +103,11 @@ module Playwright
103
103
  # - listitem:
104
104
  # - link "About"
105
105
  # ```
106
- def aria_snapshot(timeout: nil)
107
- wrap_impl(@impl.aria_snapshot(timeout: unwrap_impl(timeout)))
106
+ #
107
+ # An AI-optimized snapshot, controlled by `mode`, is different from a default snapshot:
108
+ # 1. Includes element references `[ref=e2]`. 2. Does not wait for an element matching the locator, and throws when no elements match. 3. Includes snapshots of `<iframe>`s inside the target.
109
+ def aria_snapshot(depth: nil, mode: nil, timeout: nil)
110
+ wrap_impl(@impl.aria_snapshot(depth: unwrap_impl(depth), mode: unwrap_impl(mode), timeout: unwrap_impl(timeout)))
108
111
  end
109
112
 
110
113
  #
@@ -291,7 +294,7 @@ module Playwright
291
294
  end
292
295
 
293
296
  #
294
- # Returns locator description previously set with [`method: Locator.describe`]. Returns `null` if no custom description has been set. Prefer `Locator.toString()` for a human-readable representation, as it uses the description when available.
297
+ # Returns locator description previously set with [`method: Locator.describe`]. Returns `null` if no custom description has been set.
295
298
  #
296
299
  # **Usage**
297
300
  #
@@ -628,7 +631,7 @@ module Playwright
628
631
  # <button>Submit</button>
629
632
  # ```
630
633
  #
631
- # You can locate each element by it's implicit role:
634
+ # You can locate each element by its implicit role:
632
635
  #
633
636
  # ```python sync
634
637
  # expect(page.get_by_role("heading", name="Sign up")).to_be_visible()
@@ -668,7 +671,7 @@ module Playwright
668
671
  # <button data-testid="directions">Itinéraire</button>
669
672
  # ```
670
673
  #
671
- # You can locate the element by it's test id:
674
+ # You can locate the element by its test id:
672
675
  #
673
676
  # ```python sync
674
677
  # page.get_by_test_id("directions").click()
@@ -921,6 +924,13 @@ module Playwright
921
924
  wrap_impl(@impl.locator(unwrap_impl(selectorOrLocator), has: unwrap_impl(has), hasNot: unwrap_impl(hasNot), hasNotText: unwrap_impl(hasNotText), hasText: unwrap_impl(hasText)))
922
925
  end
923
926
 
927
+ #
928
+ # Returns a new locator that uses best practices for referencing the matched element, prioritizing test ids,
929
+ # aria roles, and other user-facing attributes over CSS selectors. This is useful for converting implementation-detail selectors into more resilient, human-readable locators.
930
+ def normalize
931
+ wrap_impl(@impl.normalize)
932
+ end
933
+
924
934
  #
925
935
  # Returns locator to the n-th matching element. It's zero based, `nth(0)` selects the first element.
926
936
  #
@@ -1287,13 +1297,13 @@ module Playwright
1287
1297
  end
1288
1298
 
1289
1299
  # @nodoc
1290
- def expect(expression, options, title)
1291
- wrap_impl(@impl.expect(unwrap_impl(expression), unwrap_impl(options), unwrap_impl(title)))
1300
+ def resolve_selector
1301
+ wrap_impl(@impl.resolve_selector)
1292
1302
  end
1293
1303
 
1294
1304
  # @nodoc
1295
- def resolve_selector
1296
- wrap_impl(@impl.resolve_selector)
1305
+ def expect(expression, options, title)
1306
+ wrap_impl(@impl.expect(unwrap_impl(expression), unwrap_impl(options), unwrap_impl(title)))
1297
1307
  end
1298
1308
 
1299
1309
  # @nodoc
@@ -413,7 +413,7 @@ module Playwright
413
413
  # from playwright.sync_api import expect
414
414
  #
415
415
  # # ✓ Contains the right items in the right order
416
- # expect(page.locator("ul > li")).to_contain_text(["Text 1", "Text 3", "Text 4"])
416
+ # expect(page.locator("ul > li")).to_contain_text(["Text 1", "Text 3"])
417
417
  #
418
418
  # # ✖ Wrong order
419
419
  # expect(page.locator("ul > li")).to_contain_text(["Text 3", "Text 2"])
@@ -64,6 +64,14 @@ module Playwright
64
64
  wrap_impl(@impl.request)
65
65
  end
66
66
 
67
+ #
68
+ # `Screencast` object associated with this page.
69
+ #
70
+ # **Usage**
71
+ def screencast # property
72
+ wrap_impl(@impl.screencast)
73
+ end
74
+
67
75
  def touchscreen # property
68
76
  wrap_impl(@impl.touchscreen)
69
77
  end
@@ -111,6 +119,13 @@ module Playwright
111
119
  wrap_impl(@impl.bring_to_front)
112
120
  end
113
121
 
122
+ #
123
+ # Cancels an ongoing [`method: Page.pickLocator`] call by deactivating pick locator mode.
124
+ # If no pick locator mode is active, this method is a no-op.
125
+ def cancel_pick_locator
126
+ wrap_impl(@impl.cancel_pick_locator)
127
+ end
128
+
114
129
  #
115
130
  # This method checks an element matching `selector` by performing the following steps:
116
131
  # 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
@@ -661,7 +676,7 @@ module Playwright
661
676
  # <button>Submit</button>
662
677
  # ```
663
678
  #
664
- # You can locate each element by it's implicit role:
679
+ # You can locate each element by its implicit role:
665
680
  #
666
681
  # ```python sync
667
682
  # expect(page.get_by_role("heading", name="Sign up")).to_be_visible()
@@ -701,7 +716,7 @@ module Playwright
701
716
  # <button data-testid="directions">Itinéraire</button>
702
717
  # ```
703
718
  #
704
- # You can locate the element by it's test id:
719
+ # You can locate the element by its test id:
705
720
  #
706
721
  # ```python sync
707
722
  # page.get_by_test_id("directions").click()
@@ -919,16 +934,28 @@ module Playwright
919
934
  wrap_impl(@impl.visible?(unwrap_impl(selector), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
920
935
  end
921
936
 
937
+ #
938
+ # Clears all stored console messages from this page. Subsequent calls to [`method: Page.consoleMessages`] will only return messages logged after the clear.
939
+ def clear_console_messages
940
+ wrap_impl(@impl.clear_console_messages)
941
+ end
942
+
943
+ #
944
+ # Clears all stored page errors from this page. Subsequent calls to [`method: Page.pageErrors`] will only return errors thrown after the clear.
945
+ def clear_page_errors
946
+ wrap_impl(@impl.clear_page_errors)
947
+ end
948
+
922
949
  #
923
950
  # Returns up to (currently) 200 last console messages from this page. See [`event: Page.console`] for more details.
924
- def console_messages
925
- wrap_impl(@impl.console_messages)
951
+ def console_messages(filter: nil)
952
+ wrap_impl(@impl.console_messages(filter: unwrap_impl(filter)))
926
953
  end
927
954
 
928
955
  #
929
956
  # Returns up to (currently) 200 last page errors from this page. See [`event: Page.pageError`] for more details.
930
- def page_errors
931
- wrap_impl(@impl.page_errors)
957
+ def page_errors(filter: nil)
958
+ wrap_impl(@impl.page_errors(filter: unwrap_impl(filter)))
932
959
  end
933
960
 
934
961
  #
@@ -1035,6 +1062,20 @@ module Playwright
1035
1062
  wrap_impl(@impl.pdf(displayHeaderFooter: unwrap_impl(displayHeaderFooter), footerTemplate: unwrap_impl(footerTemplate), format: unwrap_impl(format), headerTemplate: unwrap_impl(headerTemplate), height: unwrap_impl(height), landscape: unwrap_impl(landscape), margin: unwrap_impl(margin), outline: unwrap_impl(outline), pageRanges: unwrap_impl(pageRanges), path: unwrap_impl(path), preferCSSPageSize: unwrap_impl(preferCSSPageSize), printBackground: unwrap_impl(printBackground), scale: unwrap_impl(scale), tagged: unwrap_impl(tagged), width: unwrap_impl(width)))
1036
1063
  end
1037
1064
 
1065
+ #
1066
+ # Enters pick locator mode where hovering over page elements highlights them and shows the corresponding locator.
1067
+ # Once the user clicks an element, the mode is deactivated and the `Locator` for the picked element is returned.
1068
+ #
1069
+ # **Usage**
1070
+ #
1071
+ # ```python sync
1072
+ # locator = page.pick_locator()
1073
+ # print(locator)
1074
+ # ```
1075
+ def pick_locator
1076
+ wrap_impl(@impl.pick_locator)
1077
+ end
1078
+
1038
1079
  #
1039
1080
  # Focuses the element, and then uses [`method: Keyboard.down`] and [`method: Keyboard.up`].
1040
1081
  #
@@ -1230,6 +1271,8 @@ module Playwright
1230
1271
  # page.route("/api/**", handle_route)
1231
1272
  # ```
1232
1273
  #
1274
+ # If a request matches multiple registered routes, the most recently registered route takes precedence.
1275
+ #
1233
1276
  # Page routes take precedence over browser context routes (set up with [`method: BrowserContext.route`]) when request
1234
1277
  # matches both handlers.
1235
1278
  #
@@ -1429,6 +1472,12 @@ module Playwright
1429
1472
  end
1430
1473
  alias_method :viewport_size=, :set_viewport_size
1431
1474
 
1475
+ #
1476
+ # Captures the aria snapshot of the page. Read more about [aria snapshots](../aria-snapshots.md).
1477
+ def aria_snapshot(depth: nil, mode: nil, timeout: nil)
1478
+ wrap_impl(@impl.aria_snapshot(depth: unwrap_impl(depth), mode: unwrap_impl(mode), timeout: unwrap_impl(timeout)))
1479
+ end
1480
+
1432
1481
  #
1433
1482
  # This method taps an element matching `selector` by performing the following steps:
1434
1483
  # 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
@@ -1523,7 +1572,7 @@ module Playwright
1523
1572
  end
1524
1573
 
1525
1574
  #
1526
- # Video object associated with this page.
1575
+ # Video object associated with this page. Can be used to access the video file when using the `recordVideo` context option.
1527
1576
  def video
1528
1577
  wrap_impl(@impl.video)
1529
1578
  end
@@ -1818,13 +1867,13 @@ module Playwright
1818
1867
  end
1819
1868
 
1820
1869
  # @nodoc
1821
- def snapshot_for_ai(timeout: nil, mode: nil, track: nil)
1822
- wrap_impl(@impl.snapshot_for_ai(timeout: unwrap_impl(timeout), mode: unwrap_impl(mode), track: unwrap_impl(track)))
1870
+ def owned_context=(req)
1871
+ wrap_impl(@impl.owned_context=(unwrap_impl(req)))
1823
1872
  end
1824
1873
 
1825
1874
  # @nodoc
1826
- def start_js_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
1827
- wrap_impl(@impl.start_js_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
1875
+ def stop_js_coverage
1876
+ wrap_impl(@impl.stop_js_coverage)
1828
1877
  end
1829
1878
 
1830
1879
  # @nodoc
@@ -1833,24 +1882,18 @@ module Playwright
1833
1882
  end
1834
1883
 
1835
1884
  # @nodoc
1836
- def stop_css_coverage
1837
- wrap_impl(@impl.stop_css_coverage)
1838
- end
1839
-
1840
- # @nodoc
1841
- def owned_context=(req)
1842
- wrap_impl(@impl.owned_context=(unwrap_impl(req)))
1885
+ def snapshot_for_ai(timeout: nil, depth: nil, _track: nil)
1886
+ wrap_impl(@impl.snapshot_for_ai(timeout: unwrap_impl(timeout), depth: unwrap_impl(depth), _track: unwrap_impl(_track)))
1843
1887
  end
1844
1888
 
1845
1889
  # @nodoc
1846
- def stop_js_coverage
1847
- wrap_impl(@impl.stop_js_coverage)
1890
+ def stop_css_coverage
1891
+ wrap_impl(@impl.stop_css_coverage)
1848
1892
  end
1849
1893
 
1850
- # -- inherited from EventEmitter --
1851
1894
  # @nodoc
1852
- def once(event, callback)
1853
- event_emitter_proxy.once(event, callback)
1895
+ def start_js_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
1896
+ wrap_impl(@impl.start_js_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
1854
1897
  end
1855
1898
 
1856
1899
  # -- inherited from EventEmitter --
@@ -1865,6 +1908,12 @@ module Playwright
1865
1908
  event_emitter_proxy.off(event, callback)
1866
1909
  end
1867
1910
 
1911
+ # -- inherited from EventEmitter --
1912
+ # @nodoc
1913
+ def once(event, callback)
1914
+ event_emitter_proxy.once(event, callback)
1915
+ end
1916
+
1868
1917
  private def event_emitter_proxy
1869
1918
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
1870
1919
  end
@@ -103,12 +103,6 @@ module Playwright
103
103
  wrap_impl(@impl.electron)
104
104
  end
105
105
 
106
- # -- inherited from EventEmitter --
107
- # @nodoc
108
- def once(event, callback)
109
- event_emitter_proxy.once(event, callback)
110
- end
111
-
112
106
  # -- inherited from EventEmitter --
113
107
  # @nodoc
114
108
  def on(event, callback)
@@ -121,6 +115,12 @@ module Playwright
121
115
  event_emitter_proxy.off(event, callback)
122
116
  end
123
117
 
118
+ # -- inherited from EventEmitter --
119
+ # @nodoc
120
+ def once(event, callback)
121
+ event_emitter_proxy.once(event, callback)
122
+ end
123
+
124
124
  private def event_emitter_proxy
125
125
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
126
126
  end