playwright-ruby-client 1.48.1 → 1.50.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/documentation/docs/api/browser.md +1 -1
  3. data/documentation/docs/api/browser_type.md +2 -0
  4. data/documentation/docs/api/clock.md +13 -1
  5. data/documentation/docs/api/element_handle.md +0 -1
  6. data/documentation/docs/api/experimental/android_device.md +1 -1
  7. data/documentation/docs/api/frame.md +0 -1
  8. data/documentation/docs/api/keyboard.md +5 -2
  9. data/documentation/docs/api/locator.md +49 -4
  10. data/documentation/docs/api/locator_assertions.md +59 -7
  11. data/documentation/docs/api/page.md +1 -5
  12. data/documentation/docs/api/route.md +1 -1
  13. data/documentation/docs/api/tracing.md +34 -0
  14. data/documentation/docs/include/api_coverage.md +7 -0
  15. data/lib/playwright/channel_owners/tracing.rb +12 -0
  16. data/lib/playwright/locator_assertions_impl.rb +45 -5
  17. data/lib/playwright/locator_impl.rb +7 -0
  18. data/lib/playwright/version.rb +2 -2
  19. data/lib/playwright_api/android.rb +4 -4
  20. data/lib/playwright_api/android_device.rb +10 -10
  21. data/lib/playwright_api/api_request_context.rb +4 -4
  22. data/lib/playwright_api/browser.rb +5 -5
  23. data/lib/playwright_api/browser_context.rb +13 -13
  24. data/lib/playwright_api/browser_type.rb +10 -11
  25. data/lib/playwright_api/cdp_session.rb +4 -4
  26. data/lib/playwright_api/clock.rb +13 -1
  27. data/lib/playwright_api/dialog.rb +4 -4
  28. data/lib/playwright_api/element_handle.rb +4 -4
  29. data/lib/playwright_api/frame.rb +8 -8
  30. data/lib/playwright_api/js_handle.rb +4 -4
  31. data/lib/playwright_api/keyboard.rb +1 -4
  32. data/lib/playwright_api/locator.rb +46 -4
  33. data/lib/playwright_api/locator_assertions.rb +48 -8
  34. data/lib/playwright_api/page.rb +12 -15
  35. data/lib/playwright_api/playwright.rb +4 -4
  36. data/lib/playwright_api/request.rb +4 -4
  37. data/lib/playwright_api/response.rb +4 -4
  38. data/lib/playwright_api/route.rb +5 -5
  39. data/lib/playwright_api/selectors.rb +4 -4
  40. data/lib/playwright_api/tracing.rb +29 -4
  41. data/lib/playwright_api/web_socket.rb +4 -4
  42. data/lib/playwright_api/worker.rb +4 -4
  43. data/sig/playwright.rbs +9 -2
  44. metadata +4 -8
@@ -294,14 +294,14 @@ module Playwright
294
294
 
295
295
  # -- inherited from EventEmitter --
296
296
  # @nodoc
297
- def once(event, callback)
298
- event_emitter_proxy.once(event, callback)
297
+ def on(event, callback)
298
+ event_emitter_proxy.on(event, callback)
299
299
  end
300
300
 
301
301
  # -- inherited from EventEmitter --
302
302
  # @nodoc
303
- def on(event, callback)
304
- event_emitter_proxy.on(event, callback)
303
+ def once(event, callback)
304
+ event_emitter_proxy.once(event, callback)
305
305
  end
306
306
 
307
307
  private def event_emitter_proxy
@@ -30,7 +30,7 @@ module Playwright
30
30
  # In case this browser is connected to, clears all created contexts belonging to this browser and disconnects from the
31
31
  # browser server.
32
32
  #
33
- # **NOTE**: This is similar to force quitting the browser. Therefore, you should call [`method: BrowserContext.close`] on any `BrowserContext`'s you explicitly created earlier with [`method: Browser.newContext`] **before** calling [`method: Browser.close`].
33
+ # **NOTE**: This is similar to force-quitting the browser. To close pages gracefully and ensure you receive page close events, call [`method: BrowserContext.close`] on any `BrowserContext` instances you explicitly created earlier using [`method: Browser.newContext`] **before** calling [`method: Browser.close`].
34
34
  #
