playwright-ruby-client 1.37.1 → 1.39.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +13 -7
  3. data/documentation/docs/api/browser.md +13 -9
  4. data/documentation/docs/api/browser_context.md +51 -32
  5. data/documentation/docs/api/browser_type.md +12 -7
  6. data/documentation/docs/api/dialog.md +18 -15
  7. data/documentation/docs/api/download.md +17 -7
  8. data/documentation/docs/api/element_handle.md +7 -19
  9. data/documentation/docs/api/frame.md +55 -30
  10. data/documentation/docs/api/keyboard.md +4 -0
  11. data/documentation/docs/api/locator.md +57 -16
  12. data/documentation/docs/api/page.md +102 -54
  13. data/documentation/docs/api/playwright.md +23 -20
  14. data/documentation/docs/api/request.md +17 -0
  15. data/documentation/docs/api/selectors.md +34 -29
  16. data/documentation/docs/include/api_coverage.md +1 -0
  17. data/lib/playwright/channel.rb +8 -0
  18. data/lib/playwright/channel_owner.rb +7 -2
  19. data/lib/playwright/channel_owners/browser_context.rb +16 -1
  20. data/lib/playwright/channel_owners/local_utils.rb +27 -0
  21. data/lib/playwright/channel_owners/page.rb +2 -0
  22. data/lib/playwright/channel_owners/playwright.rb +1 -24
  23. data/lib/playwright/channel_owners/request.rb +17 -1
  24. data/lib/playwright/channel_owners/route.rb +5 -1
  25. data/lib/playwright/connection.rb +1 -1
  26. data/lib/playwright/console_message_impl.rb +29 -0
  27. data/lib/playwright/errors.rb +13 -2
  28. data/lib/playwright/events.rb +1 -0
  29. data/lib/playwright/javascript/value_parser.rb +8 -0
  30. data/lib/playwright/javascript/value_serializer.rb +10 -4
  31. data/lib/playwright/locator_impl.rb +4 -0
  32. data/lib/playwright/utils.rb +4 -0
  33. data/lib/playwright/version.rb +2 -2
  34. data/lib/playwright_api/browser.rb +2 -2
  35. data/lib/playwright_api/browser_context.rb +4 -4
  36. data/lib/playwright_api/browser_type.rb +2 -2
  37. data/lib/playwright_api/console_message.rb +0 -22
  38. data/lib/playwright_api/dialog.rb +2 -2
  39. data/lib/playwright_api/download.rb +12 -3
  40. data/lib/playwright_api/element_handle.rb +2 -15
  41. data/lib/playwright_api/frame.rb +8 -13
  42. data/lib/playwright_api/keyboard.rb +4 -0
  43. data/lib/playwright_api/locator.rb +52 -16
  44. data/lib/playwright_api/page.rb +24 -29
  45. data/lib/playwright_api/playwright.rb +4 -4
  46. data/lib/playwright_api/request.rb +17 -0
  47. data/lib/playwright_api/selectors.rb +2 -2
  48. data/lib/playwright_api/worker.rb +4 -4
  49. data/sig/playwright.rbs +1 -0
  50. metadata +4 -4
  51. data/lib/playwright/channel_owners/console_message.rb +0 -25
@@ -8,9 +8,9 @@ module Playwright
8
8
  # This example creates a page, navigates it to a URL, and then saves a screenshot:
9
9
  #
10
10
  # ```python sync
11
- # from playwright.sync_api import sync_playwright
11
+ # from playwright.sync_api import sync_playwright, Playwright
12
12
  #
13
- # def run(playwright):
13
+ # def run(playwright: Playwright):
14
14
  # webkit = playwright.webkit
15
15
  # browser = webkit.launch()
16
16
  # context = browser.new_context()
@@ -438,9 +438,9 @@ module Playwright
438
438
  # An example of exposing page URL to all frames in a page:
439
439
  #
440
440
  # ```python sync
441
- # from playwright.sync_api import sync_playwright
441
+ # from playwright.sync_api import sync_playwright, Playwright
442
442
  #
