playwright-ruby-client 1.60.0 → 1.62.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 (72) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +12 -17
  3. data/documentation/docs/api/api_response.md +30 -0
  4. data/documentation/docs/api/browser_context.md +11 -3
  5. data/documentation/docs/api/browser_type.md +3 -0
  6. data/documentation/docs/api/credentials.md +136 -0
  7. data/documentation/docs/api/element_handle.md +7 -0
  8. data/documentation/docs/api/frame.md +12 -4
  9. data/documentation/docs/api/locator.md +29 -0
  10. data/documentation/docs/api/locator_assertions.md +4 -2
  11. data/documentation/docs/api/page.md +26 -2
  12. data/documentation/docs/api/playwright.md +2 -2
  13. data/documentation/docs/api/touchscreen.md +1 -1
  14. data/documentation/docs/api/web_storage.md +65 -0
  15. data/documentation/docs/article/getting_started.md +12 -11
  16. data/documentation/docs/article/guides/download_playwright_driver.md +11 -32
  17. data/documentation/docs/article/guides/launch_browser.md +5 -4
  18. data/documentation/docs/article/guides/playwright_on_alpine_linux.md +6 -5
  19. data/documentation/docs/article/guides/rails_integration.md +72 -4
  20. data/documentation/docs/article/guides/rails_integration_with_null_driver.md +4 -3
  21. data/documentation/docs/article/guides/semi_automation.md +1 -1
  22. data/documentation/docs/article/guides/use_storage_state.md +1 -1
  23. data/documentation/docs/include/api_coverage.md +22 -0
  24. data/documentation/docusaurus.config.js +31 -0
  25. data/documentation/package.json +3 -0
  26. data/documentation/yarn.lock +159 -174
  27. data/lib/playwright/api_response_impl.rb +24 -0
  28. data/lib/playwright/channel_owners/browser_context.rb +8 -3
  29. data/lib/playwright/channel_owners/browser_type.rb +2 -1
  30. data/lib/playwright/channel_owners/element_handle.rb +14 -4
  31. data/lib/playwright/channel_owners/frame.rb +50 -17
  32. data/lib/playwright/channel_owners/page.rb +31 -10
  33. data/lib/playwright/connection.rb +16 -2
  34. data/lib/playwright/credentials_impl.rb +35 -0
  35. data/lib/playwright/errors.rb +4 -1
  36. data/lib/playwright/locator_assertions_impl.rb +14 -1
  37. data/lib/playwright/locator_impl.rb +28 -5
  38. data/lib/playwright/locator_utils.rb +9 -1
  39. data/lib/playwright/screencast.rb +22 -6
  40. data/lib/playwright/screenshot_utils.rb +24 -0
  41. data/lib/playwright/test.rb +12 -2
  42. data/lib/playwright/url_matcher.rb +120 -4
  43. data/lib/playwright/version.rb +2 -2
  44. data/lib/playwright/waiter.rb +9 -41
  45. data/lib/playwright/web_storage_impl.rb +34 -0
  46. data/lib/playwright.rb +2 -2
  47. data/lib/playwright_api/api_request_context.rb +6 -6
  48. data/lib/playwright_api/api_response.rb +21 -0
  49. data/lib/playwright_api/browser.rb +6 -6
  50. data/lib/playwright_api/browser_context.rb +27 -18
  51. data/lib/playwright_api/browser_type.rb +10 -7
  52. data/lib/playwright_api/cdp_session.rb +6 -6
  53. data/lib/playwright_api/credentials.rb +124 -0
  54. data/lib/playwright_api/dialog.rb +6 -6
  55. data/lib/playwright_api/element_handle.rb +20 -13
  56. data/lib/playwright_api/frame.rb +36 -28
  57. data/lib/playwright_api/js_handle.rb +6 -6
  58. data/lib/playwright_api/locator.rb +37 -11
  59. data/lib/playwright_api/locator_assertions.rb +6 -4
  60. data/lib/playwright_api/page.rb +55 -29
  61. data/lib/playwright_api/playwright.rb +6 -6
  62. data/lib/playwright_api/request.rb +6 -6
  63. data/lib/playwright_api/response.rb +6 -6
  64. data/lib/playwright_api/route.rb +6 -6
  65. data/lib/playwright_api/touchscreen.rb +1 -1
  66. data/lib/playwright_api/tracing.rb +6 -6
  67. data/lib/playwright_api/web_socket.rb +6 -6
  68. data/lib/playwright_api/web_storage.rb +48 -0
  69. data/lib/playwright_api/worker.rb +6 -6
  70. data/playwright.gemspec +5 -0
  71. data/sig/playwright.rbs +62 -40
  72. metadata +13 -3
