playwright-ruby-client 1.59.1 → 1.61.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/documentation/docs/api/api_request.md +25 -1
  3. data/documentation/docs/api/api_request_context.md +13 -11
  4. data/documentation/docs/api/api_response.md +18 -0
  5. data/documentation/docs/api/browser.md +18 -0
  6. data/documentation/docs/api/browser_context.md +7 -1
  7. data/documentation/docs/api/browser_type.md +19 -0
  8. data/documentation/docs/api/credentials.md +132 -0
  9. data/documentation/docs/api/frame.md +5 -4
  10. data/documentation/docs/api/frame_locator.md +1 -0
  11. data/documentation/docs/api/locator.md +37 -2
  12. data/documentation/docs/api/locator_assertions.md +1 -1
  13. data/documentation/docs/api/page.md +24 -4
  14. data/documentation/docs/api/page_assertions.md +28 -0
  15. data/documentation/docs/api/playwright.md +5 -0
  16. data/documentation/docs/api/touchscreen.md +1 -1
  17. data/documentation/docs/api/tracing.md +29 -0
  18. data/documentation/docs/api/web_storage.md +65 -0
  19. data/documentation/docs/include/api_coverage.md +30 -56
  20. data/lib/playwright/api_request_impl.rb +70 -0
  21. data/lib/playwright/api_response_impl.rb +8 -0
  22. data/lib/playwright/channel_owners/api_request_context.rb +5 -1
  23. data/lib/playwright/channel_owners/binding_call.rb +3 -9
  24. data/lib/playwright/channel_owners/browser.rb +17 -0
  25. data/lib/playwright/channel_owners/browser_context.rb +12 -55
  26. data/lib/playwright/channel_owners/browser_type.rb +35 -1
  27. data/lib/playwright/channel_owners/frame.rb +118 -13
  28. data/lib/playwright/channel_owners/json_pipe.rb +4 -0
  29. data/lib/playwright/channel_owners/local_utils.rb +11 -2
  30. data/lib/playwright/channel_owners/page.rb +28 -13
  31. data/lib/playwright/channel_owners/playwright.rb +4 -0
  32. data/lib/playwright/channel_owners/tracing.rb +105 -4
  33. data/lib/playwright/connection.rb +12 -2
  34. data/lib/playwright/console_message_impl.rb +10 -1
  35. data/lib/playwright/credentials_impl.rb +35 -0
  36. data/lib/playwright/errors.rb +7 -3
  37. data/lib/playwright/events.rb +7 -0
  38. data/lib/playwright/json_pipe_transport.rb +40 -0
  39. data/lib/playwright/locator_assertions_impl.rb +21 -4
  40. data/lib/playwright/locator_impl.rb +17 -3
  41. data/lib/playwright/locator_utils.rb +11 -1
  42. data/lib/playwright/page_assertions_impl.rb +33 -3
  43. data/lib/playwright/screencast.rb +8 -2
  44. data/lib/playwright/url_matcher.rb +35 -0
  45. data/lib/playwright/version.rb +2 -2
  46. data/lib/playwright/waiter.rb +9 -41
  47. data/lib/playwright/web_storage_impl.rb +34 -0
  48. data/lib/playwright.rb +1 -0
  49. data/lib/playwright_api/api_request.rb +1 -1
  50. data/lib/playwright_api/api_request_context.rb +21 -17
  51. data/lib/playwright_api/api_response.rb +12 -0
  52. data/lib/playwright_api/browser.rb +8 -8
  53. data/lib/playwright_api/browser_context.rb +20 -13
  54. data/lib/playwright_api/browser_type.rb +12 -9
  55. data/lib/playwright_api/cdp_session.rb +6 -6
  56. data/lib/playwright_api/credentials.rb +120 -0
  57. data/lib/playwright_api/dialog.rb +6 -6
  58. data/lib/playwright_api/element_handle.rb +6 -6
  59. data/lib/playwright_api/frame.rb +25 -14
  60. data/lib/playwright_api/frame_locator.rb +2 -1
  61. data/lib/playwright_api/js_handle.rb +6 -6
  62. data/lib/playwright_api/locator.rb +39 -10
  63. data/lib/playwright_api/locator_assertions.rb +2 -2
  64. data/lib/playwright_api/page.rb +44 -25
  65. data/lib/playwright_api/page_assertions.rb +22 -0
  66. data/lib/playwright_api/playwright.rb +7 -7
  67. data/lib/playwright_api/request.rb +8 -8
  68. data/lib/playwright_api/response.rb +6 -6
  69. data/lib/playwright_api/route.rb +6 -6
  70. data/lib/playwright_api/touchscreen.rb +1 -1
  71. data/lib/playwright_api/tracing.rb +27 -4
  72. data/lib/playwright_api/web_socket.rb +6 -6
  73. data/lib/playwright_api/web_storage.rb +48 -0
  74. data/lib/playwright_api/worker.rb +8 -8
  75. data/sig/playwright.rbs +51 -39
  76. metadata +11 -12
  77. data/documentation/docs/api/experimental/android.md +0 -42
  78. data/documentation/docs/api/experimental/android_device.md +0 -109
  79. data/documentation/docs/api/experimental/android_input.md +0 -43
  80. data/documentation/docs/api/experimental/android_socket.md +0 -7
  81. data/documentation/docs/api/experimental/android_web_view.md +0 -7
  82. data/lib/playwright_api/android.rb +0 -68
  83. data/lib/playwright_api/android_device.rb +0 -229
  84. data/lib/playwright_api/android_input.rb +0 -34
  85. data/lib/playwright_api/android_socket.rb +0 -18
  86. data/lib/playwright_api/android_web_view.rb +0 -24
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8943d61bb3cd1ebe3737284e7556d8bcb4b1be154105c2bb05f8d8d77ba51aca
4
- data.tar.gz: 15fdc15c33208bb8389306733807768797038d7a788c9f3e5f7465680823ebb7
3
+ metadata.gz: c45763ab237c198b8f2aa3afa3114ae0bf821481e57711516f5014547079f183
4
+ data.tar.gz: ed8d42f43cb28c8ae2a45755332582b6e51ac993a751de94fb1a25fff43f5532
5
5
  SHA512:
