playwright-ruby-client 1.15.beta1 → 1.15.beta2

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 (69) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +10 -14
  3. data/documentation/docs/api/browser.md +2 -0
  4. data/documentation/docs/api/browser_context.md +5 -1
  5. data/documentation/docs/api/browser_type.md +1 -0
  6. data/documentation/docs/api/element_handle.md +27 -1
  7. data/documentation/docs/api/experimental/android_device.md +1 -0
  8. data/documentation/docs/api/frame.md +28 -0
  9. data/documentation/docs/api/locator.md +29 -0
  10. data/documentation/docs/api/page.md +35 -2
  11. data/documentation/docs/api/request.md +27 -1
  12. data/documentation/docs/api/response.md +18 -1
  13. data/documentation/docs/api/tracing.md +42 -8
  14. data/documentation/docs/article/getting_started.md +10 -1
  15. data/documentation/docs/article/guides/download_playwright_driver.md +9 -0
  16. data/documentation/docs/article/guides/inspector.md +1 -1
  17. data/documentation/docs/article/guides/playwright_on_alpine_linux.md +56 -3
  18. data/documentation/docs/article/guides/rails_integration.md +4 -2
  19. data/documentation/docs/article/guides/rails_integration_with_null_driver.md +86 -0
  20. data/documentation/docs/article/guides/recording_video.md +1 -1
  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 +11 -0
  24. data/documentation/docusaurus.config.js +1 -0
  25. data/documentation/package.json +2 -2
  26. data/documentation/src/pages/index.js +0 -1
  27. data/documentation/static/img/playwright-ruby-client.png +0 -0
  28. data/documentation/yarn.lock +625 -549
  29. data/lib/playwright/channel.rb +36 -2
  30. data/lib/playwright/channel_owners/artifact.rb +6 -2
  31. data/lib/playwright/channel_owners/browser.rb +4 -0
  32. data/lib/playwright/channel_owners/browser_context.rb +21 -14
  33. data/lib/playwright/channel_owners/element_handle.rb +10 -2
  34. data/lib/playwright/channel_owners/frame.rb +8 -0
  35. data/lib/playwright/channel_owners/page.rb +20 -4
  36. data/lib/playwright/channel_owners/request.rb +38 -17
  37. data/lib/playwright/channel_owners/response.rb +41 -5
  38. data/lib/playwright/connection.rb +5 -3
  39. data/lib/playwright/http_headers.rb +9 -4
  40. data/lib/playwright/locator_impl.rb +8 -0
  41. data/lib/playwright/{route_handler_entry.rb → route_handler.rb} +30 -2
  42. data/lib/playwright/tracing_impl.rb +18 -7
  43. data/lib/playwright/transport.rb +2 -0
  44. data/lib/playwright/utils.rb +8 -0
  45. data/lib/playwright/version.rb +1 -1
  46. data/lib/playwright/web_socket_transport.rb +2 -0
  47. data/lib/playwright.rb +1 -1
  48. data/lib/playwright_api/android.rb +6 -6
  49. data/lib/playwright_api/android_device.rb +10 -9
  50. data/lib/playwright_api/browser.rb +10 -8
  51. data/lib/playwright_api/browser_context.rb +12 -8
  52. data/lib/playwright_api/browser_type.rb +8 -7
  53. data/lib/playwright_api/cdp_session.rb +6 -6
  54. data/lib/playwright_api/console_message.rb +6 -6
  55. data/lib/playwright_api/dialog.rb +6 -6
  56. data/lib/playwright_api/element_handle.rb +31 -8
  57. data/lib/playwright_api/frame.rb +31 -6
  58. data/lib/playwright_api/js_handle.rb +6 -6
  59. data/lib/playwright_api/locator.rb +26 -0
  60. data/lib/playwright_api/page.rb +40 -10
  61. data/lib/playwright_api/playwright.rb +6 -6
  62. data/lib/playwright_api/request.rb +26 -4
  63. data/lib/playwright_api/response.rb +20 -4
  64. data/lib/playwright_api/route.rb +6 -6
  65. data/lib/playwright_api/selectors.rb +6 -6
  66. data/lib/playwright_api/tracing.rb +33 -4
  67. data/lib/playwright_api/web_socket.rb +6 -6
  68. data/lib/playwright_api/worker.rb +8 -8
  69. metadata +5 -3