35
35
  # The `Browser` object itself is considered to be disposed and cannot be used anymore.
36
36
  def close(reason: nil)
@@ -209,14 +209,14 @@ module Playwright
209
209
 
210
210
  # -- inherited from EventEmitter --
211
211
  # @nodoc
212
- def once(event, callback)
213
- event_emitter_proxy.once(event, callback)
212
+ def on(event, callback)
213
+ event_emitter_proxy.on(event, callback)
214
214
  end
215
215
 
216
216
  # -- inherited from EventEmitter --
217
217
  # @nodoc
218
- def on(event, callback)
219
- event_emitter_proxy.on(event, callback)
218
+ def once(event, callback)
219
+ event_emitter_proxy.once(event, callback)
220
220
  end
221
221
 
222
222
  private def event_emitter_proxy
@@ -463,6 +463,11 @@ module Playwright
463
463
  raise NotImplementedError.new('wait_for_event is not implemented yet.')
464
464
  end
465
465
 
466
+ # @nodoc
467
+ def enable_debug_console!
468
+ wrap_impl(@impl.enable_debug_console!)
469
+ end
470
+
466
471
  # @nodoc
467
472
  def pause
468
473
  wrap_impl(@impl.pause)
@@ -474,18 +479,13 @@ module Playwright
474
479
  end
475
480
 
476
481
  # @nodoc
477
- def owner_page=(req)
478
- wrap_impl(@impl.owner_page=(unwrap_impl(req)))
479
- end
480
-
481
- # @nodoc
482
- def enable_debug_console!
483
- wrap_impl(@impl.enable_debug_console!)
482
+ def browser=(req)
483
+ wrap_impl(@impl.browser=(unwrap_impl(req)))
484
484
  end
485
485
 
486
486
  # @nodoc
487
- def browser=(req)
488
- wrap_impl(@impl.browser=(unwrap_impl(req)))
487
+ def owner_page=(req)
488
+ wrap_impl(@impl.owner_page=(unwrap_impl(req)))
489
489
  end
490
490
 
491
491
  # -- inherited from EventEmitter --
@@ -496,14 +496,14 @@ module Playwright
496
496
 
497
497
  # -- inherited from EventEmitter --
498
498
  # @nodoc
499
- def once(event, callback)
500
- event_emitter_proxy.once(event, callback)
499
+ def on(event, callback)
500
+ event_emitter_proxy.on(event, callback)
501
501
  end
502
502
 
503
503
  # -- inherited from EventEmitter --
504
504
  # @nodoc
505
- def on(event, callback)
506
- event_emitter_proxy.on(event, callback)
505
+ def once(event, callback)
506
+ event_emitter_proxy.once(event, callback)
507
507
  end
508
508
 
509
509
  private def event_emitter_proxy
@@ -20,13 +20,10 @@ module Playwright
20
20
  class BrowserType < PlaywrightApi
21
21
 
22
22
  #
23
- # This method attaches Playwright to an existing browser instance. When connecting to another browser launched via `BrowserType.launchServer` in Node.js, the major and minor version needs to match the client version (1.2.3 → is compatible with 1.2.x).
24
- def connect(
25
- wsEndpoint,
26
- exposeNetwork: nil,
27
- headers: nil,
28
- slowMo: nil,
29
- timeout: nil)
23
+ # This method attaches Playwright to an existing browser instance created via `BrowserType.launchServer` in Node.js.
24
+ #
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
+ def connect
30
27
  raise NotImplementedError.new('connect is not implemented yet.')
31
28
  end
32
29
 
@@ -37,6 +34,8 @@ module Playwright
37
34
  #
38
35
  # **NOTE**: Connecting over the Chrome DevTools Protocol is only supported for Chromium-based browsers.