6
- metadata.gz: 1787fb9a9b61c92bb3cb0adc512e18349ae2830d59914e6ac6c202361b849d20e0c09f3fef4ecfa250b90e6858ce60a381c3fe76fcb3c96fd9b42ccf548d26e0
7
- data.tar.gz: b72617a5d25b592c8e3a8d54dc887a56776448be204cc7d1e901145d449b3aadca42090010978c547c8e8e1cc1f0418415624008cd60122eea3a41a4d76c1af8
6
+ metadata.gz: 90ac4618f354ca98c4d5a5c7284b23d752a098bf7128a246076964381f36d93680b78c89599b15b175afdb7274e6cea1882cfab64f9d9eab6dcb1317b0f0f894
7
+ data.tar.gz: 91cdfb64498f4e76f0f3a6f726fd49fa3d36dd7c6b692e843455bf8a9160a94216f13e324ffe90a2472c0b9ad573bd1d1ab241590629357d01562991ea299c63
@@ -4,4 +4,28 @@ sidebar_position: 10
4
4
 
5
5
  # APIRequest
6
6
 
7
- Not Implemented
7
+
8
+ Exposes API that can be used for the Web API testing. This class is used for creating
9
+ [APIRequestContext](./api_request_context) instance which in turn can be used for sending web requests. An instance
10
+ of this class can be obtained via [Playwright#request](./playwright#request). For more information
11
+ see [APIRequestContext](./api_request_context).
12
+
13
+ ## new_context
14
+
15
+ ```
16
+ def new_context(
17
+ baseURL: nil,
18
+ clientCertificates: nil,
19
+ extraHTTPHeaders: nil,
20
+ failOnStatusCode: nil,
21
+ httpCredentials: nil,
22
+ ignoreHTTPSErrors: nil,
23
+ maxRedirects: nil,
24
+ proxy: nil,
25
+ storageState: nil,
26
+ timeout: nil,
27
+ userAgent: nil)
28
+ ```
29
+
30
+
31
+ Creates new instances of [APIRequestContext](./api_request_context).
@@ -8,21 +8,21 @@ sidebar_position: 10
8
8
  This API is used for the Web API testing. You can use it to trigger API endpoints, configure micro-services, prepare
9
9
  environment or the service to your e2e test.
10
10
 
11
- Each Playwright browser context has associated with it [APIRequestContext](./api_request_context) instance which shares cookie storage with
12
- the browser context and can be accessed via [BrowserContext#request](./browser_context#request) or [Page#request](./page#request).
13
- It is also possible to create a new APIRequestContext instance manually by calling [APIRequest#new_context](./api_request#new_context).
11
+ Each Playwright browser context has an associated [APIRequestContext](./api_request_context), accessible via
12
+ [BrowserContext#request](./browser_context#request) or [Page#request](./page#request) (these return the
13
+
14
+ **same instance** — `page.request` is a shortcut for `page.context().request`).
15
+ You can also create a standalone, isolated instance with [APIRequest#new_context](./api_request#new_context).
14
16
 
15
17
  **Cookie management**
16
18
 
17
- [APIRequestContext](./api_request_context) returned by [BrowserContext#request](./browser_context#request) and [Page#request](./page#request) shares cookie
18
- storage with the corresponding [BrowserContext](./browser_context). Each API request will have `Cookie` header populated with the
19
- values from the browser context. If the API response contains `Set-Cookie` header it will automatically update
20
- [BrowserContext](./browser_context) cookies and requests made from the page will pick them up. This means that if you log in using
21
- this API, your e2e test will be logged in and vice versa.
19
+ The [APIRequestContext](./api_request_context) returned by [BrowserContext#request](./browser_context#request) and
20
+
21
+ [Page#request](./page#request) uses the same cookie jar as its [BrowserContext](./browser_context):
22
22
 
23
- If you want API requests to not interfere with the browser cookies you should create a new [APIRequestContext](./api_request_context) by
24
- calling [APIRequest#new_context](./api_request#new_context). Such [APIRequestContext](./api_request_context) object will have its own isolated cookie
25
- storage.
23
+ If you want API requests that do **not** share cookies with the browser, create an
24
+ isolated context via [APIRequest#new_context](./api_request#new_context). Such [APIRequestContext](./api_request_context)
25
+ object will have its own isolated cookie storage.
26
26
 
27
27
  ```ruby
28
28
  playwright.chromium.launch do |browser|
@@ -296,3 +296,5 @@ def put(
296
296
  Sends HTTP(S) [PUT](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PUT) request and returns its response.
297
297
  The method will populate request cookies from the context and update
298
298
  context cookies from the response. The method will automatically follow redirects.
299
+
300
+ ## tracing
@@ -77,6 +77,24 @@ def ok
77
77
 
78
78
  Contains a boolean stating whether the response was successful (status in the range 200-299) or not.
79
79
 
80
+ ## security_details
81
+
82
+ ```
83
+ def security_details
84
+ ```
85
+
86
+
87
+ Returns SSL and other security information. Resolves to `null` for non-HTTPS responses. For redirected requests, returns the information for the last request in the redirect chain.
88
+
89
+ ## server_addr
90
+
91
+ ```
92
+ def server_addr
93
+ ```
94
+
95
+
96
+ Returns the IP address and port of the server. Resolves to `null` if the server address is not available. For redirected requests, returns the information for the last request in the redirect chain.
97
+
80
98
  ## status
81
99
 
82
100
  ```
@@ -193,6 +193,15 @@ This is a convenience API that should only be used for the single-page scenarios
193
193
  testing frameworks should explicitly create [Browser#new_context](./browser#new_context) followed by the
194
194
  [BrowserContext#new_page](./browser_context#new_page) to control their exact life times.
195
195
 
196
+ ## bind
197
+
198
+ ```
199
+ def bind(title, host: nil, port: nil, workspaceDir: nil)
200
+ ```
201
+
202
+
203
+ Binds the browser to a named pipe or web socket, making it available for other clients to connect to.
204
+
196
205
  ## start_tracing
197
206
 
198
207
  ```
@@ -227,6 +236,15 @@ def stop_tracing
227
236
 
228
237
  Returns the buffer with trace data.
229
238
 
239
+ ## unbind
240
+
241
+ ```
242
+ def unbind
243
+ ```
244
+
245
+
246
+ Unbinds the browser server previously bound with [Browser#bind](./browser#bind).
247
+
230
248
  ## version
231
249
 
232
250
  ```
@@ -154,7 +154,7 @@ are returned.
154
154
  ## expose_binding
155
155
 
156
156
  ```
157
- def expose_binding(name, callback, handle: nil)
157
+ def expose_binding(name, callback)
158
158
  ```
159
159
 
160
160
 
@@ -521,6 +521,12 @@ Will throw an error if the context closes before new [Page](./page) is created.
521
521
 
522
522
  Playwright has ability to mock clock and passage of time.
523
523
 
524
+ ## credentials
525
+
526
+
527
+ Virtual WebAuthn authenticator for this context. Lets tests seed credentials and intercept
528
+ `navigator.credentials.create()` / `navigator.credentials.get()` ceremonies.
529
+
524
530
  ## request
525
531
 
526
532
 
@@ -19,13 +19,32 @@ chromium.launch do |browser|
19
19
  end
20
20
  ```
21
21
 
22
+ ## connect
23
+
24
+ ```
25
+ def connect(
26
+ endpoint,
27
+ exposeNetwork: nil,
28
+ headers: nil,
29
+ slowMo: nil,
30
+ timeout: nil,
31
+ &block)
32
+ ```
33
+
34
+
35
+ This method attaches Playwright to an existing browser instance created via `BrowserType.launchServer` in Node.js.
36
+
37
+ **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).
38
+
22
39
  ## connect_over_cdp
23
40
 
24
41
  ```
25
42
  def connect_over_cdp(
26
43
  endpointURL,
44
+ artifactsDir: nil,
27
45
  headers: nil,
28
46
  isLocal: nil,
47
+ noDefaults: nil,
29
48
  slowMo: nil,
30
49
  timeout: nil,
31
50
  &block)
@@ -0,0 +1,132 @@
1
+ ---
2
+ sidebar_position: 10
3
+ ---
4
+
5
+ # Credentials
6
+
7
+
8
+ [Credentials](./credentials) is a virtual WebAuthn authenticator scoped to a [BrowserContext](./browser_context). It lets tests
9
+ register passkeys and answer `navigator.credentials.create()` / `navigator.credentials.get()`
10
+ ceremonies in the page, without a real authenticator or hardware security key.
11
+
12
+ There are two common ways to use it:
13
+
14
+ **Usage: seed a known credential**
15
+
16
+ ```ruby
17
+ context = browser.new_context
18
+
19
+ # A passkey your backend already provisioned for a test user.
20
+ context.credentials.create(
21
+ "example.com",
22
+ id: known_credential_id, # base64url
23
+ userHandle: known_user_handle, # base64url
24
+ privateKey: known_private_key, # base64url PKCS#8 (DER)
25
+ publicKey: known_public_key, # base64url SPKI (DER)
26
+ )
27
+ context.credentials.install
28
+
29
+ page = context.new_page
30
+ page.goto("https://example.com/login")
31
+ # The page's navigator.credentials.get() is answered with the seeded passkey.
32
+ ```
33
+
34
+ **Usage: capture a passkey, then reuse it**
35
+
36
+ ```ruby
37
+ # setup test: let the app register a passkey, then save it.
38
+ context = browser.new_context
39
+ context.credentials.install
40
+
41
+ page = context.new_page
42
+ page.goto("https://example.com/register")
43
+ page.get_by_role("button", name: "Create a passkey").click
44
+
45
+ # Read back the passkey the page registered - it includes the private key.
46
+ credential = context.credentials.get(rpId: "example.com").first
47
+ File.write("playwright/.auth/passkey.json", JSON.generate(credential))
48
+ ```
49
+
50
+ ```ruby
51
+ # later test: seed the captured passkey so the app starts already enrolled.
52
+ credential = JSON.parse(File.read("playwright/.auth/passkey.json"))
53
+ context = browser.new_context
54
+ context.credentials.create(
55
+ credential["rpId"],
56
+ id: credential["id"],
57
+ userHandle: credential["userHandle"],
58
+ privateKey: credential["privateKey"],
59
+ publicKey: credential["publicKey"],
60
+ )
61
+ context.credentials.install
62
+
63
+ page = context.new_page
64
+ page.goto("https://example.com/login")
65
+ # navigator.credentials.get() resolves the captured passkey - already signed in.
66
+ ```
67
+
68
+ **Defaults**
69
+
70
+ ## install
71
+
72
+ ```
73
+ def install
74
+ ```
75
+
76
+
77
+ Installs the virtual WebAuthn authenticator into the context, overriding
78
+ `navigator.credentials.create()` and `navigator.credentials.get()` in all current
79
+ and future pages. Call this before the page first touches `navigator.credentials`.
80
+
81
+ Required: until [Credentials#install](./credentials#install) is called, no interception is in place and the page sees
82
+ the platform's native (or absent) WebAuthn behaviour. Seeding credentials with
83
+ [Credentials#create](./credentials#create) without installing populates the authenticator, but the
84
+ page will never see those credentials.
85
+
86
+ ## create
87
+
88
+ ```
89
+ def create(
90
+ rpId,
91
+ id: nil,
92
+ privateKey: nil,
93
+ publicKey: nil,
94
+ userHandle: nil)
95
+ ```
96
+
97
+
98
+ Seeds a virtual WebAuthn credential and returns it.
99
+
100
+ With only `rpId`, generates a fresh **ECDSA P-256** keypair, credential id and user handle. The
101
+ seeded credential is discoverable (resident), so the page can resolve it from both
102
+ 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.
103
+
104
+ To **import a known credential**, supply all four of `id`, `userHandle`, `privateKey` and
105
+ `publicKey` together.
106
+
107
+ Call [Credentials#install](./credentials#install) before navigating to a page that uses WebAuthn.
108
+
109
+ ## delete
110
+
111
+ ```
112
+ def delete(id)
113
+ ```
114
+
115
+
116
+ Removes a credential from the authenticator by its id. Works for any credential currently held —
117
+ both those seeded with [Credentials#create](./credentials#create) and those the page registered itself by
118
+ calling `navigator.credentials.create()`.
119
+
120
+ ## get
121
+
122
+ ```
123
+ def get(id: nil, rpId: nil)
124
+ ```
125
+
126
+
127
+ Returns every credential currently held by the authenticator, optionally filtered by `rpId` or
128
+ `id`. This includes both credentials seeded with [Credentials#create](./credentials#create) and credentials
129
+ the page registered itself by calling `navigator.credentials.create()`.
130
+
131
+ Each returned credential includes its private and public keys, so a passkey the app just
132
+ registered can be saved and re-seeded into a later test with [Credentials#create](./credentials#create) — see the second example in the class overview.
@@ -291,7 +291,7 @@ puts frame.evaluate("1 + #{x}") # => "11"
291
291
  [ElementHandle](./element_handle) instances can be passed as an argument to the [Frame#evaluate](./frame#evaluate):
292
292
 
293
293
  ```ruby
294
- body_handle = frame.query_selector("body")
294
+ body_handle = frame.evaluate_handle("document.body")
295
295
  html = frame.evaluate("([body, suffix]) => body.innerHTML + suffix", arg: [body_handle, "hello"])
296
296
  body_handle.dispose
297
297
  ```
@@ -321,14 +321,14 @@ a_window_handle # handle for the window object.
321
321
  A string can also be passed in instead of a function.
322
322
 
323
323
  ```ruby
324
- a_handle = page.evaluate_handle("document") # handle for the "document"
324
+ a_handle = frame.evaluate_handle("document") # handle for the "document"
325
325
  ```
326
326
 
327
327
  [JSHandle](./js_handle) instances can be passed as an argument to the [Frame#evaluate_handle](./frame#evaluate_handle):
328
328
 
329
329
  ```ruby
330
- body_handle = page.evaluate_handle("document.body")
331
- result_handle = page.evaluate_handle("body => body.innerHTML", arg: body_handle)
330
+ a_handle = frame.evaluate_handle("document.body")
331
+ result_handle = frame.evaluate_handle("body => body.innerHTML", arg: a_handle)
332
332
  puts result_handle.json_value
333
333
  result_handle.dispose
334
334
  ```
@@ -486,6 +486,7 @@ page.get_by_placeholder("name@example.com").fill("playwright@microsoft.com")
486
486
  def get_by_role(
487
487
  role,
488
488
  checked: nil,
489
+ description: nil,
489
490
  disabled: nil,
490
491
  exact: nil,
491
492
  expanded: nil,
@@ -131,6 +131,7 @@ page.get_by_placeholder("name@example.com").fill("playwright@microsoft.com")
131
131
  def get_by_role(
132
132
  role,
133
133
  checked: nil,
134
+ description: nil,
134
135
  disabled: nil,
135
136
  exact: nil,
136
137
  expanded: nil,
@@ -87,7 +87,7 @@ button = page.get_by_role("button").and(page.get_by_title("Subscribe"))
87
87
  ## aria_snapshot
88
88
 
89
89
  ```
90
- def aria_snapshot(depth: nil, mode: nil, timeout: nil)
90
+ def aria_snapshot(boxes: nil, depth: nil, mode: nil, timeout: nil)
91
91
  ```
92
92
 
93
93
 
@@ -441,6 +441,31 @@ source.drag_to(
441
441
  )
442
442
  ```
443
443
 
444
+ ## drop
445
+
446
+ ```
447
+ def drop(payload, position: nil, timeout: nil)
448
+ ```
449
+
450
+
451
+ Simulate an external drag-and-drop of files or clipboard-like data onto this locator.
452
+
453
+ **Details**
454
+
455
+ Dispatches the native `dragenter`, `dragover`, and `drop` events at the center of the
456
+ target element with a synthetic [DataTransfer] carrying the provided files and/or data
457
+ entries. Works cross-browser by constructing the [DataTransfer] in the page context.
458
+
459
+ If the target element's `dragover` listener does not call `preventDefault()`, the target
460
+ is considered to have rejected the drop: Playwright dispatches `dragleave` and this
461
+ method throws.
462
+
463
+ **Usage**
464
+
465
+ Drop a file buffer onto an upload area:
466
+
467
+ Drop plain text and a URL together:
468
+
444
469
  ## element_handle
445
470
 
446
471
  ```
@@ -721,6 +746,7 @@ page.get_by_placeholder("name@example.com").fill("playwright@microsoft.com")
721
746
  def get_by_role(
722
747
  role,
723
748
  checked: nil,
749
+ description: nil,
724
750
  disabled: nil,
725
751
  exact: nil,
726
752
  expanded: nil,
@@ -869,10 +895,19 @@ You can check the issues count after locating it by the title text:
869
895
  page.get_by_title("Issues count").text_content # => "25 issues"
870
896
  ```
871
897
 
898
+ ## hide_highlight
899
+
900
+ ```
901
+ def hide_highlight
902
+ ```
903
+
904
+
905
+ Hides the element highlight previously added by [Locator#highlight](./locator#highlight).
906
+
872
907
  ## highlight
873
908
 
874
909
  ```
875
- def highlight
910
+ def highlight(style: nil)
876
911
  ```
877
912
 
878
913
 
@@ -647,7 +647,7 @@ expect(locator).to have_count(3)
647
647
  ## to_have_css
648
648
 
649
649
  ```ruby
650
- expect(locator).to have_css(name, value, timeout: nil)
650
+ expect(locator).to have_css(name, value, pseudo: nil, timeout: nil)
651
651
  ```
652
652
 
653
653
 
@@ -413,7 +413,7 @@ puts page.evaluate("1 + #{x}") # => "11"
413
413
  [ElementHandle](./element_handle) instances can be passed as an argument to the [Page#evaluate](./page#evaluate):
414
414
 
415
415
  ```ruby
416
- body_handle = page.query_selector("body")
416
+ body_handle = page.evaluate_handle("document.body")
417
417
  html = page.evaluate("([body, suffix]) => body.innerHTML + suffix", arg: [body_handle, "hello"])
418
418
  body_handle.dispose
419
419
  ```
@@ -457,7 +457,7 @@ result_handle.dispose
457
457
  ## expose_binding
458
458
 
459
459
  ```
460
- def expose_binding(name, callback, handle: nil)
460
+ def expose_binding(name, callback)
461
461
  ```
462
462
 
463
463
 
@@ -690,6 +690,7 @@ page.get_by_placeholder("name@example.com").fill("playwright@microsoft.com")
690
690
  def get_by_role(
691
691
  role,
692
692
  checked: nil,
693
+ description: nil,
693
694
  disabled: nil,
694
695
  exact: nil,
695
696
  expanded: nil,
@@ -889,6 +890,15 @@ Found" and 500 "Internal Server Error". The status code for such responses can
889
890
  **NOTE**: Headless mode doesn't support navigation to a PDF document. See the
890
891
  [upstream issue](https://bugs.chromium.org/p/chromium/issues/detail?id=761295).
891
892
 
893
+ ## hide_highlight
894
+
895
+ ```
896
+ def hide_highlight
897
+ ```
898
+
899
+
900
+ Hide all locator highlight overlays previously added by [Locator#highlight](./locator#highlight) on this page.
901
+
892
902
  ## hover
893
903
 
894
904
  ```
@@ -1521,7 +1531,7 @@ page.goto("https://example.com")
1521
1531
  ## aria_snapshot
1522
1532
 
1523
1533
  ```
1524
- def aria_snapshot(depth: nil, mode: nil, timeout: nil)
1534
+ def aria_snapshot(boxes: nil, depth: nil, mode: nil, timeout: nil)
1525
1535
  ```
1526
1536
 
1527
1537
 
@@ -1551,7 +1561,7 @@ This method taps an element matching `selector` by performing the following step
1551
1561
  When all steps combined have not finished during the specified `timeout`, this method throws a
1552
1562
  `TimeoutError`. Passing zero timeout disables this.
1553
1563
 
1554
- **NOTE**: [Page#tap_point](./page#tap_point) the method will throw if `hasTouch` option of the browser context is false.
1564
+ **NOTE**: [Page#tap_point](./page#tap_point) will throw if the `hasTouch` option of the browser context is false.
1555
1565
 
1556
1566
  ## text_content
1557
1567
 
@@ -1991,6 +2001,16 @@ Playwright has ability to mock clock and passage of time.
1991
2001
 
1992
2002
  ## keyboard
1993
2003
 
2004
+ ## local_storage
2005
+
2006
+
2007
+ Provides access to the page's `localStorage` for the current origin. See [WebStorage](./web_storage).
2008
+
2009
+ ## session_storage
2010
+
2011
+
2012
+ Provides access to the page's `sessionStorage` for the current origin. See [WebStorage](./web_storage).
2013
+
1994
2014
  ## mouse
1995
2015
 
1996
2016
  ## request
@@ -34,6 +34,34 @@ def not_to_have_url(urlOrRegExp, ignoreCase: nil, timeout: nil)
34
34
 
35
35
  The opposite of [PageAssertions#to_have_url](./page_assertions#to_have_url).
36
36
 
37
+ ## to_match_aria_snapshot
38
+
39
+ ```
40
+ def to_match_aria_snapshot(expected, timeout: nil)
41
+ ```
42
+
43
+
44
+ Asserts that the page body matches the given [accessibility snapshot](https://playwright.dev/python/docs/aria-snapshots).
45
+
46
+ **Usage**
47
+
48
+ ```ruby
49
+ page.goto("https://demo.playwright.dev/todomvc/")
50
+ expect(page).to match_aria_snapshot(<<~YAML)
51
+ - heading "todos"
52
+ - textbox "What needs to be done?"
53
+ YAML
54
+ ```
55
+
56
+ ## not_to_match_aria_snapshot
57
+
58
+ ```
59
+ def not_to_match_aria_snapshot(expected, timeout: nil)
60
+ ```
61
+
62
+
63
+ The opposite of [PageAssertions#to_match_aria_snapshot](./page_assertions#to_match_aria_snapshot).
64
+
37
65
  ## to_have_title
38
66
 
39
67
  ```
@@ -54,6 +54,11 @@ end
54
54
 
55
55
  This object can be used to launch or connect to Firefox, returning instances of [Browser](./browser).
56
56
 
57
+ ## request
58
+
59
+
60
+ Exposes API that can be used for the Web API testing.
61
+
57
62
  ## selectors
58
63
 
59
64
 
@@ -19,4 +19,4 @@ def tap_point(x, y)
19
19
 
20
20
  Dispatches a `touchstart` and `touchend` event with a single touch at the position (`x`,`y`).
21
21
 
22
- **NOTE**: [Page#tap_point](./page#tap_point) the method will throw if `hasTouch` option of the browser context is false.
22
+ **NOTE**: [Touchscreen#tap_point](./touchscreen#tap_point) will throw if the `hasTouch` option of the browser context is false.
@@ -77,6 +77,26 @@ page.goto("http://example.com")
77
77
  context.tracing.stop_chunk(path: "trace2.zip")
78
78
  ```
79
79
 
80
+ ## start_har
81
+
82
+ ```
83
+ def start_har(path, content: nil, mode: nil, urlFilter: nil)
84
+ ```
85
+
86
+
87
+ Start recording a HAR (HTTP Archive) of network activity in this context. The HAR file is written to disk when [Tracing#stop_har](./tracing#stop_har) is called, or when the returned `Disposable` is disposed.
88
+
89
+ Only one HAR recording can be active at a time per [BrowserContext](./browser_context).
90
+
91
+ **Usage**
92
+
93
+ ```ruby
94
+ context.tracing.start_har("trace.har")
95
+ page = context.new_page
96
+ page.goto("https://playwright.dev")
97
+ context.tracing.stop_har
98
+ ```
99
+
80
100
  ## group
81
101
 
82
102
  ```
@@ -128,3 +148,12 @@ def stop_chunk(path: nil)
128
148
 
129
149
 
130
150
  Stop the trace chunk. See [Tracing#start_chunk](./tracing#start_chunk) for more details about multiple trace chunks.
151
+
152
+ ## stop_har
153
+
154
+ ```
155
+ def stop_har
156
+ ```
157
+
158
+
159
+ Stop HAR recording and save the HAR file to the path given to [Tracing#start_har](./tracing#start_har).
@@ -0,0 +1,65 @@
1
+ ---
2
+ sidebar_position: 10
3
+ ---
4
+
5
+ # WebStorage
6
+
7
+
8
+ WebStorage exposes the page's `localStorage` or `sessionStorage` for the current origin via an async,
9
+ [browser-consistent](https://developer.mozilla.org/en-US/docs/Web/API/Storage) API.
10
+
11
+ Instances are accessed through [Page#local_storage](./page#local_storage) and [Page#session_storage](./page#session_storage).
12
+
13
+ ```ruby
14
+ page.goto("https://example.com")
15
+ page.local_storage.set_item("token", "abc")
16
+ token = page.local_storage.get_item("token")
17
+ all = page.local_storage.items
18
+ page.local_storage.remove_item("token")
19
+ page.local_storage.clear
20
+ ```
21
+
22
+ ## items
23
+
24
+ ```
25
+ def items
26
+ ```
27
+
28
+
29
+ Returns all items in the storage as name/value pairs.
30
+
31
+ ## get_item
32
+
33
+ ```
34
+ def get_item(name)
35
+ ```
36
+
37
+
38
+ Returns the value for the given `name` if present.
39
+
40
+ ## set_item
41
+
42
+ ```
43
+ def set_item(name, value)
44
+ ```
45
+
46
+
47
+ Sets the value for the given `name`. Overwrites any existing value for that name.
48
+
49
+ ## remove_item
50
+
51
+ ```
52
+ def remove_item(name)
53
+ ```
54
+
55
+
56
+ Removes the item with the given `name`. No-op if the item is absent.
57
+
58
+ ## clear
59
+
60
+ ```
61
+ def clear
62
+ ```
63
+
64
+
65
+ Removes all items from the storage.