@@ -23,12 +23,6 @@ module Playwright
23
23
  wrap_impl(@impl.type)
24
24
  end
25
25
 
26
- # -- inherited from EventEmitter --
27
- # @nodoc
28
- def on(event, callback)
29
- event_emitter_proxy.on(event, callback)
30
- end
31
-
32
26
  # -- inherited from EventEmitter --
33
27
  # @nodoc
34
28
  def off(event, callback)
@@ -41,6 +35,12 @@ module Playwright
41
35
  event_emitter_proxy.once(event, callback)
42
36
  end
43
37
 
38
+ # -- inherited from EventEmitter --
39
+ # @nodoc
40
+ def on(event, callback)
41
+ event_emitter_proxy.on(event, callback)
42
+ end
43
+
44
44
  private def event_emitter_proxy
45
45
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
46
46
  end
@@ -58,12 +58,6 @@ module Playwright
58
58
  wrap_impl(@impl.accept_async(promptText: unwrap_impl(promptText)))
59
59
  end
60
60
 
61
- # -- inherited from EventEmitter --
62
- # @nodoc
63
- def on(event, callback)
64
- event_emitter_proxy.on(event, callback)
65
- end
66
-
67
61
  # -- inherited from EventEmitter --
68
62
  # @nodoc
69
63
  def off(event, callback)
@@ -76,6 +70,12 @@ module Playwright
76
70
  event_emitter_proxy.once(event, callback)
77
71
  end
78
72
 
73
+ # -- inherited from EventEmitter --
74
+ # @nodoc
75
+ def on(event, callback)
76
+ event_emitter_proxy.on(event, callback)
77
+ end
78
+
79
79
  private def event_emitter_proxy
80
80
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
81
81
  end
@@ -412,6 +412,29 @@ module Playwright
412
412
  wrap_impl(@impl.select_text(force: unwrap_impl(force), timeout: unwrap_impl(timeout)))
413
413
  end
414
414
 
415
+ # This method checks or unchecks an element by performing the following steps:
416
+ # 1. Ensure that element is a checkbox or a radio input. If not, this method throws.
417
+ # 1. If the element already has the right checked state, this method returns immediately.
418
+ # 1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the
419
+ # element is detached during the checks, the whole action is retried.
420
+ # 1. Scroll the element into view if needed.
421
+ # 1. Use [`property: Page.mouse`] to click in the center of the element.
422
+ # 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
423
+ # 1. Ensure that the element is now checked or unchecked. If not, this method throws.
424
+ #
425
+ # When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
426
+ # zero timeout disables this.
427
+ def set_checked(
428
+ checked,
429
+ force: nil,
430
+ noWaitAfter: nil,
431
+ position: nil,
432
+ timeout: nil,
433
+ trial: nil)
434
+ 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)))
435
+ end
436
+ alias_method :checked=, :set_checked
437
+
415
438
  # This method expects `elementHandle` to point to an
416
439
  # [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).
417
440
  #
@@ -525,14 +548,8 @@ module Playwright
525
548
  # ```
526
549
  #
527
550
  # > NOTE: This method does not work across navigations, use [`method: Page.waitForSelector`] instead.