39
36
  #
37
+ # **NOTE**: This connection is significantly lower fidelity than the Playwright protocol connection via [`method: BrowserType.connect`]. If you are experiencing issues or attempting to use advanced functionality, you probably want to use [`method: BrowserType.connect`].
38
+ #
40
39
  # **Usage**
41
40
  #
42
41
  # ```python sync
@@ -183,14 +182,14 @@ module Playwright
183
182
 
184
183
  # -- inherited from EventEmitter --
185
184
  # @nodoc
186
- def once(event, callback)
187
- event_emitter_proxy.once(event, callback)
185
+ def on(event, callback)
186
+ event_emitter_proxy.on(event, callback)
188
187
  end
189
188
 
190
189
  # -- inherited from EventEmitter --
191
190
  # @nodoc
192
- def on(event, callback)
193
- event_emitter_proxy.on(event, callback)
191
+ def once(event, callback)
192
+ event_emitter_proxy.once(event, callback)
194
193
  end
195
194
 
196
195
  private def event_emitter_proxy
@@ -39,14 +39,14 @@ module Playwright
39
39
 
40
40
  # -- inherited from EventEmitter --
41
41
  # @nodoc
42
- def once(event, callback)
43
- event_emitter_proxy.once(event, callback)
42
+ def on(event, callback)
43
+ event_emitter_proxy.on(event, callback)
44
44
  end
45
45
 
46
46
  # -- inherited from EventEmitter --
47
47
  # @nodoc
48
- def on(event, callback)
49
- event_emitter_proxy.on(event, callback)
48
+ def once(event, callback)
49
+ event_emitter_proxy.once(event, callback)
50
50
  end
51
51
 
52
52
  private def event_emitter_proxy
@@ -65,6 +65,16 @@ module Playwright
65
65
  # page.clock.pause_at(datetime.datetime(2020, 2, 2))
66
66
  # page.clock.pause_at("2020-02-02")
67
67
  # ```
68
+ #
69
+ # For best results, install the clock before navigating the page and set it to a time slightly before the intended test time. This ensures that all timers run normally during page loading, preventing the page from getting stuck. Once the page has fully loaded, you can safely use [`method: Clock.pauseAt`] to pause the clock.
70
+ #
71
+ # ```python sync
72
+ # # Initialize clock with some time before the test time and let the page load
73
+ # # naturally. `Date.now` will progress as the timers fire.
74
+ # page.clock.install(time=datetime.datetime(2024, 12, 10, 8, 0, 0))
75
+ # page.goto("http://localhost:3333")
76
+ # page.clock.pause_at(datetime.datetime(2024, 12, 10, 10, 0, 0))
77
+ # ```
68
78
  def pause_at(time)
69
79
  wrap_impl(@impl.pause_at(unwrap_impl(time)))
70
80
  end
@@ -79,6 +89,8 @@ module Playwright
79
89
  # Makes `Date.now` and `new Date()` return fixed fake time at all times,
80
90
  # keeps all the timers running.
81
91
  #
92
+ # Use this method for simple scenarios where you only need to test with a predefined time. For more advanced scenarios, use [`method: Clock.install`] instead. Read docs on [clock emulation](../clock.md) to learn more.
93
+ #
82
94
  # **Usage**
83
95
  #
84
96
  # ```python sync
@@ -92,7 +104,7 @@ module Playwright
92
104
  alias_method :fixed_time=, :set_fixed_time
93
105
 
94
106
  #
95
- # Sets current system time but does not trigger any timers.
107
+ # Sets system time, but does not trigger any timers. Use this to test how the web page reacts to a time shift, for example switching from summer to winter time, or changing time zones.
96
108
  #
97
109
  # **Usage**
98
110
  #
@@ -76,14 +76,14 @@ module Playwright
76
76
 
77
77
  # -- inherited from EventEmitter --
78
78
  # @nodoc