443
- # def run(playwright):
443
+ # def run(playwright: Playwright):
444
444
  # webkit = playwright.webkit
445
445
  # browser = webkit.launch(headless=false)
446
446
  # context = browser.new_context()
@@ -496,7 +496,7 @@ module Playwright
496
496
  #
497
497
  # ```python sync
498
498
  # import hashlib
499
- # from playwright.sync_api import sync_playwright
499
+ # from playwright.sync_api import sync_playwright, Playwright
500
500
  #
501
501
  # def sha256(text):
502
502
  # m = hashlib.sha256()
@@ -504,7 +504,7 @@ module Playwright
504
504
  # return m.hexdigest()
505
505
  #
506
506
  #
507
- # def run(playwright):
507
+ # def run(playwright: Playwright):
508
508
  # webkit = playwright.webkit
509
509
  # browser = webkit.launch(headless=False)
510
510
  # page = browser.new_page()
@@ -532,7 +532,7 @@ module Playwright
532
532
  #
533
533
  # If the target element is not an `<input>`, `<textarea>` or `[contenteditable]` element, this method throws an error. However, if the element is inside the `<label>` element that has an associated [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be filled instead.
534
534
  #
535
- # To send fine-grained keyboard events, use [`method: Page.type`].
535
+ # To send fine-grained keyboard events, use [`method: Locator.pressSequentially`].
536
536
  def fill(
537
537
  selector,
538
538
  value,
@@ -1176,7 +1176,7 @@ module Playwright
1176
1176
  # **Usage**
1177
1177
  #
1178
1178
  # ```python sync
1179
- # # single selection matching the value
1179
+ # # Single selection matching the value or label
1180
1180
  # page.select_option("select#colors", "blue")
1181
1181
  # # single selection matching both the label
1182
1182
  # page.select_option("select#colors", label="blue")
@@ -1340,11 +1340,6 @@ module Playwright
1340
1340
  # To press a special key, like `Control` or `ArrowDown`, use [`method: Keyboard.press`].
1341
1341
  #
1342
1342
  # **Usage**
1343
- #
1344
- # ```python sync
1345
- # page.type("#mytextarea", "hello") # types instantly
1346
- # page.type("#mytextarea", "world", delay=100) # types slower, like a user
1347
- # ```
1348
1343
  def type(
1349
1344
  selector,
1350
1345
  text,
@@ -1446,9 +1441,9 @@ module Playwright
1446
1441
  # The [`method: Page.waitForFunction`] can be used to observe viewport size change:
1447
1442
  #
1448
1443
  # ```python sync
1449
- # from playwright.sync_api import sync_playwright
1444
+ # from playwright.sync_api import sync_playwright, Playwright
1450
1445
  #
1451
- # def run(playwright):
1446
+ # def run(playwright: Playwright):
1452
1447
  # webkit = playwright.webkit
1453
1448
  # browser = webkit.launch()
1454
1449
  # page = browser.new_page()
@@ -1592,9 +1587,9 @@ module Playwright
1592
1587
  # This method works across navigations:
1593
1588
  #
1594
1589
  # ```python sync
1595
- # from playwright.sync_api import sync_playwright
1590
+ # from playwright.sync_api import sync_playwright, Playwright
1596
1591
  #
1597
- # def run(playwright):
1592
+ # def run(playwright: Playwright):
1598
1593
  # chromium = playwright.chromium
1599
1594
  # browser = chromium.launch()
1600
1595
  # page = browser.new_page()
@@ -1676,33 +1671,33 @@ module Playwright
1676
1671
  end
1677
1672
 
1678
1673
  # @nodoc
1679
- def owned_context=(req)
1680
- wrap_impl(@impl.owned_context=(unwrap_impl(req)))
1674
+ def stop_css_coverage
1675
+ wrap_impl(@impl.stop_css_coverage)
1681
1676
  end
1682
1677
 
1683
1678
  # @nodoc
1684
- def guid
1685
- wrap_impl(@impl.guid)
1679
+ def stop_js_coverage
1680
+ wrap_impl(@impl.stop_js_coverage)
1686
1681
  end
1687
1682
 
1688
1683
  # @nodoc
1689
- def start_js_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
1690
- wrap_impl(@impl.start_js_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
1684
+ def start_css_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
1685
+ wrap_impl(@impl.start_css_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
1691
1686
  end
1692
1687
 
1693
1688
  # @nodoc
1694
- def stop_js_coverage
1695
- wrap_impl(@impl.stop_js_coverage)
1689
+ def owned_context=(req)
1690
+ wrap_impl(@impl.owned_context=(unwrap_impl(req)))
1696
1691
  end
1697
1692
 
1698
1693
  # @nodoc
1699
- def start_css_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
1700
- wrap_impl(@impl.start_css_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
1694
+ def guid
1695
+ wrap_impl(@impl.guid)
1701
1696
  end
1702
1697
 
1703
1698
  # @nodoc
1704
- def stop_css_coverage
1705
- wrap_impl(@impl.stop_css_coverage)
1699
+ def start_js_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
1700
+ wrap_impl(@impl.start_js_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
1706
1701
  end
1707
1702
 
1708
1703
  # -- inherited from EventEmitter --
@@ -4,9 +4,9 @@ module Playwright
4
4
  # to drive automation:
5
5
  #
6
6
  # ```python sync
7
- # from playwright.sync_api import sync_playwright
7
+ # from playwright.sync_api import sync_playwright, Playwright
8
8
  #
9
- # def run(playwright):
9
+ # def run(playwright: Playwright):
10
10
  # chromium = playwright.chromium # or "firefox" or "webkit".
11
11
  # browser = chromium.launch()
12
12
  # page = browser.new_page()
@@ -29,9 +29,9 @@ module Playwright
29
29
  # Returns a dictionary of devices to be used with [`method: Browser.newContext`] or [`method: Browser.newPage`].
30
30
  #
31
31
  # ```python sync
32
- # from playwright.sync_api import sync_playwright
32
+ # from playwright.sync_api import sync_playwright, Playwright
33
33
  #
34
- # def run(playwright):
34
+ # def run(playwright: Playwright):
35
35
  # webkit = playwright.webkit
36
36
  # iphone = playwright.devices["iPhone 6"]
37
37
  # browser = webkit.launch()
@@ -37,6 +37,20 @@ module Playwright
37
37
 
38
38
  #
39
39
  # Returns the `Frame` that initiated this request.
40
+ #
41
+ # **Usage**
42
+ #
43
+ # ```py
44
+ # frame_url = request.frame.url
45
+ # ```
46
+ #
47
+ # **Details**
48
+ #
49
+ # Note that in some cases the frame is not available, and this method will throw.
50
+ # - When request originates in the Service Worker. You can use `request.serviceWorker()` to check that.
51
+ # - When navigation request is issued before the corresponding frame is created. You can use [`method: Request.isNavigationRequest`] to check that.
52
+ #
53
+ # Here is an example that handles all the cases:
40
54
  def frame
41
55
  wrap_impl(@impl.frame)
42
56
  end
@@ -64,6 +78,9 @@ module Playwright
64
78
 
65
79
  #
66
80
  # Whether this request is driving frame's navigation.
81
+ #
82
+ # Some navigation requests are issued before the corresponding frame is created, and therefore
83
+ # do not have [`method: Request.frame`] available.
67
84
  def navigation_request?
68
85
  wrap_impl(@impl.navigation_request?)
69
86
  end
@@ -12,9 +12,9 @@ module Playwright
12
12
  # An example of registering selector engine that queries elements based on a tag name:
13
13
  #
14
14
  # ```python sync
15
- # from playwright.sync_api import sync_playwright
15
+ # from playwright.sync_api import sync_playwright, Playwright
16
16
  #
17
- # def run(playwright):
17
+ # def run(playwright: Playwright):
18
18
  # tag_selector = """
19
19
  # {
20
20
  # // Returns the first element matching given selector in the root's subtree.
@@ -47,13 +47,13 @@ module Playwright
47
47
  end
48
48
 
49
49
  # @nodoc
50
- def page=(req)
51
- wrap_impl(@impl.page=(unwrap_impl(req)))
50
+ def context=(req)
51
+ wrap_impl(@impl.context=(unwrap_impl(req)))
52
52
  end
53
53
 
54
54
  # @nodoc
55
- def context=(req)
56
- wrap_impl(@impl.context=(unwrap_impl(req)))
55
+ def page=(req)
56
+ wrap_impl(@impl.page=(unwrap_impl(req)))
57
57
  end
58
58
 
59
59
  # -- inherited from EventEmitter --
data/sig/playwright.rbs CHANGED
@@ -483,6 +483,7 @@ module Playwright
483
483
  def or: (Locator locator) -> Locator
484
484
  def page: -> Page
485
485
  def press: (String key, ?delay: Float, ?noWaitAfter: bool, ?timeout: Float) -> void
486
+ def press_sequentially: (String text, ?delay: Float, ?noWaitAfter: bool, ?timeout: Float) -> void
486
487
  def screenshot: (?animations: ("disabled" | "allow"), ?caret: ("hide" | "initial"), ?mask: Array[untyped], ?maskColor: String, ?omitBackground: bool, ?path: (String | File), ?quality: Integer, ?scale: ("css" | "device"), ?timeout: Float, ?type: ("png" | "jpeg")) -> String
487
488
  def scroll_into_view_if_needed: (?timeout: Float) -> void
488
489
  def select_option: (?element: (ElementHandle | Array[untyped]), ?index: (Integer | Array[untyped]), ?value: (String | Array[untyped]), ?label: (String | Array[untyped]), ?force: bool, ?noWaitAfter: bool, ?timeout: Float) -> Array[untyped]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: playwright-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.37.1
4
+ version: 1.39.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - YusukeIwaki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-08-16 00:00:00.000000000 Z
11
+ date: 2023-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -289,7 +289,6 @@ files:
289
289
  - lib/playwright/channel_owners/browser_context.rb
290
290
  - lib/playwright/channel_owners/browser_type.rb
291
291
  - lib/playwright/channel_owners/cdp_session.rb
292
- - lib/playwright/channel_owners/console_message.rb
293
292
  - lib/playwright/channel_owners/dialog.rb
294
293
  - lib/playwright/channel_owners/electron.rb
295
294
  - lib/playwright/channel_owners/element_handle.rb
@@ -309,6 +308,7 @@ files:
309
308
  - lib/playwright/channel_owners/worker.rb
310
309
  - lib/playwright/channel_owners/writable_stream.rb
311
310
  - lib/playwright/connection.rb
311
+ - lib/playwright/console_message_impl.rb
312
312
  - lib/playwright/download_impl.rb
313
313
  - lib/playwright/errors.rb
314
314
  - lib/playwright/event_emitter.rb
@@ -401,5 +401,5 @@ requirements: []
401
401
  rubygems_version: 3.3.26
402
402
  signing_key:
403
403
  specification_version: 4
404
- summary: The Ruby binding of playwright driver 1.37.0
404
+ summary: The Ruby binding of playwright driver 1.39.0
405
405
  test_files: []
@@ -1,25 +0,0 @@
1
- module Playwright
2
- define_channel_owner :ConsoleMessage do
3
- def page
4
- @page ||= ChannelOwners::Page.from_nullable(@initializer['page'])
5
- end
6
-
7
- def type
8
- @initializer['type']
9
- end
10
-
11
- def text
12
- @initializer['text']
13
- end
14
-
15
- def args
16
- @initializer['args']&.map do |arg|
17
- ChannelOwner.from(arg)
18
- end
19
- end
20
-
21
- def location
22
- @initialize['location']
23
- end
24
- end
25
- end