528
- def wait_for_selector(selector, state: nil, timeout: nil)
529
- wrap_impl(@impl.wait_for_selector(unwrap_impl(selector), state: unwrap_impl(state), timeout: unwrap_impl(timeout)))
530
- end
531
-
532
- # -- inherited from EventEmitter --
533
- # @nodoc
534
- def on(event, callback)
535
- event_emitter_proxy.on(event, callback)
551
+ def wait_for_selector(selector, state: nil, strict: nil, timeout: nil)
552
+ wrap_impl(@impl.wait_for_selector(unwrap_impl(selector), state: unwrap_impl(state), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
536
553
  end
537
554
 
538
555
  # -- inherited from EventEmitter --
@@ -547,6 +564,12 @@ module Playwright
547
564
  event_emitter_proxy.once(event, callback)
548
565
  end
549
566
 
567
+ # -- inherited from EventEmitter --
568
+ # @nodoc
569
+ def on(event, callback)
570
+ event_emitter_proxy.on(event, callback)
571
+ end
572
+
550
573
  private def event_emitter_proxy
551
574
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
552
575
  end
@@ -524,6 +524,31 @@ module Playwright
524
524
  wrap_impl(@impl.select_option(unwrap_impl(selector), element: unwrap_impl(element), index: unwrap_impl(index), value: unwrap_impl(value), label: unwrap_impl(label), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
525
525
  end
526
526
 
527
+ # This method checks or unchecks an element matching `selector` by performing the following steps:
528
+ # 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
529
+ # 1. Ensure that matched element is a checkbox or a radio input. If not, this method throws.
530
+ # 1. If the element already has the right checked state, this method returns immediately.
531
+ # 1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the
532
+ # element is detached during the checks, the whole action is retried.
533
+ # 1. Scroll the element into view if needed.
534
+ # 1. Use [`property: Page.mouse`] to click in the center of the element.
535
+ # 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
536
+ # 1. Ensure that the element is now checked or unchecked. If not, this method throws.
537
+ #
538
+ # When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
539
+ # zero timeout disables this.
540
+ def set_checked(
541
+ selector,
542
+ checked,
543
+ force: nil,
544
+ noWaitAfter: nil,
545
+ position: nil,
546
+ strict: nil,
547
+ timeout: nil,
548
+ trial: nil)
549
+ 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)))
550
+ end
551
+
527
552
  def set_content(html, timeout: nil, waitUntil: nil)
528
553
  wrap_impl(@impl.set_content(unwrap_impl(html), timeout: unwrap_impl(timeout), waitUntil: unwrap_impl(waitUntil)))
529
554
  end
@@ -738,12 +763,6 @@ module Playwright
738
763
  wrap_impl(@impl.detached=(unwrap_impl(req)))
739
764
  end
740
765
 
741
- # -- inherited from EventEmitter --
742
- # @nodoc
743
- def on(event, callback)
744
- event_emitter_proxy.on(event, callback)
745
- end
746
-
747
766
  # -- inherited from EventEmitter --
748
767
  # @nodoc
749
768
  def off(event, callback)
@@ -756,6 +775,12 @@ module Playwright
756
775
  event_emitter_proxy.once(event, callback)
757
776
  end
758
777
 
778
+ # -- inherited from EventEmitter --
779
+ # @nodoc
780
+ def on(event, callback)
781
+ event_emitter_proxy.on(event, callback)
782
+ end
783
+
759
784
  private def event_emitter_proxy
760
785
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
761
786
  end
@@ -88,12 +88,6 @@ module Playwright
88
88
  wrap_impl(@impl.to_s)
89
89
  end
90
90
 
91
- # -- inherited from EventEmitter --
92
- # @nodoc
93
- def on(event, callback)
94
- event_emitter_proxy.on(event, callback)
95
- end
96
-
97
91
  # -- inherited from EventEmitter --
98
92
  # @nodoc
99
93
  def off(event, callback)
@@ -106,6 +100,12 @@ module Playwright
106
100
  event_emitter_proxy.once(event, callback)
107
101
  end
108
102
 
103
+ # -- inherited from EventEmitter --
104
+ # @nodoc
105
+ def on(event, callback)
106
+ event_emitter_proxy.on(event, callback)
107
+ end
108
+
109
109
  private def event_emitter_proxy
110
110
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
111
111
  end
@@ -40,6 +40,9 @@ module Playwright
40
40
  #
41
41
  # # Works because we explicitly tell locator to pick the first element:
42
42
  # page.locator('button').first.click()
43
+ #
44
+ # # Works because count knows what to do with multiple matches:
45
+ # page.locator('button').count()
43
46
  # ```
44
47
  class Locator < PlaywrightApi
45
48
 
@@ -435,6 +438,29 @@ module Playwright
435
438
  wrap_impl(@impl.select_text(force: unwrap_impl(force), timeout: unwrap_impl(timeout)))
436
439
  end
437
440
 
441
+ # This method checks or unchecks an element by performing the following steps:
442
+ # 1. Ensure that matched element is a checkbox or a radio input. If not, this method throws.
443
+ # 1. If the element already has the right checked state, this method returns immediately.
444
+ # 1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the
445
+ # element is detached during the checks, the whole action is retried.
446
+ # 1. Scroll the element into view if needed.
447
+ # 1. Use [`property: Page.mouse`] to click in the center of the element.
448
+ # 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
449
+ # 1. Ensure that the element is now checked or unchecked. If not, this method throws.
450
+ #
451
+ # When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
452
+ # zero timeout disables this.
453
+ def set_checked(
454
+ checked,
455
+ force: nil,
456
+ noWaitAfter: nil,
457
+ position: nil,
458
+ timeout: nil,
459
+ trial: nil)
460
+ 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)))
461
+ end
462
+ alias_method :checked=, :set_checked
463
+
438
464
  # This method expects `element` to point to an