79
- def once(event, callback)
80
- event_emitter_proxy.once(event, callback)
79
+ def on(event, callback)
80
+ event_emitter_proxy.on(event, callback)
81
81
  end
82
82
 
83
83
  # -- inherited from EventEmitter --
84
84
  # @nodoc
85
- def on(event, callback)
86
- event_emitter_proxy.on(event, callback)
85
+ def once(event, callback)
86
+ event_emitter_proxy.once(event, callback)
87
87
  end
88
88
 
89
89
  private def event_emitter_proxy
@@ -580,14 +580,14 @@ module Playwright
580
580
 
581
581
  # -- inherited from EventEmitter --
582
582
  # @nodoc
583
- def once(event, callback)
584
- event_emitter_proxy.once(event, callback)
583
+ def on(event, callback)
584
+ event_emitter_proxy.on(event, callback)
585
585
  end
586
586
 
587
587
  # -- inherited from EventEmitter --
588
588
  # @nodoc
589
- def on(event, callback)
590
- event_emitter_proxy.on(event, callback)
589
+ def once(event, callback)
590
+ event_emitter_proxy.once(event, callback)
591
591
  end
592
592
 
593
593
  private def event_emitter_proxy
@@ -1039,13 +1039,13 @@ module Playwright
1039
1039
  end
1040
1040
 
1041
1041
  # @nodoc
1042
- def detached=(req)
1043
- wrap_impl(@impl.detached=(unwrap_impl(req)))
1042
+ def highlight(selector)
1043
+ wrap_impl(@impl.highlight(unwrap_impl(selector)))
1044
1044
  end
1045
1045
 
1046
1046
  # @nodoc
1047
- def highlight(selector)
1048
- wrap_impl(@impl.highlight(unwrap_impl(selector)))
1047
+ def detached=(req)
1048
+ wrap_impl(@impl.detached=(unwrap_impl(req)))
1049
1049
  end
1050
1050
 
1051
1051
  # -- inherited from EventEmitter --
@@ -1056,14 +1056,14 @@ module Playwright
1056
1056
 
1057
1057
  # -- inherited from EventEmitter --
1058
1058
  # @nodoc
1059
- def once(event, callback)
1060
- event_emitter_proxy.once(event, callback)
1059
+ def on(event, callback)
1060
+ event_emitter_proxy.on(event, callback)
1061
1061
  end
1062
1062
 
1063
1063
  # -- inherited from EventEmitter --
1064
1064
  # @nodoc
1065
- def on(event, callback)
1066
- event_emitter_proxy.on(event, callback)
1065
+ def once(event, callback)
1066
+ event_emitter_proxy.once(event, callback)
1067
1067
  end
1068
1068
 
1069
1069
  private def event_emitter_proxy
@@ -106,14 +106,14 @@ module Playwright
106
106
 
107
107
  # -- inherited from EventEmitter --
108
108
  # @nodoc
109
- def once(event, callback)
110
- event_emitter_proxy.once(event, callback)
109
+ def on(event, callback)
110
+ event_emitter_proxy.on(event, callback)
111
111
  end
112
112
 
113
113
  # -- inherited from EventEmitter --
114
114
  # @nodoc
115
- def on(event, callback)
116
- event_emitter_proxy.on(event, callback)
115
+ def once(event, callback)
116
+ event_emitter_proxy.once(event, callback)
117
117
  end
118
118
 
119
119
  private def event_emitter_proxy
@@ -30,10 +30,7 @@ module Playwright
30
30
  # An example to trigger select-all with the keyboard
31
31
  #
32
32
  # ```python sync
33
- # # on windows and linux
34
- # page.keyboard.press("Control+A")
35
- # # on mac_os
36
- # page.keyboard.press("Meta+A")
33
+ # page.keyboard.press("ControlOrMeta+A")
37
34
  # ```
38
35
  class Keyboard < PlaywrightApi
39
36
 
@@ -67,6 +67,46 @@ module Playwright
67
67
  wrap_impl(@impl.and(unwrap_impl(locator)))
