playwright-ruby-client 0.0.8 → 1.58.1.alpha1

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 (209) hide show
  1. checksums.yaml +4 -4
  2. data/AGENTS.md +4 -0
  3. data/CLAUDE/api_generation.md +28 -0
  4. data/CLAUDE/ci_expectations.md +23 -0
  5. data/CLAUDE/gem_release_flow.md +39 -0
  6. data/CLAUDE/past_upgrade_pr_patterns.md +42 -0
  7. data/CLAUDE/playwright_upgrade_workflow.md +35 -0
  8. data/CLAUDE/rspec_debugging.md +30 -0
  9. data/CLAUDE/unimplemented_examples.md +18 -0
  10. data/CLAUDE.md +32 -0
  11. data/CONTRIBUTING.md +5 -0
  12. data/README.md +60 -16
  13. data/documentation/README.md +33 -0
  14. data/documentation/babel.config.js +3 -0
  15. data/documentation/docs/api/api_request.md +7 -0
  16. data/documentation/docs/api/api_request_context.md +298 -0
  17. data/documentation/docs/api/api_response.md +114 -0
  18. data/documentation/docs/api/browser.md +237 -0
  19. data/documentation/docs/api/browser_context.md +503 -0
  20. data/documentation/docs/api/browser_type.md +184 -0
  21. data/documentation/docs/api/cdp_session.md +44 -0
  22. data/documentation/docs/api/clock.md +154 -0
  23. data/documentation/docs/api/console_message.md +85 -0
  24. data/documentation/docs/api/dialog.md +84 -0
  25. data/documentation/docs/api/download.md +111 -0
  26. data/documentation/docs/api/element_handle.md +694 -0
  27. data/documentation/docs/api/experimental/_category_.yml +3 -0
  28. data/documentation/docs/api/experimental/android.md +42 -0
  29. data/documentation/docs/api/experimental/android_device.md +109 -0
  30. data/documentation/docs/api/experimental/android_input.md +43 -0
  31. data/documentation/docs/api/experimental/android_socket.md +7 -0
  32. data/documentation/docs/api/experimental/android_web_view.md +7 -0
  33. data/documentation/docs/api/file_chooser.md +53 -0
  34. data/documentation/docs/api/frame.md +1218 -0
  35. data/documentation/docs/api/frame_locator.md +348 -0
  36. data/documentation/docs/api/js_handle.md +121 -0
  37. data/documentation/docs/api/keyboard.md +170 -0
  38. data/documentation/docs/api/locator.md +1495 -0
  39. data/documentation/docs/api/locator_assertions.md +827 -0
  40. data/documentation/docs/api/mouse.md +86 -0
  41. data/documentation/docs/api/page.md +1946 -0
  42. data/documentation/docs/api/page_assertions.md +65 -0
  43. data/documentation/docs/api/playwright.md +66 -0
  44. data/documentation/docs/api/request.md +255 -0
  45. data/documentation/docs/api/response.md +176 -0
  46. data/documentation/docs/api/route.md +205 -0
  47. data/documentation/docs/api/selectors.md +63 -0
  48. data/documentation/docs/api/touchscreen.md +22 -0
  49. data/documentation/docs/api/tracing.md +129 -0
  50. data/documentation/docs/api/web_socket.md +51 -0
  51. data/documentation/docs/api/worker.md +83 -0
  52. data/documentation/docs/article/api_coverage.mdx +11 -0
  53. data/documentation/docs/article/getting_started.md +161 -0
  54. data/documentation/docs/article/guides/_category_.yml +3 -0
  55. data/documentation/docs/article/guides/download_playwright_driver.md +55 -0
  56. data/documentation/docs/article/guides/inspector.md +31 -0
  57. data/documentation/docs/article/guides/launch_browser.md +121 -0
  58. data/documentation/docs/article/guides/playwright_on_alpine_linux.md +112 -0
  59. data/documentation/docs/article/guides/rails_integration.md +278 -0
  60. data/documentation/docs/article/guides/rails_integration_with_null_driver.md +145 -0
  61. data/documentation/docs/article/guides/recording_video.md +79 -0
  62. data/documentation/docs/article/guides/rspec_integration.md +59 -0
  63. data/documentation/docs/article/guides/semi_automation.md +71 -0
  64. data/documentation/docs/article/guides/use_storage_state.md +78 -0
  65. data/documentation/docs/include/api_coverage.md +671 -0
  66. data/documentation/docusaurus.config.js +114 -0
  67. data/documentation/package.json +39 -0
  68. data/documentation/sidebars.js +15 -0
  69. data/documentation/src/components/HomepageFeatures.js +61 -0
  70. data/documentation/src/components/HomepageFeatures.module.css +13 -0
  71. data/documentation/src/css/custom.css +44 -0
  72. data/documentation/src/pages/index.js +49 -0
  73. data/documentation/src/pages/index.module.css +41 -0
  74. data/documentation/src/pages/markdown-page.md +7 -0
  75. data/documentation/static/.nojekyll +0 -0
  76. data/documentation/static/img/playwright-logo.svg +9 -0
  77. data/documentation/static/img/playwright-ruby-client.png +0 -0
  78. data/documentation/static/img/undraw_dropdown_menu.svg +1 -0
  79. data/documentation/static/img/undraw_web_development.svg +1 -0
  80. data/documentation/static/img/undraw_windows.svg +1 -0
  81. data/documentation/yarn.lock +9005 -0
  82. data/lib/playwright/{input_types/android_input.rb → android_input_impl.rb} +5 -1
  83. data/lib/playwright/api_implementation.rb +18 -0
  84. data/lib/playwright/api_response_impl.rb +77 -0
  85. data/lib/playwright/channel.rb +62 -1
  86. data/lib/playwright/channel_owner.rb +70 -7
  87. data/lib/playwright/channel_owners/android.rb +16 -3
  88. data/lib/playwright/channel_owners/android_device.rb +22 -66
  89. data/lib/playwright/channel_owners/api_request_context.rb +247 -0
  90. data/lib/playwright/channel_owners/artifact.rb +40 -0
  91. data/lib/playwright/channel_owners/binding_call.rb +70 -0
  92. data/lib/playwright/channel_owners/browser.rb +114 -22
  93. data/lib/playwright/channel_owners/browser_context.rb +589 -15
  94. data/lib/playwright/channel_owners/browser_type.rb +90 -1
  95. data/lib/playwright/channel_owners/cdp_session.rb +19 -0
  96. data/lib/playwright/channel_owners/dialog.rb +32 -0
  97. data/lib/playwright/channel_owners/element_handle.rb +107 -43
  98. data/lib/playwright/channel_owners/fetch_request.rb +8 -0
  99. data/lib/playwright/channel_owners/frame.rb +334 -104
  100. data/lib/playwright/channel_owners/js_handle.rb +9 -13
  101. data/lib/playwright/channel_owners/local_utils.rb +82 -0
  102. data/lib/playwright/channel_owners/page.rb +778 -95
  103. data/lib/playwright/channel_owners/playwright.rb +25 -30
  104. data/lib/playwright/channel_owners/request.rb +120 -18
  105. data/lib/playwright/channel_owners/response.rb +113 -0
  106. data/lib/playwright/channel_owners/route.rb +181 -0
  107. data/lib/playwright/channel_owners/stream.rb +30 -0
  108. data/lib/playwright/channel_owners/tracing.rb +117 -0
  109. data/lib/playwright/channel_owners/web_socket.rb +96 -0
  110. data/lib/playwright/channel_owners/worker.rb +46 -0
  111. data/lib/playwright/channel_owners/writable_stream.rb +14 -0
  112. data/lib/playwright/clock_impl.rb +67 -0
  113. data/lib/playwright/connection.rb +111 -63
  114. data/lib/playwright/console_message_impl.rb +29 -0
  115. data/lib/playwright/download_impl.rb +32 -0
  116. data/lib/playwright/errors.rb +42 -5
  117. data/lib/playwright/event_emitter.rb +17 -3
  118. data/lib/playwright/event_emitter_proxy.rb +49 -0
  119. data/lib/playwright/events.rb +10 -5
  120. data/lib/playwright/file_chooser_impl.rb +24 -0
  121. data/lib/playwright/frame_locator_impl.rb +66 -0
  122. data/lib/playwright/har_router.rb +89 -0
  123. data/lib/playwright/http_headers.rb +14 -0
  124. data/lib/playwright/input_files.rb +102 -15
  125. data/lib/playwright/javascript/expression.rb +7 -11
  126. data/lib/playwright/javascript/regex.rb +23 -0
  127. data/lib/playwright/javascript/source_url.rb +16 -0
  128. data/lib/playwright/javascript/value_parser.rb +108 -19
  129. data/lib/playwright/javascript/value_serializer.rb +47 -8
  130. data/lib/playwright/javascript/visitor_info.rb +26 -0
  131. data/lib/playwright/javascript.rb +2 -10
  132. data/lib/playwright/{input_types/keyboard.rb → keyboard_impl.rb} +6 -2
  133. data/lib/playwright/locator_assertions_impl.rb +571 -0
  134. data/lib/playwright/locator_impl.rb +544 -0
  135. data/lib/playwright/locator_utils.rb +136 -0
  136. data/lib/playwright/mouse_impl.rb +57 -0
  137. data/lib/playwright/page_assertions_impl.rb +154 -0
  138. data/lib/playwright/playwright_api.rb +102 -30
  139. data/lib/playwright/raw_headers.rb +61 -0
  140. data/lib/playwright/route_handler.rb +78 -0
  141. data/lib/playwright/select_option_values.rb +34 -13
  142. data/lib/playwright/selectors_impl.rb +45 -0
  143. data/lib/playwright/test.rb +102 -0
  144. data/lib/playwright/timeout_settings.rb +9 -4
  145. data/lib/playwright/touchscreen_impl.rb +14 -0
  146. data/lib/playwright/transport.rb +61 -10
  147. data/lib/playwright/url_matcher.rb +24 -2
  148. data/lib/playwright/utils.rb +48 -13
  149. data/lib/playwright/version.rb +2 -1
  150. data/lib/playwright/video.rb +54 -0
  151. data/lib/playwright/waiter.rb +166 -0
  152. data/lib/playwright/web_socket_client.rb +167 -0
  153. data/lib/playwright/web_socket_transport.rb +116 -0
  154. data/lib/playwright.rb +188 -11
  155. data/lib/playwright_api/android.rb +46 -11
  156. data/lib/playwright_api/android_device.rb +182 -31
  157. data/lib/playwright_api/android_input.rb +22 -13
  158. data/lib/playwright_api/android_socket.rb +18 -0
  159. data/lib/playwright_api/android_web_view.rb +24 -0
  160. data/lib/playwright_api/api_request.rb +26 -0
  161. data/lib/playwright_api/api_request_context.rb +311 -0
  162. data/lib/playwright_api/api_response.rb +92 -0
  163. data/lib/playwright_api/browser.rb +116 -103
  164. data/lib/playwright_api/browser_context.rb +290 -389
  165. data/lib/playwright_api/browser_type.rb +96 -118
  166. data/lib/playwright_api/cdp_session.rb +36 -39
  167. data/lib/playwright_api/clock.rb +121 -0
  168. data/lib/playwright_api/console_message.rb +35 -19
  169. data/lib/playwright_api/dialog.rb +53 -50
  170. data/lib/playwright_api/download.rb +49 -43
  171. data/lib/playwright_api/element_handle.rb +354 -402
  172. data/lib/playwright_api/file_chooser.rb +15 -18
  173. data/lib/playwright_api/frame.rb +703 -603
  174. data/lib/playwright_api/frame_locator.rb +285 -0
  175. data/lib/playwright_api/js_handle.rb +50 -76
  176. data/lib/playwright_api/keyboard.rb +67 -146
  177. data/lib/playwright_api/locator.rb +1304 -0
  178. data/lib/playwright_api/locator_assertions.rb +704 -0
  179. data/lib/playwright_api/mouse.rb +23 -29
  180. data/lib/playwright_api/page.rb +1196 -1176
  181. data/lib/playwright_api/page_assertions.rb +60 -0
  182. data/lib/playwright_api/playwright.rb +54 -122
  183. data/lib/playwright_api/request.rb +112 -74
  184. data/lib/playwright_api/response.rb +92 -20
  185. data/lib/playwright_api/route.rb +152 -62
  186. data/lib/playwright_api/selectors.rb +47 -61
  187. data/lib/playwright_api/touchscreen.rb +8 -2
  188. data/lib/playwright_api/tracing.rb +128 -0
  189. data/lib/playwright_api/web_socket.rb +43 -5
  190. data/lib/playwright_api/worker.rb +74 -34
  191. data/playwright.gemspec +14 -9
  192. data/sig/playwright.rbs +658 -0
  193. metadata +216 -50
  194. data/docs/api_coverage.md +0 -354
  195. data/lib/playwright/channel_owners/chromium_browser.rb +0 -8
  196. data/lib/playwright/channel_owners/chromium_browser_context.rb +0 -8
  197. data/lib/playwright/channel_owners/console_message.rb +0 -21
  198. data/lib/playwright/channel_owners/firefox_browser.rb +0 -8
  199. data/lib/playwright/channel_owners/selectors.rb +0 -4
  200. data/lib/playwright/channel_owners/webkit_browser.rb +0 -8
  201. data/lib/playwright/input_type.rb +0 -19
  202. data/lib/playwright/input_types/mouse.rb +0 -4
  203. data/lib/playwright/input_types/touchscreen.rb +0 -4
  204. data/lib/playwright/javascript/function.rb +0 -67
  205. data/lib/playwright/wait_helper.rb +0 -73
  206. data/lib/playwright_api/accessibility.rb +0 -93
  207. data/lib/playwright_api/binding_call.rb +0 -23
  208. data/lib/playwright_api/chromium_browser_context.rb +0 -57
  209. data/lib/playwright_api/video.rb +0 -24