439
465
  # [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).
440
466
  #
@@ -284,8 +284,8 @@ module Playwright
284
284
  # # → False
285
285
  # page.evaluate("matchMedia('(prefers-color-scheme: no-preference)').matches")
286
286
  # ```
287
- def emulate_media(colorScheme: nil, media: nil, reducedMotion: nil)
288
- wrap_impl(@impl.emulate_media(colorScheme: unwrap_impl(colorScheme), media: unwrap_impl(media), reducedMotion: unwrap_impl(reducedMotion)))
287
+ def emulate_media(colorScheme: nil, forcedColors: nil, media: nil, reducedMotion: nil)
288
+ wrap_impl(@impl.emulate_media(colorScheme: unwrap_impl(colorScheme), forcedColors: unwrap_impl(forcedColors), media: unwrap_impl(media), reducedMotion: unwrap_impl(reducedMotion)))
289
289
  end
290
290
 
291
291
  # The method finds an element matching the specified selector within the page and passes it as a first argument to
@@ -818,6 +818,9 @@ module Playwright
818
818
  # Once routing is enabled, every request matching the url pattern will stall unless it's continued, fulfilled or aborted.
819
819
  #
820
820
  # > NOTE: The handler will only be called for the first url if the response is a redirect.
821
+ # > NOTE: [`method: Page.route`] will not intercept requests intercepted by Service Worker. See
822
+ # [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using
823
+ # request interception. Via `await context.addInitScript(() => delete window.navigator.serviceWorker);`
821
824
  #
822
825
  # An example of a naive handler that aborts all image requests:
823
826
  #
@@ -855,8 +858,8 @@ module Playwright
855
858
  # To remove a route with its handler you can use [`method: Page.unroute`].
856
859
  #
857
860
  # > NOTE: Enabling routing disables http cache.
858
- def route(url, handler)
859
- wrap_impl(@impl.route(unwrap_impl(url), unwrap_impl(handler)))
861
+ def route(url, handler, times: nil)
862
+ wrap_impl(@impl.route(unwrap_impl(url), unwrap_impl(handler), times: unwrap_impl(times)))
860
863
  end
861
864
 
862
865
  # Returns the buffer with the captured screenshot.