68
68
  end
69
69
 
70
+ #
71
+ # Captures the aria snapshot of the given element.
72
+ # Read more about [aria snapshots](../aria-snapshots.md) and [`method: LocatorAssertions.toMatchAriaSnapshot`] for the corresponding assertion.
73
+ #
74
+ # **Usage**
75
+ #
76
+ # ```python sync
77
+ # page.get_by_role("link").aria_snapshot()
78
+ # ```
79
+ #
80
+ # **Details**
81
+ #
82
+ # This method captures the aria snapshot of the given element. The snapshot is a string that represents the state of the element and its children.
83
+ # The snapshot can be used to assert the state of the element in the test, or to compare it to state in the future.
84
+ #
85
+ # The ARIA snapshot is represented using [YAML](https://yaml.org/spec/1.2.2/) markup language:
86
+ # - The keys of the objects are the roles and optional accessible names of the elements.
87
+ # - The values are either text content or an array of child elements.
88
+ # - Generic static text can be represented with the `text` key.
89
+ #
90
+ # Below is the HTML markup and the respective ARIA snapshot:
91
+ #
92
+ # ```html
93
+ # <ul aria-label="Links">
94
+ # <li><a href="/">Home</a></li>
95
+ # <li><a href="/about">About</a></li>
96
+ # <ul>
97
+ # ```
98
+ #
99
+ # ```yml
100
+ # - list "Links":
101
+ # - listitem:
102
+ # - link "Home"
103
+ # - listitem:
104
+ # - link "About"
105
+ # ```
106
+ def aria_snapshot(timeout: nil)
107
+ wrap_impl(@impl.aria_snapshot(timeout: unwrap_impl(timeout)))
108
+ end
109
+
70
110
  #
71
111
  # Calls [blur](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/blur) on the element.
72
112
  def blur(timeout: nil)
@@ -269,7 +309,6 @@ module Playwright
269
309
  # You can also specify `JSHandle` as the property value if you want live objects to be passed into the event:
270
310
  #
271
311
  # ```python sync
272
- # # note you can only create data_transfer in chromium and firefox
273
312
  # data_transfer = page.evaluate_handle("new DataTransfer()")
274
313
  # locator.dispatch_event("#source", "dragstart", {"dataTransfer": data_transfer})
275
314
  # ```
@@ -761,7 +800,7 @@ module Playwright
761
800
  end
762
801
 
763
802
  #
764
- # Returns whether the element is [editable](../actionability.md#editable).
803
+ # Returns whether the element is [editable](../actionability.md#editable). If the target element is not an `<input>`, `<textarea>`, `<select>`, `[contenteditable]` and does not have a role allowing `[aria-readonly]`, this method throws an error.
765
804
  #
766
805
  # **NOTE**: If you need to assert that an element is editable, prefer [`method: LocatorAssertions.toBeEditable`] to avoid flakiness. See [assertions guide](../test-assertions.md) for more details.
767
806
  #
@@ -856,16 +895,19 @@ module Playwright
856
895
  #
857
896
  # Creates a locator matching all elements that match one or both of the two locators.
858
897
  #
859
- # Note that when both locators match something, the resulting locator will have multiple matches and violate [locator strictness](../locators.md#strictness) guidelines.
898
+ # Note that when both locators match something, the resulting locator will have multiple matches, potentially causing a [locator strictness](../locators.md#strictness) violation.
860
899
  #
861
900
  # **Usage**
862
901
  #
863
902
  # Consider a scenario where you'd like to click on a "New email" button, but sometimes a security settings dialog shows up instead. In this case, you can wait for either a "New email" button, or a dialog and act accordingly.
864
903
  #
904
+ # **NOTE**: If both "New email" button and security dialog appear on screen, the "or" locator will match both of them,
905
+ # possibly throwing the ["strict mode violation" error](../locators.md#strictness). In this case, you can use [`method: Locator.first`] to only match one of them.
906
+ #
865
907
  # ```python sync