@@ -0,0 +1,65 @@
1
+ ---
2
+ sidebar_position: 10
3
+ ---
4
+
5
+ # PageAssertions
6
+
7
+
8
+ The [PageAssertions](./page_assertions) class provides assertion methods that can be used to make assertions about the [Page](./page) state in the tests.
9
+
10
+ ```ruby
11
+ page.content = <<~HTML
12
+ <a href="https://example.com/user/login">Sign in</a>
13
+ HTML
14
+
15
+ page.get_by_text("Sign in").click
16
+ expect(page).to have_url(/.*\/login/)
17
+ ```
18
+
19
+ ## not_to_have_title
20
+
21
+ ```
22
+ def not_to_have_title(titleOrRegExp, timeout: nil)
23
+ ```
24
+
25
+
26
+ The opposite of [PageAssertions#to_have_title](./page_assertions#to_have_title).
27
+
28
+ ## not_to_have_url
29
+
30
+ ```
31
+ def not_to_have_url(urlOrRegExp, ignoreCase: nil, timeout: nil)
32
+ ```
33
+
34
+
35
+ The opposite of [PageAssertions#to_have_url](./page_assertions#to_have_url).
36
+
37
+ ## to_have_title
38
+
39
+ ```
40
+ def to_have_title(titleOrRegExp, timeout: nil)
41
+ ```
42
+
43
+
44
+ Ensures the page has the given title.
45
+
46
+ **Usage**
47
+
48
+ ```ruby
49
+ expect(page).to have_title(/.*checkout/)
50
+ ```
51
+
52
+ ## to_have_url
53
+
54
+ ```
55
+ def to_have_url(urlOrRegExp, ignoreCase: nil, timeout: nil)
56
+ ```
57
+
58
+
59
+ Ensures the page is navigated to the given URL.
60
+
61
+ **Usage**
62
+
63
+ ```ruby
64
+ expect(page).to have_url(/.*checkout/)
65
+ ```
@@ -0,0 +1,66 @@
1
+ ---
2
+ sidebar_position: 10
3
+ ---
4
+
5
+ # Playwright
6
+
7
+
8
+ Playwright module provides a method to launch a browser instance. The following is a typical example of using Playwright
9
+ to drive automation:
10
+
11
+ ```ruby
12
+ require 'playwright'
13
+
14
+ Playwright.create(playwright_cli_executable_path: 'npx playwright') do |playwright|
15
+ chromium = playwright.chromium # or "firefox" or "webkit".
16
+ chromium.launch do |browser|
17
+ page = browser.new_page
18
+ page.goto('https://example.com/')
19
+
20
+ # other actions
21
+
22
+ end
23
+ end
24
+ ```
25
+
26
+ ## chromium
27
+
28
+
29
+ This object can be used to launch or connect to Chromium, returning instances of [Browser](./browser).
30
+
31
+ ## devices
32
+
33
+
34
+ Returns a dictionary of devices to be used with [Browser#new_context](./browser#new_context) or [Browser#new_page](./browser#new_page).
35
+
36
+ ```ruby
37
+ require 'playwright'
38
+
39
+ Playwright.create(playwright_cli_executable_path: 'npx playwright') do |playwright|
40
+ iphone = playwright.devices["iPhone 6"]
41
+ playwright.webkit.launch do |browser|
42
+ context = browser.new_context(**iphone)
43
+ page = context.new_page
44
+ page.goto('https://example.com/')
45
+
46
+ # other actions
47
+
48
+ end
49
+ end
50
+ ```
51
+
52
+ ## firefox
53
+
54
+
55
+ This object can be used to launch or connect to Firefox, returning instances of [Browser](./browser).
56
+
57
+ ## selectors
58
+
59
+
60
+ Selectors can be used to install custom selector engines. See
61
+ [extensibility](https://playwright.dev/python/docs/extensibility) for more information.
62
+
63
+ ## webkit
64
+
65
+
66
+ This object can be used to launch or connect to WebKit, returning instances of [Browser](./browser).
@@ -0,0 +1,255 @@
1
+ ---
2
+ sidebar_position: 10
3
+ ---
4
+
5
+ # Request
6
+
7
+
8
+ Whenever the page sends a request for a network resource the following sequence of events are emitted by [Page](./page):
9
+ - [`event: Page.request`] emitted when the request is issued by the page.
10
+ - [`event: Page.response`] emitted when/if the response status and headers are received for the request.
11
+ - [`event: Page.requestFinished`] emitted when the response body is downloaded and the request is complete.
12
+
13
+ If request fails at some point, then instead of `'requestfinished'` event (and possibly instead of 'response' event),
14
+ the [`event: Page.requestFailed`] event is emitted.
15
+
16
+ **NOTE**: HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will complete
17
+ with `'requestfinished'` event.
18
+
19
+ If request gets a 'redirect' response, the request is successfully finished with the `requestfinished` event, and a new
20
+ request is issued to a redirected url.
21
+
22
+ ## all_headers
23
+
24
+ ```
25
+ def all_headers
26
+ ```
27
+
28
+
29
+ An object with all the request HTTP headers associated with this request. The header names are lower-cased.
30
+
31
+ ## failure
32
+
33
+ ```
34
+ def failure
35
+ ```
36
+
37
+
38
+ The method returns `null` unless this request has failed, as reported by `requestfailed` event.
39
+
40
+ **Usage**
41
+
42
+ Example of logging of all the failed requests:
43
+
44
+ ```ruby
45
+ page.on("requestfailed", ->(request) { puts "#{request.url} #{request.failure}" })
46
+ ```
47
+
48
+ ## frame
49
+
50
+ ```
51
+ def frame
52
+ ```
53
+
54
+
55
+ Returns the [Frame](./frame) that initiated this request.
56
+
57
+ **Usage**
58
+
59
+ ```ruby
60
+ frame_url = request.frame.url
61
+ ```
62
+
63
+ **Details**
64
+
65
+ Note that in some cases the frame is not available, and this method will throw.
66
+ - When request originates in the Service Worker. You can use `request.serviceWorker()` to check that.
67
+ - When navigation request is issued before the corresponding frame is created. You can use [Request#navigation_request?](./request#navigation_request?) to check that.
68
+
69
+ Here is an example that handles all the cases:
70
+
71
+ ## headers
72
+
73
+ ```
74
+ def headers
75
+ ```
76
+
77
+
78
+ An object with the request HTTP headers. The header names are lower-cased.
79
+ Note that this method does not return security-related headers, including cookie-related ones.
80
+ You can use [Request#all_headers](./request#all_headers) for complete list of headers that include `cookie` information.
81
+
82
+ ## headers_array
83
+
84
+ ```
85
+ def headers_array
86
+ ```
87
+
88
+
89
+ An array with all the request HTTP headers associated with this request. Unlike [Request#all_headers](./request#all_headers), header names are NOT lower-cased.
90
+ Headers with multiple entries, such as `Set-Cookie`, appear in the array multiple times.
91
+
92
+ ## header_value
93
+
94
+ ```
95
+ def header_value(name)
96
+ ```
97
+
98
+
99
+ Returns the value of the header matching the name. The name is case-insensitive.
100
+
101
+ ## navigation_request?
102
+
103
+ ```
104
+ def navigation_request?
105
+ ```
106
+
107
+
108
+ Whether this request is driving frame's navigation.
109
+
110
+ Some navigation requests are issued before the corresponding frame is created, and therefore
111
+ do not have [Request#frame](./request#frame) available.
112
+
113
+ ## method
114
+
115
+ ```
116
+ def method
117
+ ```
118
+
119
+
120
+ Request's method (GET, POST, etc.)
121
+
122
+ ## post_data
123
+
124
+ ```
125
+ def post_data
126
+ ```
127
+
128
+
129
+ Request's post body, if any.
130
+
131
+ ## post_data_buffer
132
+
133
+ ```
134
+ def post_data_buffer
135
+ ```
136
+
137
+
138
+ Request's post body in a binary form, if any.
139
+
140
+ ## post_data_json
141
+
142
+ ```
143
+ def post_data_json
144
+ ```
145
+
146
+
147
+ Returns parsed request's body for `form-urlencoded` and JSON as a fallback if any.
148
+
149
+ When the response is `application/x-www-form-urlencoded` then a key/value object of the values will be returned.
150
+ Otherwise it will be parsed as JSON.
151
+
152
+ ## redirected_from
153
+
154
+ ```
155
+ def redirected_from
156
+ ```
157
+
158
+
159
+ Request that was redirected by the server to this one, if any.
160
+
161
+ When the server responds with a redirect, Playwright creates a new [Request](./request) object. The two requests are connected by
162
+ [redirected_from](./request#redirected_from) and [redirected_to](./request#redirected_to) methods. When multiple server redirects has happened, it is possible to
163
+ construct the whole redirect chain by repeatedly calling [redirected_from](./request#redirected_from).
164
+
165
+ **Usage**
166
+
167
+ For example, if the website `http://github.com` redirects to `https://github.com`:
168
+
169
+ ```ruby
170
+ response = page.goto("http://github.com")
171
+ puts response.url # => "https://github.com"
172
+ puts response.request.redirected_from&.url # => "http://github.com"
173
+ ```
174
+
175
+ If the website `https://google.com` has no redirects:
176
+
177
+ ```ruby
178
+ response = page.goto("https://google.com")
179
+ puts response.request.redirected_from&.url # => nil
180
+ ```
181
+
182
+ ## redirected_to
183
+
184
+ ```
185
+ def redirected_to
186
+ ```
187
+
188
+
189
+ New request issued by the browser if the server responded with redirect.
190
+
191
+ **Usage**
192
+
193
+ This method is the opposite of [Request#redirected_from](./request#redirected_from):
194
+
195
+ ```ruby
196
+ request.redirected_from.redirected_to # equals to request
197
+ ```
198
+
199
+ ## resource_type
200
+
201
+ ```
202
+ def resource_type
203
+ ```
204
+
205
+
206
+ Contains the request's resource type as it was perceived by the rendering engine. ResourceType will be one of the
207
+ following: `document`, `stylesheet`, `image`, `media`, `font`, `script`, `texttrack`, `xhr`, `fetch`, `eventsource`,
208
+ `websocket`, `manifest`, `other`.
209
+
210
+ ## response
211
+
212
+ ```
213
+ def response
214
+ ```
215
+
216
+
217
+ Returns the matching [Response](./response) object, or `null` if the response was not received due to error.
218
+
219
+ ## sizes
220
+
221
+ ```
222
+ def sizes
223
+ ```
224
+
225
+
226
+ Returns resource size information for given request.
227
+
228
+ ## timing
229
+
230
+ ```
231
+ def timing
232
+ ```
233
+
234
+
235
+ Returns resource timing information for given request. Most of the timing values become available upon the response,
236
+ `responseEnd` becomes available when request finishes. Find more information at
237
+ [Resource Timing API](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming).
238
+
239
+ **Usage**
240
+
241
+ ```ruby
242
+ request = page.expect_event("requestfinished") do
243
+ page.goto("https://example.com")
244
+ end
245
+ puts request.timing
246
+ ```
247
+
248
+ ## url
249
+
250
+ ```
251
+ def url
252
+ ```
253
+
254
+
255
+ URL of the request.
@@ -0,0 +1,176 @@
1
+ ---
2
+ sidebar_position: 10
3
+ ---
4
+
5
+ # Response
6
+
7
+
8
+ [Response](./response) class represents responses which are received by page.
9
+
10
+ ## all_headers
11
+
12
+ ```
13
+ def all_headers
14
+ ```
15
+
16
+
17
+ An object with all the response HTTP headers associated with this response.
18
+
19
+ ## body
20
+
21
+ ```
22
+ def body
23
+ ```
24
+
25
+
26
+ Returns the buffer with response body.
27
+
28
+ ## finished
29
+
30
+ ```
31
+ def finished
32
+ ```
33
+
34
+
35
+ Waits for this response to finish, returns always `null`.
36
+
37
+ ## frame
38
+
39
+ ```
40
+ def frame
41
+ ```
42
+
43
+
44
+ Returns the [Frame](./frame) that initiated this response.
45
+
46
+ ## from_service_worker
47
+
48
+ ```
49
+ def from_service_worker
50
+ ```
51
+
52
+
53
+ Indicates whether this Response was fulfilled by a Service Worker's Fetch Handler (i.e. via [FetchEvent.respondWith](https://developer.mozilla.org/en-US/docs/Web/API/FetchEvent/respondWith)).
54
+
55
+ ## headers
56
+
57
+ ```
58
+ def headers
59
+ ```
60
+
61
+
62
+ An object with the response HTTP headers. The header names are lower-cased.
63
+ Note that this method does not return security-related headers, including cookie-related ones.
64
+ You can use [Response#all_headers](./response#all_headers) for complete list of headers that include `cookie` information.
65
+
66
+ ## headers_array
67
+
68
+ ```
69
+ def headers_array
70
+ ```
71
+
72
+
73
+ An array with all the request HTTP headers associated with this response. Unlike [Response#all_headers](./response#all_headers), header names are NOT lower-cased.
74
+ Headers with multiple entries, such as `Set-Cookie`, appear in the array multiple times.
75
+
76
+ ## header_value
77
+
78
+ ```
79
+ def header_value(name)
80
+ ```
81
+
82
+
83
+ Returns the value of the header matching the name. The name is case-insensitive. If multiple headers have
84
+ the same name (except `set-cookie`), they are returned as a list separated by `, `. For `set-cookie`, the `\n` separator is used. If no headers are found, `null` is returned.
85
+
86
+ ## header_values
87
+
88
+ ```
89
+ def header_values(name)
90
+ ```
91
+
92
+
93
+ Returns all values of the headers matching the name, for example `set-cookie`. The name is case-insensitive.
94
+
95
+ ## json
96
+
97
+ ```
98
+ def json
99
+ ```
100
+
101
+
102
+ Returns the JSON representation of response body.
103
+
104
+ This method will throw if the response body is not parsable via `JSON.parse`.
105
+
106
+ ## ok
107
+
108
+ ```
109
+ def ok
110
+ ```
111
+
112
+
113
+ Contains a boolean stating whether the response was successful (status in the range 200-299) or not.
114
+
115
+ ## request
116
+
117
+ ```
118
+ def request
119
+ ```
120
+
121
+
122
+ Returns the matching [Request](./request) object.
123
+
124
+ ## security_details
125
+
126
+ ```
127
+ def security_details
128
+ ```
129
+
130
+
131
+ Returns SSL and other security information.
132
+
133
+ ## server_addr
134
+
135
+ ```
136
+ def server_addr
137
+ ```
138
+
139
+
140
+ Returns the IP address and port of the server.
141
+
142
+ ## status
143
+
144
+ ```
145
+ def status
146
+ ```
147
+
148
+
149
+ Contains the status code of the response (e.g., 200 for a success).
150
+
151
+ ## status_text
152
+
153
+ ```
154
+ def status_text
155
+ ```
156
+
157
+
158
+ Contains the status text of the response (e.g. usually an "OK" for a success).
159
+
160
+ ## text
161
+
162
+ ```
163
+ def text
164
+ ```
165
+
166
+
167
+ Returns the text representation of response body.
168
+
169
+ ## url
170
+
171
+ ```
172
+ def url
173
+ ```
174
+
175
+
176
+ Contains the URL of the response.