@@ -905,6 +908,33 @@ module Playwright
905
908
  wrap_impl(@impl.select_option(unwrap_impl(selector), element: unwrap_impl(element), index: unwrap_impl(index), value: unwrap_impl(value), label: unwrap_impl(label), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
906
909
  end
907
910
 
911
+ # This method checks or unchecks an element matching `selector` by performing the following steps:
912
+ # 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
913
+ # 1. Ensure that matched element is a checkbox or a radio input. If not, this method throws.
914
+ # 1. If the element already has the right checked state, this method returns immediately.
915
+ # 1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the
916
+ # element is detached during the checks, the whole action is retried.
917
+ # 1. Scroll the element into view if needed.
918
+ # 1. Use [`property: Page.mouse`] to click in the center of the element.
919
+ # 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
920
+ # 1. Ensure that the element is now checked or unchecked. If not, this method throws.
921
+ #
922
+ # When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
923
+ # zero timeout disables this.
924
+ #
925
+ # Shortcut for main frame's [`method: Frame.setChecked`].
926
+ def set_checked(
927
+ selector,
928
+ checked,
929
+ force: nil,
930
+ noWaitAfter: nil,
931
+ position: nil,
932
+ strict: nil,
933
+ timeout: nil,
934
+ trial: nil)
935
+ 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)))
936
+ end
937
+
908
938
  def set_content(html, timeout: nil, waitUntil: nil)
909
939
  wrap_impl(@impl.set_content(unwrap_impl(html), timeout: unwrap_impl(timeout), waitUntil: unwrap_impl(waitUntil)))
910
940
  end
@@ -1350,12 +1380,6 @@ module Playwright
1350
1380
  wrap_impl(@impl.guid)
1351
1381
  end
1352
1382
 
1353
- # -- inherited from EventEmitter --
1354
- # @nodoc
1355
- def on(event, callback)
1356
- event_emitter_proxy.on(event, callback)
1357
- end
1358
-
1359
1383
  # -- inherited from EventEmitter --
1360
1384
  # @nodoc
1361
1385
  def off(event, callback)
@@ -1368,6 +1392,12 @@ module Playwright
1368
1392
  event_emitter_proxy.once(event, callback)
1369
1393
  end
1370
1394
 
1395
+ # -- inherited from EventEmitter --
1396
+ # @nodoc
1397
+ def on(event, callback)
1398
+ event_emitter_proxy.on(event, callback)
1399
+ end
1400
+
1371
1401
  private def event_emitter_proxy
1372
1402
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
1373
1403
  end
@@ -91,12 +91,6 @@ module Playwright
91
91
  wrap_impl(@impl.electron)
92
92
  end
93
93
 
94
- # -- inherited from EventEmitter --
95
- # @nodoc
96
- def on(event, callback)
97
- event_emitter_proxy.on(event, callback)
98
- end
99
-
100
94
  # -- inherited from EventEmitter --
101
95
  # @nodoc
102
96
  def off(event, callback)
@@ -109,6 +103,12 @@ module Playwright
109
103
  event_emitter_proxy.once(event, callback)
110
104
  end
111
105
 
106
+ # -- inherited from EventEmitter --
107
+ # @nodoc
108
+ def on(event, callback)
109
+ event_emitter_proxy.on(event, callback)
110
+ end
111
+
112
112
  private def event_emitter_proxy
113
113
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
114
114
  end
@@ -14,6 +14,11 @@ module Playwright
14
14
  # request is issued to a redirected url.
15
15
  class Request < PlaywrightApi
16
16
 
17
+ # An object with all the request HTTP headers associated with this request. The header names are lower-cased.
18
+ def all_headers
19
+ wrap_impl(@impl.all_headers)
20
+ end
21
+
17
22
  # The method returns `null` unless this request has failed, as reported by `requestfailed` event.
18
23
  #
19
24
  # Example of logging of all the failed requests:
@@ -30,11 +35,17 @@ module Playwright
30
35
  wrap_impl(@impl.frame)
31
36
  end
32
37
 
33
- # An object with HTTP headers associated with the request. All header names are lower-case.
38
+ # **DEPRECATED** Incomplete list of headers as seen by the rendering engine. Use [`method: Request.allHeaders`] instead.
34
39
  def headers
35
40
  wrap_impl(@impl.headers)
36
41
  end
37
42
 
43
+ # An array with all the request HTTP headers associated with this request. Unlike [`method: Request.allHeaders`], header
44
+ # names are not lower-cased. Headers with multiple entries, such as `Set-Cookie`, appear in the array multiple times.
45
+ def headers_array
46
+ wrap_impl(@impl.headers_array)
47
+ end
48
+
38
49
  # Whether this request is driving frame's navigation.