866
908
  # new_email = page.get_by_role("button", name="New")
867
909
  # dialog = page.get_by_text("Confirm security settings")
868
- # expect(new_email.or_(dialog)).to_be_visible()
910
+ # expect(new_email.or_(dialog).first).to_be_visible()
869
911
  # if (dialog.is_visible()):
870
912
  # page.get_by_role("button", name="Dismiss").click()
871
913
  # new_email.click()
@@ -84,6 +84,12 @@ module Playwright
84
84
  wrap_impl(@impl.not_to_have_accessible_description(unwrap_impl(name), ignoreCase: unwrap_impl(ignoreCase), timeout: unwrap_impl(timeout)))
85
85
  end
86
86
 
87
+ #
88
+ # The opposite of [`method: LocatorAssertions.toHaveAccessibleErrorMessage`].
89
+ def not_to_have_accessible_error_message(errorMessage, ignoreCase: nil, timeout: nil)
90
+ wrap_impl(@impl.not_to_have_accessible_error_message(unwrap_impl(errorMessage), ignoreCase: unwrap_impl(ignoreCase), timeout: unwrap_impl(timeout)))
91
+ end
92
+
87
93
  #
88
94
  # The opposite of [`method: LocatorAssertions.toHaveAccessibleName`].
89
95
  def not_to_have_accessible_name(name, ignoreCase: nil, timeout: nil)
@@ -150,6 +156,12 @@ module Playwright
150
156
  wrap_impl(@impl.not_to_have_values(unwrap_impl(values), timeout: unwrap_impl(timeout)))
151
157
  end
152
158
 
159
+ #
160
+ # The opposite of [`method: LocatorAssertions.toMatchAriaSnapshot`].
161
+ def not_to_match_aria_snapshot(expected, timeout: nil)
162
+ wrap_impl(@impl.not_to_match_aria_snapshot(unwrap_impl(expected), timeout: unwrap_impl(timeout)))
163
+ end
164
+
153
165
  #
154
166
  # Ensures that `Locator` points to an element that is [connected](https://developer.mozilla.org/en-US/docs/Web/API/Node/isConnected) to a Document or a ShadowRoot.
155
167
  #
@@ -173,8 +185,8 @@ module Playwright
173
185
  # locator = page.get_by_label("Subscribe to newsletter")
174
186
  # expect(locator).to_be_checked()
175
187
  # ```
176
- def to_be_checked(checked: nil, timeout: nil)
177
- wrap_impl(@impl.to_be_checked(checked: unwrap_impl(checked), timeout: unwrap_impl(timeout)))
188
+ def to_be_checked(checked: nil, indeterminate: nil, timeout: nil)
189
+ wrap_impl(@impl.to_be_checked(checked: unwrap_impl(checked), indeterminate: unwrap_impl(indeterminate), timeout: unwrap_impl(timeout)))
178
190
  end
179
191
 
180
192
  #
@@ -385,6 +397,19 @@ module Playwright
385
397
  wrap_impl(@impl.to_have_accessible_description(unwrap_impl(description), ignoreCase: unwrap_impl(ignoreCase), timeout: unwrap_impl(timeout)))
386
398
  end
387
399
 
400
+ #
401
+ # Ensures the `Locator` points to an element with a given [aria errormessage](https://w3c.github.io/aria/#aria-errormessage).
402
+ #
403
+ # **Usage**
404
+ #
405
+ # ```python sync
406
+ # locator = page.get_by_test_id("username-input")
407
+ # expect(locator).to_have_accessible_error_message("Username is required.")
408
+ # ```
409
+ def to_have_accessible_error_message(errorMessage, ignoreCase: nil, timeout: nil)
410
+ wrap_impl(@impl.to_have_accessible_error_message(unwrap_impl(errorMessage), ignoreCase: unwrap_impl(ignoreCase), timeout: unwrap_impl(timeout)))
411
+ end
412
+
388
413
  #