@@ -168,9 +168,10 @@ module Playwright
168
168
  force: nil,
169
169
  noWaitAfter: nil,
170
170
  position: nil,
171
+ scroll: nil,
171
172
  timeout: nil,
172
173
  trial: nil)
173
- wrap_impl(@impl.check(force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
174
+ wrap_impl(@impl.check(force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), scroll: unwrap_impl(scroll), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
174
175
  end
175
176
 
176
177
  #
@@ -230,10 +231,11 @@ module Playwright
230
231
  modifiers: nil,
231
232
  noWaitAfter: nil,
232
233
  position: nil,
234
+ scroll: nil,
233
235
  steps: nil,
234
236
  timeout: nil,
235
237
  trial: nil)
236
- wrap_impl(@impl.click(button: unwrap_impl(button), clickCount: unwrap_impl(clickCount), delay: unwrap_impl(delay), force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), steps: unwrap_impl(steps), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
238
+ wrap_impl(@impl.click(button: unwrap_impl(button), clickCount: unwrap_impl(clickCount), delay: unwrap_impl(delay), force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), scroll: unwrap_impl(scroll), steps: unwrap_impl(steps), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
237
239
  end
238
240
 
239
241
  #
@@ -273,10 +275,11 @@ module Playwright
273
275
  modifiers: nil,
274
276
  noWaitAfter: nil,
275
277
  position: nil,
278
+ scroll: nil,
276
279
  steps: nil,
277
280
  timeout: nil,
278
281
  trial: nil)
279
- wrap_impl(@impl.dblclick(button: unwrap_impl(button), delay: unwrap_impl(delay), force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), steps: unwrap_impl(steps), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
282
+ wrap_impl(@impl.dblclick(button: unwrap_impl(button), delay: unwrap_impl(delay), force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), scroll: unwrap_impl(scroll), steps: unwrap_impl(steps), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
280
283
  end
281
284
 
282
285
  #
@@ -378,12 +381,13 @@ module Playwright
378
381
  target,
379
382
  force: nil,
380
383
  noWaitAfter: nil,
384
+ scroll: nil,
381
385
  sourcePosition: nil,
382
386
  steps: nil,
383
387
  targetPosition: nil,
384
388
  timeout: nil,
385
389
  trial: nil)
386
- wrap_impl(@impl.drag_to(unwrap_impl(target), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), sourcePosition: unwrap_impl(sourcePosition), steps: unwrap_impl(steps), targetPosition: unwrap_impl(targetPosition), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
390
+ wrap_impl(@impl.drag_to(unwrap_impl(target), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), scroll: unwrap_impl(scroll), sourcePosition: unwrap_impl(sourcePosition), steps: unwrap_impl(steps), targetPosition: unwrap_impl(targetPosition), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
387
391
  end
388
392
 
389
393
  #
@@ -807,9 +811,10 @@ module Playwright
807
811
  modifiers: nil,
808
812
  noWaitAfter: nil,
809
813
  position: nil,
814
+ scroll: nil,
810
815
  timeout: nil,
811
816
  trial: nil)
812
- wrap_impl(@impl.hover(force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
817
+ wrap_impl(@impl.hover(force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), scroll: unwrap_impl(scroll), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
813
818
  end
814
819
 
815
820
  #
@@ -1187,9 +1192,10 @@ module Playwright
1187
1192
  force: nil,
1188
1193
  noWaitAfter: nil,
1189
1194
  position: nil,
1195
+ scroll: nil,
1190
1196
  timeout: nil,
1191
1197
  trial: nil)
1192
- wrap_impl(@impl.set_checked(unwrap_impl(checked), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
1198
+ wrap_impl(@impl.set_checked(unwrap_impl(checked), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), scroll: unwrap_impl(scroll), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
1193
1199
  end
1194
1200
  alias_method :checked=, :set_checked
1195
1201
 
@@ -1253,9 +1259,10 @@ module Playwright
1253
1259
  modifiers: nil,
1254
1260
  noWaitAfter: nil,
1255
1261
  position: nil,
1262
+ scroll: nil,
1256
1263
  timeout: nil,
1257
1264
  trial: nil)
1258
- wrap_impl(@impl.tap_point(force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
1265
+ wrap_impl(@impl.tap_point(force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), scroll: unwrap_impl(scroll), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
1259
1266
  end
1260
1267
 
1261
1268
  #
@@ -1304,9 +1311,10 @@ module Playwright
1304
1311
  force: nil,
1305
1312
  noWaitAfter: nil,
1306
1313
  position: nil,
1314
+ scroll: nil,
1307
1315
  timeout: nil,
1308
1316
  trial: nil)
1309
- wrap_impl(@impl.uncheck(force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
1317
+ wrap_impl(@impl.uncheck(force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), scroll: unwrap_impl(scroll), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
1310
1318
  end
1311
1319
 
1312
1320
  #
@@ -1325,9 +1333,22 @@ module Playwright
1325
1333
  wrap_impl(@impl.wait_for(state: unwrap_impl(state), timeout: unwrap_impl(timeout)))
1326
1334
  end
1327
1335
 
1328
- # @nodoc
1329
- def resolve_selector
1330
- wrap_impl(@impl.resolve_selector)
1336
+ #
1337
+ # Returns when `expression` returns a truthy value, called with the matching element as a first argument, and `arg` as a second argument.
1338
+ #
1339
+ # This is a generic way to wait for an element to reach a custom condition without asserting it. The locator is re-resolved on each retry, so it tolerates the element being re-rendered while waiting.
1340
+ #
1341
+ # If `expression` returns a [Promise], this method will wait for the promise to resolve before checking its value.
1342
+ #
1343
+ # If `expression` throws or rejects, this method throws.
1344
+ #
1345
+ # **Usage**
1346
+ #
1347
+ # Wait for an attribute to appear:
1348
+ #
1349
+ # Passing argument to `expression`:
1350
+ def wait_for_function(expression, arg: nil, timeout: nil)
1351
+ wrap_impl(@impl.wait_for_function(unwrap_impl(expression), arg: unwrap_impl(arg), timeout: unwrap_impl(timeout)))
1331
1352
  end
1332
1353
 
1333
1354
  # @nodoc
@@ -1340,6 +1361,11 @@ module Playwright
1340
1361
  wrap_impl(@impl._assertions(unwrap_impl(timeout), unwrap_impl(is_not), unwrap_impl(message)))
1341
1362
  end
1342
1363
 
1364
+ # @nodoc
1365
+ def resolve_selector
1366
+ wrap_impl(@impl.resolve_selector)
1367
+ end
1368
+
1343
1369
  # @nodoc
1344
1370
  def to_s
1345
1371
  wrap_impl(@impl.to_s)
@@ -104,8 +104,8 @@ module Playwright
104
104
 
105
105
  #
106
106
  # The opposite of [`method: LocatorAssertions.toHaveAttribute`].
107
- def not_to_have_attribute(name, value, ignoreCase: nil, timeout: nil)
108
- wrap_impl(@impl.not_to_have_attribute(unwrap_impl(name), unwrap_impl(value), ignoreCase: unwrap_impl(ignoreCase), timeout: unwrap_impl(timeout)))
107
+ def not_to_have_attribute(name, value: nil, ignoreCase: nil, timeout: nil)
108
+ wrap_impl(@impl.not_to_have_attribute(unwrap_impl(name), value: unwrap_impl(value), ignoreCase: unwrap_impl(ignoreCase), timeout: unwrap_impl(timeout)))
109
109
  end
110
110
 
111
111
  #
@@ -477,9 +477,11 @@ module Playwright
477
477
  #
478
478
  # locator = page.locator("input")
479
479
  # expect(locator).to_have_attribute("type", "text")
480
+ # expect(locator).to_have_attribute("disabled")
481
+ # expect(locator).not_to_have_attribute("readonly")
480
482
  # ```
481
- def to_have_attribute(name, value, ignoreCase: nil, timeout: nil)
482
- wrap_impl(@impl.to_have_attribute(unwrap_impl(name), unwrap_impl(value), ignoreCase: unwrap_impl(ignoreCase), timeout: unwrap_impl(timeout)))
483
+ def to_have_attribute(name, value: nil, ignoreCase: nil, timeout: nil)
484
+ wrap_impl(@impl.to_have_attribute(unwrap_impl(name), value: unwrap_impl(value), ignoreCase: unwrap_impl(ignoreCase), timeout: unwrap_impl(timeout)))
483
485
  end
484
486
 
485
487
  #
@@ -53,6 +53,18 @@ module Playwright
53
53
  wrap_impl(@impl.keyboard)
54
54
  end
55
55
 
56
+ #
57
+ # Provides access to the page's `localStorage` for the current origin. See `WebStorage`.
58
+ def local_storage # property
59
+ wrap_impl(@impl.local_storage)
60
+ end
61
+
62
+ #
63
+ # Provides access to the page's `sessionStorage` for the current origin. See `WebStorage`.
64
+ def session_storage # property
65
+ wrap_impl(@impl.session_storage)
66
+ end
67
+
56
68
  def mouse # property
57
69
  wrap_impl(@impl.mouse)
58
70
  end
@@ -142,10 +154,11 @@ module Playwright
142
154
  force: nil,
143
155
  noWaitAfter: nil,
144
156
  position: nil,
157
+ scroll: nil,
145
158
  strict: nil,
146
159
  timeout: nil,
147
160
  trial: nil)
148
- wrap_impl(@impl.check(unwrap_impl(selector), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
161
+ wrap_impl(@impl.check(unwrap_impl(selector), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), scroll: unwrap_impl(scroll), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
149
162
  end
150
163
 
151
164
  #
@@ -167,10 +180,11 @@ module Playwright
167
180
  modifiers: nil,
168
181
  noWaitAfter: nil,
169
182
  position: nil,
183
+ scroll: nil,
170
184
  strict: nil,
171
185
  timeout: nil,
172
186
  trial: nil)
173
- wrap_impl(@impl.click(unwrap_impl(selector), button: unwrap_impl(button), clickCount: unwrap_impl(clickCount), delay: unwrap_impl(delay), force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
187
+ wrap_impl(@impl.click(unwrap_impl(selector), button: unwrap_impl(button), clickCount: unwrap_impl(clickCount), delay: unwrap_impl(delay), force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), scroll: unwrap_impl(scroll), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
174
188
  end
175
189
 
176
190
  #
@@ -216,10 +230,11 @@ module Playwright
216
230
  modifiers: nil,
217
231
  noWaitAfter: nil,
218
232
  position: nil,
233
+ scroll: nil,
219
234
  strict: nil,
220
235
  timeout: nil,
221
236
  trial: nil)
222
- wrap_impl(@impl.dblclick(unwrap_impl(selector), button: unwrap_impl(button), delay: unwrap_impl(delay), force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
237
+ wrap_impl(@impl.dblclick(unwrap_impl(selector), button: unwrap_impl(button), delay: unwrap_impl(delay), force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), scroll: unwrap_impl(scroll), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
223
238
  end
224
239
 
225
240
  #
@@ -288,13 +303,14 @@ module Playwright
288
303
  target,
289
304
  force: nil,
290
305
  noWaitAfter: nil,
306
+ scroll: nil,
291
307
  sourcePosition: nil,
292
308
  steps: nil,
293
309
  strict: nil,
294
310
  targetPosition: nil,
295
311
  timeout: nil,
296
312
  trial: nil)
297
- wrap_impl(@impl.drag_and_drop(unwrap_impl(source), unwrap_impl(target), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), sourcePosition: unwrap_impl(sourcePosition), steps: unwrap_impl(steps), strict: unwrap_impl(strict), targetPosition: unwrap_impl(targetPosition), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
313
+ wrap_impl(@impl.drag_and_drop(unwrap_impl(source), unwrap_impl(target), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), scroll: unwrap_impl(scroll), sourcePosition: unwrap_impl(sourcePosition), steps: unwrap_impl(steps), strict: unwrap_impl(strict), targetPosition: unwrap_impl(targetPosition), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
298
314
  end
299
315
 
300
316
  #
@@ -402,7 +418,7 @@ module Playwright
402
418
  # `ElementHandle` instances can be passed as an argument to the [`method: Page.evaluate`]:
403
419
  #
404
420
  # ```python sync
405
- # body_handle = page.evaluate("document.body")
421
+ # body_handle = page.evaluate_handle("document.body")
406
422
  # html = page.evaluate("([body, suffix]) => body.innerHTML + suffix", [body_handle, "hello"])
407
423
  # body_handle.dispose()
408
424
  # ```
@@ -798,6 +814,9 @@ module Playwright
798
814
  # last redirect. If cannot go back, returns `null`.
799
815
  #
800
816
  # Navigate to the previous page in history.
817
+ #
818
+ # **NOTE**: **Testing Back/Forward Cache (BFCache) is not supported.**
819
+ # By default, Playwright disables the Back/Forward Cache across all browsers. Even if explicitly enabled, Playwright's internal state relies on network-level navigation events. Because BFCache restores unfreeze the DOM without firing these events, using `page.goBack()` or `page.goForward()` to trigger a BFCache restore will result in timeouts and a desynchronized `Page` state.
801
820
  def go_back(timeout: nil, waitUntil: nil)
802
821
  wrap_impl(@impl.go_back(timeout: unwrap_impl(timeout), waitUntil: unwrap_impl(waitUntil)))
803
822
  end
@@ -807,6 +826,9 @@ module Playwright
807
826
  # last redirect. If cannot go forward, returns `null`.
808
827
  #
809
828
  # Navigate to the next page in history.
829
+ #
830
+ # **NOTE**: **Testing Back/Forward Cache (BFCache) is not supported.**
831
+ # By default, Playwright disables the Back/Forward Cache across all browsers. Even if explicitly enabled, Playwright's internal state relies on network-level navigation events. Because BFCache restores unfreeze the DOM without firing these events, using `page.goBack()` or `page.goForward()` to trigger a BFCache restore will result in timeouts and a desynchronized `Page` state.
810
832
  def go_forward(timeout: nil, waitUntil: nil)
811
833
  wrap_impl(@impl.go_forward(timeout: unwrap_impl(timeout), waitUntil: unwrap_impl(waitUntil)))
812
834
  end
@@ -873,10 +895,11 @@ module Playwright
873
895
  modifiers: nil,
874
896
  noWaitAfter: nil,
875
897
  position: nil,
898
+ scroll: nil,
876
899
  strict: nil,
877
900
  timeout: nil,
878
901
  trial: nil)
879
- wrap_impl(@impl.hover(unwrap_impl(selector), force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
902
+ wrap_impl(@impl.hover(unwrap_impl(selector), force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), scroll: unwrap_impl(scroll), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
880
903
  end
881
904
 
882
905
  #
@@ -1396,10 +1419,11 @@ module Playwright
1396
1419
  force: nil,
1397
1420
  noWaitAfter: nil,
1398
1421
  position: nil,
1422
+ scroll: nil,
1399
1423
  strict: nil,
1400
1424
  timeout: nil,
1401
1425
  trial: nil)
1402
- wrap_impl(@impl.set_checked(unwrap_impl(selector), unwrap_impl(checked), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
1426
+ wrap_impl(@impl.set_checked(unwrap_impl(selector), unwrap_impl(checked), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), scroll: unwrap_impl(scroll), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
1403
1427
  end
1404
1428
 
1405
1429
  #
@@ -1495,17 +1519,18 @@ module Playwright
1495
1519
  # When all steps combined have not finished during the specified `timeout`, this method throws a
1496
1520
  # `TimeoutError`. Passing zero timeout disables this.
1497
1521
  #
1498
- # **NOTE**: [`method: Page.tap`] the method will throw if `hasTouch` option of the browser context is false.
1522
+ # **NOTE**: [`method: Page.tap`] will throw if the `hasTouch` option of the browser context is false.
1499
1523
  def tap_point(
1500
1524
  selector,
1501
1525
  force: nil,
1502
1526
  modifiers: nil,
1503
1527
  noWaitAfter: nil,
1504
1528
  position: nil,
1529
+ scroll: nil,
1505
1530
  strict: nil,
1506
1531
  timeout: nil,
1507
1532
  trial: nil)
1508
- wrap_impl(@impl.tap_point(unwrap_impl(selector), force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
1533
+ wrap_impl(@impl.tap_point(unwrap_impl(selector), force: unwrap_impl(force), modifiers: unwrap_impl(modifiers), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), scroll: unwrap_impl(scroll), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
1509
1534
  end
1510
1535
 
1511
1536
  #
@@ -1555,10 +1580,11 @@ module Playwright
1555
1580
  force: nil,
1556
1581
  noWaitAfter: nil,
1557
1582
  position: nil,
1583
+ scroll: nil,
1558
1584
  strict: nil,
1559
1585
  timeout: nil,
1560
1586
  trial: nil)
1561
- wrap_impl(@impl.uncheck(unwrap_impl(selector), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
1587
+ wrap_impl(@impl.uncheck(unwrap_impl(selector), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), scroll: unwrap_impl(scroll), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
1562
1588
  end
1563
1589
 
1564
1590
  #
@@ -1869,8 +1895,8 @@ module Playwright
1869
1895
  end
1870
1896
 
1871
1897
  # @nodoc
1872
- def start_css_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
1873
- wrap_impl(@impl.start_css_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
1898
+ def snapshot_for_ai(timeout: nil, depth: nil, boxes: nil)
1899
+ wrap_impl(@impl.snapshot_for_ai(timeout: unwrap_impl(timeout), depth: unwrap_impl(depth), boxes: unwrap_impl(boxes)))
1874
1900
  end
1875
1901
 
1876
1902
  # @nodoc
@@ -1879,18 +1905,13 @@ module Playwright
1879
1905
  end
1880
1906
 
1881
1907
  # @nodoc
1882
- def guid
1883
- wrap_impl(@impl.guid)
1884
- end
1885
-
1886
- # @nodoc
1887
- def owned_context=(req)
1888
- wrap_impl(@impl.owned_context=(unwrap_impl(req)))
1908
+ def start_css_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
1909
+ wrap_impl(@impl.start_css_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
1889
1910
  end
1890
1911
 
1891
1912
  # @nodoc
1892
- def snapshot_for_ai(timeout: nil, depth: nil, boxes: nil, _track: nil)
1893
- wrap_impl(@impl.snapshot_for_ai(timeout: unwrap_impl(timeout), depth: unwrap_impl(depth), boxes: unwrap_impl(boxes), _track: unwrap_impl(_track)))
1913
+ def stop_css_coverage
1914
+ wrap_impl(@impl.stop_css_coverage)
1894
1915
  end
1895
1916
 
1896
1917
  # @nodoc
@@ -1904,26 +1925,31 @@ module Playwright
1904
1925
  end
1905
1926
 
1906
1927
  # @nodoc
1907
- def stop_css_coverage
1908
- wrap_impl(@impl.stop_css_coverage)
1928
+ def guid
1929
+ wrap_impl(@impl.guid)
1930
+ end
1931
+
1932
+ # @nodoc
1933
+ def owned_context=(req)
1934
+ wrap_impl(@impl.owned_context=(unwrap_impl(req)))
1909
1935
  end
1910
1936
 
1911
1937
  # -- inherited from EventEmitter --
1912
1938
  # @nodoc
1913
- def on(event, callback)
1914
- event_emitter_proxy.on(event, callback)
1939
+ def once(event, callback)
1940
+ event_emitter_proxy.once(event, callback)
1915
1941
  end
1916
1942
 
1917
1943
  # -- inherited from EventEmitter --
1918
1944
  # @nodoc
1919
- def off(event, callback)
1920
- event_emitter_proxy.off(event, callback)
1945
+ def on(event, callback)
1946
+ event_emitter_proxy.on(event, callback)
1921
1947
  end
1922
1948
 
1923
1949
  # -- inherited from EventEmitter --
1924
1950
  # @nodoc
1925
- def once(event, callback)
1926
- event_emitter_proxy.once(event, callback)
1951
+ def off(event, callback)
1952
+ event_emitter_proxy.off(event, callback)
1927
1953
  end
1928
1954
 
1929
1955
  private def event_emitter_proxy
@@ -105,20 +105,20 @@ module Playwright
105
105
 
106
106
  # -- inherited from EventEmitter --
107
107
  # @nodoc
108
- def on(event, callback)
109
- event_emitter_proxy.on(event, callback)
108
+ def once(event, callback)
109
+ event_emitter_proxy.once(event, callback)
110
110
  end
111
111
 
112
112
  # -- inherited from EventEmitter --
113
113
  # @nodoc
114
- def off(event, callback)
115
- event_emitter_proxy.off(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 once(event, callback)
121
- event_emitter_proxy.once(event, callback)
120
+ def off(event, callback)
121
+ event_emitter_proxy.off(event, callback)
122
122
  end
123
123
 
124
124
  private def event_emitter_proxy
@@ -229,20 +229,20 @@ module Playwright
229
229
 
230
230
  # -- inherited from EventEmitter --
231
231
  # @nodoc
232
- def on(event, callback)
233
- event_emitter_proxy.on(event, callback)
232
+ def once(event, callback)
233
+ event_emitter_proxy.once(event, callback)
234
234
  end
235
235
 
236
236
  # -- inherited from EventEmitter --
237
237
  # @nodoc
238
- def off(event, callback)
239
- event_emitter_proxy.off(event, callback)
238
+ def on(event, callback)
239
+ event_emitter_proxy.on(event, callback)
240
240
  end
241
241
 
242
242
  # -- inherited from EventEmitter --
243
243
  # @nodoc
244
- def once(event, callback)
245
- event_emitter_proxy.once(event, callback)
244
+ def off(event, callback)
245
+ event_emitter_proxy.off(event, callback)
246
246
  end
247
247
 
248
248
  private def event_emitter_proxy
@@ -135,20 +135,20 @@ module Playwright
135
135
 
136
136
  # -- inherited from EventEmitter --
137
137
  # @nodoc
138
- def on(event, callback)
139
- event_emitter_proxy.on(event, callback)
138
+ def once(event, callback)
139
+ event_emitter_proxy.once(event, callback)
140
140
  end
141
141
 
142
142
  # -- inherited from EventEmitter --
143
143
  # @nodoc
144
- def off(event, callback)
145
- event_emitter_proxy.off(event, callback)
144
+ def on(event, callback)
145
+ event_emitter_proxy.on(event, callback)
146
146
  end
147
147
 
148
148
  # -- inherited from EventEmitter --
149
149
  # @nodoc
150
- def once(event, callback)
151
- event_emitter_proxy.once(event, callback)
150
+ def off(event, callback)
151
+ event_emitter_proxy.off(event, callback)
152
152
  end
153
153
 
154
154
  private def event_emitter_proxy
@@ -179,20 +179,20 @@ module Playwright
179
179
 
180
180
  # -- inherited from EventEmitter --
181
181
  # @nodoc
182
- def on(event, callback)
183
- event_emitter_proxy.on(event, callback)
182
+ def once(event, callback)
183
+ event_emitter_proxy.once(event, callback)
184
184
  end
185
185
 
186
186
  # -- inherited from EventEmitter --
187
187
  # @nodoc
188
- def off(event, callback)
189
- event_emitter_proxy.off(event, callback)
188
+ def on(event, callback)
189
+ event_emitter_proxy.on(event, callback)
190
190
  end
191
191
 
192
192
  # -- inherited from EventEmitter --
193
193
  # @nodoc
194
- def once(event, callback)
195
- event_emitter_proxy.once(event, callback)
194
+ def off(event, callback)
195
+ event_emitter_proxy.off(event, callback)
196
196
  end
197
197
 
198
198
  private def event_emitter_proxy
@@ -9,7 +9,7 @@ module Playwright
9
9
  #
10
10
  # Dispatches a `touchstart` and `touchend` event with a single touch at the position (`x`,`y`).
11
11
  #
12
- # **NOTE**: [`method: Page.tap`] the method will throw if `hasTouch` option of the browser context is false.
12
+ # **NOTE**: [`method: Touchscreen.tap`] will throw if the `hasTouch` option of the browser context is false.
13
13
  def tap_point(x, y)
14
14
  wrap_impl(@impl.tap_point(unwrap_impl(x), unwrap_impl(y)))
15
15
  end
@@ -129,20 +129,20 @@ module Playwright
129
129
 
130
130
  # -- inherited from EventEmitter --
131
131
  # @nodoc
132
- def on(event, callback)
133
- event_emitter_proxy.on(event, callback)
132
+ def once(event, callback)
133
+ event_emitter_proxy.once(event, callback)
134
134
  end
135
135
 
136
136
  # -- inherited from EventEmitter --
137
137
  # @nodoc
138
- def off(event, callback)
139
- event_emitter_proxy.off(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 once(event, callback)
145
- event_emitter_proxy.once(event, callback)
144
+ def off(event, callback)
145
+ event_emitter_proxy.off(event, callback)
146
146
  end
147
147
 
148
148
  private def event_emitter_proxy
@@ -36,20 +36,20 @@ module Playwright
36
36
 
37
37
  # -- inherited from EventEmitter --
38
38
  # @nodoc
39
- def on(event, callback)
40
- event_emitter_proxy.on(event, callback)
39
+ def once(event, callback)
40
+ event_emitter_proxy.once(event, callback)
41
41
  end
42
42
 
43
43
  # -- inherited from EventEmitter --
44
44
  # @nodoc
45
- def off(event, callback)
46
- event_emitter_proxy.off(event, callback)
45
+ def on(event, callback)
46
+ event_emitter_proxy.on(event, callback)
47
47
  end
48
48
 
49
49
  # -- inherited from EventEmitter --
50
50
  # @nodoc
51
- def once(event, callback)
52
- event_emitter_proxy.once(event, callback)
51
+ def off(event, callback)
52
+ event_emitter_proxy.off(event, callback)
53
53
  end
54
54
 
55
55
  private def event_emitter_proxy
@@ -0,0 +1,48 @@
1
+ module Playwright
2
+ #
3
+ # WebStorage exposes the page's `localStorage` or `sessionStorage` for the current origin via an async,
4
+ # [browser-consistent](https://developer.mozilla.org/en-US/docs/Web/API/Storage) API.
5
+ #
6
+ # Instances are accessed through [`property: Page.localStorage`] and [`property: Page.sessionStorage`].
7
+ #
8
+ # ```python sync
9
+ # page.goto("https://example.com")
10
+ # page.local_storage.set_item("token", "abc")
11
+ # token = page.local_storage.get_item("token")
12
+ # all = page.local_storage.items()
13
+ # page.local_storage.remove_item("token")
14
+ # page.local_storage.clear()
15
+ # ```
16
+ class WebStorage < PlaywrightApi
17
+
18
+ #
19
+ # Returns all items in the storage as name/value pairs.
20
+ def items
21
+ wrap_impl(@impl.items)
22
+ end
23
+
24
+ #
25
+ # Returns the value for the given `name` if present.
26
+ def get_item(name)
27
+ wrap_impl(@impl.get_item(unwrap_impl(name)))
28
+ end
29
+
30
+ #
31
+ # Sets the value for the given `name`. Overwrites any existing value for that name.
32
+ def set_item(name, value)
33
+ wrap_impl(@impl.set_item(unwrap_impl(name), unwrap_impl(value)))
34
+ end
35
+
36
+ #
37
+ # Removes the item with the given `name`. No-op if the item is absent.
38
+ def remove_item(name)
39
+ wrap_impl(@impl.remove_item(unwrap_impl(name)))
40
+ end
41
+
42
+ #
43
+ # Removes all items from the storage.
44
+ def clear
45
+ wrap_impl(@impl.clear)
46
+ end
47
+ end
48
+ end
@@ -75,20 +75,20 @@ module Playwright
75
75
 
76
76
  # -- inherited from EventEmitter --
77
77
  # @nodoc
78
- def on(event, callback)
79
- event_emitter_proxy.on(event, callback)
78
+ def once(event, callback)
79
+ event_emitter_proxy.once(event, callback)
80
80
  end
81
81
 
82
82
  # -- inherited from EventEmitter --
83
83
  # @nodoc
84
- def off(event, callback)
85
- event_emitter_proxy.off(event, callback)
84
+ def on(event, callback)
85
+ event_emitter_proxy.on(event, callback)
86
86
  end
87
87
 
88
88
  # -- inherited from EventEmitter --
89
89
  # @nodoc
90
- def once(event, callback)
91
- event_emitter_proxy.once(event, callback)
90
+ def off(event, callback)
91
+ event_emitter_proxy.off(event, callback)
92
92
  end
93
93
 
94
94
  private def event_emitter_proxy
data/playwright.gemspec CHANGED
@@ -14,6 +14,11 @@ Gem::Specification.new do |spec|
14
14
  spec.summary = "The Ruby binding of playwright driver #{Playwright::COMPATIBLE_PLAYWRIGHT_VERSION}"
15
15
  spec.homepage = 'https://github.com/YusukeIwaki/playwright-ruby-client'
16
16
  spec.license = 'MIT'
17
+ spec.metadata = {
18
+ 'documentation_uri' => 'https://playwright-ruby-client.vercel.app/docs/article/getting_started',
19
+ 'source_code_uri' => spec.homepage,
20
+ 'bug_tracker_uri' => "#{spec.homepage}/issues",
21
+ }
17
22
 
18
23
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
19
24
  `git ls-files -z`.split("\x0").reject do |f|