39
50
  def navigation_request?
40
51
  wrap_impl(@impl.navigation_request?)
@@ -109,6 +120,12 @@ module Playwright
109
120
  wrap_impl(@impl.response)
110
121
  end
111
122
 
123
+ # Returns resource size information for given request. Requires the response to be finished via
124
+ # [`method: Response.finished`] to ensure the info is available.
125
+ def sizes
126
+ wrap_impl(@impl.sizes)
127
+ end
128
+
112
129
  # Returns resource timing information for given request. Most of the timing values become available upon the response,
113
130
  # `responseEnd` becomes available when request finishes. Find more information at
114
131
  # [Resource Timing API](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming).
@@ -128,10 +145,9 @@ module Playwright
128
145
  wrap_impl(@impl.url)
129
146
  end
130
147
 
131
- # -- inherited from EventEmitter --
132
148
  # @nodoc
133
- def on(event, callback)
134
- event_emitter_proxy.on(event, callback)
149
+ def parse_headers_as_array(serialized_headers, downcase)
150
+ wrap_impl(@impl.parse_headers_as_array(unwrap_impl(serialized_headers), unwrap_impl(downcase)))
135
151
  end
136
152
 
137
153
  # -- inherited from EventEmitter --
@@ -146,6 +162,12 @@ module Playwright
146
162
  event_emitter_proxy.once(event, callback)
147
163
  end
148
164
 
165
+ # -- inherited from EventEmitter --
166
+ # @nodoc
167
+ def on(event, callback)
168
+ event_emitter_proxy.on(event, callback)
169
+ end
170
+
149
171
  private def event_emitter_proxy
150
172
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
151
173
  end
@@ -2,6 +2,11 @@ module Playwright
2
2
  # `Response` class represents responses which are received by page.
3
3
  class Response < PlaywrightApi
4
4
 
5
+ # An object with all the response HTTP headers associated with this response.
6
+ def all_headers
7
+ wrap_impl(@impl.all_headers)
8
+ end
9
+
5
10
  # Returns the buffer with response body.
6
11
  def body
7
12
  wrap_impl(@impl.body)
@@ -17,11 +22,17 @@ module Playwright
17
22
  wrap_impl(@impl.frame)
18
23
  end
19
24
 
20
- # Returns the object with HTTP headers associated with the response. All header names are lower-case.
25
+ # **DEPRECATED** Incomplete list of headers as seen by the rendering engine. Use [`method: Response.allHeaders`] instead.
21
26
  def headers
22
27
  wrap_impl(@impl.headers)
23
28
  end
24
29
 
30
+ # An array with all the request HTTP headers associated with this response. Unlike [`method: Response.allHeaders`], header
31
+ # names are not lower-cased. Headers with multiple entries, such as `Set-Cookie`, appear in the array multiple times.
32
+ def headers_array
33
+ wrap_impl(@impl.headers_array)
34
+ end
35
+
25
36
  # Returns the JSON representation of response body.
26
37
  #
27
38
  # This method will throw if the response body is not parsable via `JSON.parse`.
@@ -74,10 +85,9 @@ module Playwright
74
85
  wrap_impl(@impl.ok?)
75
86
  end
76
87
 
77
- # -- inherited from EventEmitter --
78
88
  # @nodoc
79
- def on(event, callback)
80
- event_emitter_proxy.on(event, callback)
89
+ def parse_headers_as_array(serialized_headers, downcase)
90
+ wrap_impl(@impl.parse_headers_as_array(unwrap_impl(serialized_headers), unwrap_impl(downcase)))
81
91
  end
82
92
 
83
93
  # -- inherited from EventEmitter --
@@ -92,6 +102,12 @@ module Playwright
92
102
  event_emitter_proxy.once(event, callback)
93
103
  end
94
104
 
105
+ # -- inherited from EventEmitter --
106
+ # @nodoc
107
+ def on(event, callback)
108
+ event_emitter_proxy.on(event, callback)
109
+ end
110
+
95
111
  private def event_emitter_proxy
96
112
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
97
113
  end