389
414
  # Ensures the `Locator` points to an element with a given [accessible name](https://w3c.github.io/accname/#dfn-accessible-name).
390
415
  #
@@ -414,24 +439,23 @@ module Playwright
414
439
  end
415
440
 
416
441
  #
417
- # Ensures the `Locator` points to an element with given CSS classes. This needs to be a full match
418
- # or using a relaxed regular expression.
442
+ # Ensures the `Locator` points to an element with given CSS classes. When a string is provided, it must fully match the element's `class` attribute. To match individual classes or perform partial matches, use a regular expression:
419
443
  #
420
444
  # **Usage**
421
445
  #
422
446
  # ```html
423
- # <div class='selected row' id='component'></div>
447
+ # <div class='middle selected row' id='component'></div>
424
448
  # ```
425
449
  #
426
450
  # ```python sync
427
451
  # from playwright.sync_api import expect
428
452
  #
429
453
  # locator = page.locator("#component")
430
- # expect(locator).to_have_class(re.compile(r"selected"))
431
- # expect(locator).to_have_class("selected row")
454
+ # expect(locator).to_have_class(re.compile(r"(^|\\s)selected(\\s|$)"))
455
+ # expect(locator).to_have_class("middle selected row")
432
456
  # ```
433
457
  #
434
- # Note that if array is passed as an expected value, entire lists of elements can be asserted:
458
+ # When an array is passed, the method asserts that the list of elements located matches the corresponding list of expected class values. Each element's class attribute is matched against the corresponding string or regular expression in the array:
435
459
  #
436
460
  # ```python sync
437
461
  # from playwright.sync_api import expect
@@ -616,5 +640,21 @@ module Playwright
616
640
  def to_have_values(values, timeout: nil)
617
641
  wrap_impl(@impl.to_have_values(unwrap_impl(values), timeout: unwrap_impl(timeout)))
618
642
  end
643
+
644
+ #
645
+ # Asserts that the target element matches the given [accessibility snapshot](../aria-snapshots.md).
646
+ #
647
+ # **Usage**
648
+ #
649
+ # ```python sync
650
+ # page.goto("https://demo.playwright.dev/todomvc/")
651
+ # expect(page.locator('body')).to_match_aria_snapshot('''
652
+ # - heading "todos"
653
+ # - textbox "What needs to be done?"
654
+ # ''')
655
+ # ```
656
+ def to_match_aria_snapshot(expected, timeout: nil)
657
+ wrap_impl(@impl.to_match_aria_snapshot(unwrap_impl(expected), timeout: unwrap_impl(timeout)))
658
+ end
619
659
  end
620
660
  end
@@ -315,7 +315,6 @@ module Playwright
315
315
  # # → True
316
316
  # page.evaluate("matchMedia('(prefers-color-scheme: light)').matches")
317
317
  # # → False
318
- # page.evaluate("matchMedia('(prefers-color-scheme: no-preference)').matches")
319
318
  # ```
320
319
  def emulate_media(colorScheme: nil, forcedColors: nil, media: nil, reducedMotion: nil)
321
320
  wrap_impl(@impl.emulate_media(colorScheme: unwrap_impl(colorScheme), forcedColors: unwrap_impl(forcedColors), media: unwrap_impl(media), reducedMotion: unwrap_impl(reducedMotion)))
@@ -958,8 +957,6 @@ module Playwright
958
957
  #
959
958
  # Returns the PDF buffer.
960
959
  #
961
- # **NOTE**: Generating a pdf is currently only supported in Chromium headless.
962
- #
963
960
  # `page.pdf()` generates a pdf of the page with `print` css media. To generate a pdf with `screen` media, call
964
961
  # [`method: Page.emulateMedia`] before calling `page.pdf()`:
965
962
  #
@@ -1796,13 +1793,13 @@ module Playwright
1796
1793
  end
1797
1794
 
1798
1795
  # @nodoc
1799
- def start_css_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
1800
- wrap_impl(@impl.start_css_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
1796
+ def stop_js_coverage
1797
+ wrap_impl(@impl.stop_js_coverage)
1801
1798
  end
1802
1799
 
1803
1800
  # @nodoc
1804
- def stop_js_coverage
1805
- wrap_impl(@impl.stop_js_coverage)
1801
+ def start_css_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
1802
+ wrap_impl(@impl.start_css_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
1806
1803
  end
1807
1804
 
1808
1805
  # @nodoc
@@ -1811,13 +1808,13 @@ module Playwright
1811
1808
  end
1812
1809
 
1813
1810
  # @nodoc
1814
- def guid
1815
- wrap_impl(@impl.guid)
1811
+ def owned_context=(req)
1812
+ wrap_impl(@impl.owned_context=(unwrap_impl(req)))
1816
1813
  end
1817
1814
 
1818
1815
  # @nodoc
1819
- def owned_context=(req)
1820
- wrap_impl(@impl.owned_context=(unwrap_impl(req)))
1816
+ def guid
1817
+ wrap_impl(@impl.guid)
1821
1818
  end
1822
1819
 
1823
1820
  # -- inherited from EventEmitter --
@@ -1828,14 +1825,14 @@ module Playwright
1828
1825
 
1829
1826
  # -- inherited from EventEmitter --
1830
1827
  # @nodoc
1831
- def once(event, callback)
1832
- event_emitter_proxy.once(event, callback)
1828
+ def on(event, callback)
1829
+ event_emitter_proxy.on(event, callback)
1833
1830
  end
1834
1831
 
1835
1832
  # -- inherited from EventEmitter --
1836
1833
  # @nodoc
1837
- def on(event, callback)
1838
- event_emitter_proxy.on(event, callback)
1834
+ def once(event, callback)
1835
+ event_emitter_proxy.once(event, callback)
1839
1836
  end
1840
1837
 
1841
1838
  private def event_emitter_proxy
@@ -111,14 +111,14 @@ module Playwright
111
111
 
112
112
  # -- inherited from EventEmitter --
113
113
  # @nodoc
114
- def once(event, callback)
115
- event_emitter_proxy.once(event, callback)
114
+ def on(event, callback)
115
+ event_emitter_proxy.on(event, callback)
116
116
  end
117
117
 
118
118
  # -- inherited from EventEmitter --
119
119
  # @nodoc
120
- def on(event, callback)
121
- event_emitter_proxy.on(event, callback)
120
+ def once(event, callback)
121
+ event_emitter_proxy.once(event, callback)
122
122
  end
123
123
 
124
124
  private def event_emitter_proxy
@@ -213,14 +213,14 @@ module Playwright
213
213
 
214
214
  # -- inherited from EventEmitter --
215
215
  # @nodoc
216
- def once(event, callback)
217
- event_emitter_proxy.once(event, callback)
216
+ def on(event, callback)
217
+ event_emitter_proxy.on(event, callback)
218
218
  end
219
219
 
220
220
  # -- inherited from EventEmitter --
221
221
  # @nodoc
222
- def on(event, callback)
223
- event_emitter_proxy.on(event, callback)
222
+ def once(event, callback)
223
+ event_emitter_proxy.once(event, callback)
224
224
  end
225
225
 
226
226
  private def event_emitter_proxy
@@ -135,14 +135,14 @@ module Playwright
135
135
 
136
136
  # -- inherited from EventEmitter --
137
137
  # @nodoc
138
- def once(event, callback)
139
- event_emitter_proxy.once(event, callback)
138
+ def on(event, callback)
139
+ event_emitter_proxy.on(event, callback)
140
140
  end
141
141
 
142
142
  # -- inherited from EventEmitter --
143
143
  # @nodoc
144
- def on(event, callback)
145
- event_emitter_proxy.on(event, callback)
144
+ def once(event, callback)
145
+ event_emitter_proxy.once(event, callback)
146
146
  end
147
147
 
148
148
  private def event_emitter_proxy