playwright-ruby-client 1.28.1 → 1.29.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/documentation/docs/api/accessibility.md +9 -14
  3. data/documentation/docs/api/api_request_context.md +44 -41
  4. data/documentation/docs/api/api_response.md +13 -3
  5. data/documentation/docs/api/browser.md +24 -23
  6. data/documentation/docs/api/browser_context.md +71 -45
  7. data/documentation/docs/api/browser_type.md +21 -14
  8. data/documentation/docs/api/cdp_session.md +3 -5
  9. data/documentation/docs/api/console_message.md +7 -4
  10. data/documentation/docs/api/dialog.md +9 -5
  11. data/documentation/docs/api/download.md +19 -11
  12. data/documentation/docs/api/element_handle.md +125 -116
  13. data/documentation/docs/api/experimental/android.md +4 -5
  14. data/documentation/docs/api/experimental/android_device.md +11 -2
  15. data/documentation/docs/api/experimental/android_input.md +5 -0
  16. data/documentation/docs/api/file_chooser.md +6 -3
  17. data/documentation/docs/api/frame.md +182 -171
  18. data/documentation/docs/api/frame_locator.md +27 -38
  19. data/documentation/docs/api/js_handle.md +16 -10
  20. data/documentation/docs/api/keyboard.md +29 -16
  21. data/documentation/docs/api/locator.md +189 -140
  22. data/documentation/docs/api/mouse.md +9 -4
  23. data/documentation/docs/api/page.md +304 -289
  24. data/documentation/docs/api/playwright.md +8 -5
  25. data/documentation/docs/api/request.md +34 -15
  26. data/documentation/docs/api/response.md +27 -10
  27. data/documentation/docs/api/route.md +44 -12
  28. data/documentation/docs/api/selectors.md +5 -3
  29. data/documentation/docs/api/touchscreen.md +2 -0
  30. data/documentation/docs/api/tracing.md +11 -11
  31. data/documentation/docs/api/web_socket.md +9 -4
  32. data/documentation/docs/api/worker.md +12 -11
  33. data/documentation/docs/include/api_coverage.md +2 -0
  34. data/lib/playwright/channel_owners/api_request_context.rb +37 -2
  35. data/lib/playwright/channel_owners/browser_context.rb +22 -26
  36. data/lib/playwright/channel_owners/page.rb +35 -25
  37. data/lib/playwright/channel_owners/route.rb +28 -8
  38. data/lib/playwright/event_emitter.rb +6 -1
  39. data/lib/playwright/locator_impl.rb +8 -0
  40. data/lib/playwright/select_option_values.rb +2 -0
  41. data/lib/playwright/version.rb +2 -2
  42. data/lib/playwright_api/accessibility.rb +9 -13
  43. data/lib/playwright_api/android.rb +8 -6
  44. data/lib/playwright_api/android_device.rb +32 -7
  45. data/lib/playwright_api/android_input.rb +5 -0
  46. data/lib/playwright_api/android_socket.rb +4 -2
  47. data/lib/playwright_api/android_web_view.rb +5 -2
  48. data/lib/playwright_api/api_request.rb +6 -3
  49. data/lib/playwright_api/api_request_context.rb +46 -36
  50. data/lib/playwright_api/api_response.rb +13 -2
  51. data/lib/playwright_api/browser.rb +24 -16
  52. data/lib/playwright_api/browser_context.rb +76 -39
  53. data/lib/playwright_api/browser_type.rb +23 -13
  54. data/lib/playwright_api/cdp_session.rb +3 -4
  55. data/lib/playwright_api/console_message.rb +7 -2
  56. data/lib/playwright_api/dialog.rb +8 -4
  57. data/lib/playwright_api/download.rb +19 -9
  58. data/lib/playwright_api/element_handle.rb +116 -93
  59. data/lib/playwright_api/file_chooser.rb +6 -1
  60. data/lib/playwright_api/frame.rb +180 -135
  61. data/lib/playwright_api/frame_locator.rb +29 -32
  62. data/lib/playwright_api/js_handle.rb +16 -6
  63. data/lib/playwright_api/keyboard.rb +29 -14
  64. data/lib/playwright_api/locator.rb +183 -112
  65. data/lib/playwright_api/mouse.rb +9 -2
  66. data/lib/playwright_api/page.rb +301 -253
  67. data/lib/playwright_api/playwright.rb +11 -4
  68. data/lib/playwright_api/request.rb +34 -7
  69. data/lib/playwright_api/response.rb +27 -10
  70. data/lib/playwright_api/route.rb +44 -11
  71. data/lib/playwright_api/selectors.rb +6 -1
  72. data/lib/playwright_api/touchscreen.rb +2 -0
  73. data/lib/playwright_api/tracing.rb +11 -5
  74. data/lib/playwright_api/web_socket.rb +9 -4
  75. data/lib/playwright_api/worker.rb +16 -13
  76. data/playwright.gemspec +1 -1
  77. metadata +7 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f6b579547c4cff2fbaf98b5c2796c8689f655f316b391b7127891fd03212cea4
4
- data.tar.gz: c32a3787fa3f6c2e874844f94deef249c335cee4f6efcc8d23e8045bfd6346f1
3
+ metadata.gz: 9bb80a26a23fe2f95dc206c0cf1985455df76b46b34560c957ba14f4ff77803e
4
+ data.tar.gz: 6e10d789d7671c90eea13eeca5ed5e37ab430db1a60b62b0a2861726a5d32670
5
5
  SHA512:
6
- metadata.gz: 7481f324212879e913399614beab51affce2c8dc05040ac0d506d9b583fcf48c897bd1a1f3b7f332212497db2000e538a1cf1fd19c60d5ddf7c884e2e366d687
7
- data.tar.gz: 58eb07d5abb6307bd15464b6f33d8c0d0cc4110cf80c26915cecc00be911fba8e6240687cb46698c81fda29651718b4039f8ca1530661e5ccd4a7d1632bd6ef3
6
+ metadata.gz: b91a7a321448156410b7f45b3d5ec83c3e261ad6e9207f8a8f13688bca3fb171e0625bd579160a0283525ff7e13398b55827f33d6c06cfdc581c14a783947e57
7
+ data.tar.gz: c6cfe1d66fd441916e2401637b2341eddf705c40e9783373c6b6b51a719b8ba59d2943318141c3f2ab42f8d59020cf3772cdb095cd98832e811b5af3afba0b8d
@@ -4,9 +4,6 @@ sidebar_position: 10
4
4
 
5
5
  # Accessibility
6
6
 
7
- **DEPRECATED** This class is deprecated. Please use other libraries such as [Axe](https://www.deque.com/axe/) if you
8
- need to test page accessibility. See our Node.js [guide](https://playwright.dev/docs/accessibility-testing) for
9
- integration with Axe.
10
7
 
11
8
  The Accessibility class provides methods for inspecting Chromium's accessibility tree. The accessibility tree is used by
12
9
  assistive technology such as [screen readers](https://en.wikipedia.org/wiki/Screen_reader) or
@@ -15,12 +12,12 @@ assistive technology such as [screen readers](https://en.wikipedia.org/wiki/Scre
15
12
  Accessibility is a very platform-specific thing. On different platforms, there are different screen readers that might
16
13
  have wildly different output.
17
14
 
18
- Rendering engines of Chromium, Firefox and WebKit have a concept of "accessibility tree", which is then translated into
19
- different platform-specific APIs. Accessibility namespace gives access to this Accessibility Tree.
15
+ Rendering engines of Chromium, Firefox and WebKit have a concept of "accessibility tree", which is then translated into different
16
+ platform-specific APIs. Accessibility namespace gives access to this Accessibility Tree.
20
17
 
21
- Most of the accessibility tree gets filtered out when converting from internal browser AX Tree to Platform-specific
22
- AX-Tree or by assistive technologies themselves. By default, Playwright tries to approximate this filtering, exposing
23
- only the "interesting" nodes of the tree.
18
+ Most of the accessibility tree gets filtered out when converting from internal browser AX Tree to Platform-specific AX-Tree or by
19
+ assistive technologies themselves. By default, Playwright tries to approximate this filtering, exposing only the
20
+ "interesting" nodes of the tree.
24
21
 
25
22
  ## snapshot
26
23
 
@@ -28,15 +25,14 @@ only the "interesting" nodes of the tree.
28
25
  def snapshot(interestingOnly: nil, root: nil)
29
26
  ```
30
27
 
31
- **DEPRECATED** This method is deprecated. Please use other libraries such as [Axe](https://www.deque.com/axe/) if you
32
- need to test page accessibility. See our Node.js [guide](https://playwright.dev/docs/accessibility-testing) for
33
- integration with Axe.
34
28
 
35
29
  Captures the current state of the accessibility tree. The returned object represents the root accessible node of the
36
30
  page.
37
31
 
38
- > NOTE: The Chromium accessibility tree contains nodes that go unused on most platforms and by most screen readers.
39
- Playwright will discard them as well for an easier to process tree, unless `interestingOnly` is set to `false`.
32
+ **NOTE**: The Chromium accessibility tree contains nodes that go unused on most platforms and by most screen readers. Playwright
33
+ will discard them as well for an easier to process tree, unless `interestingOnly` is set to `false`.
34
+
35
+ **Usage**
40
36
 
41
37
  An example of dumping the entire accessibility tree:
42
38
 
@@ -62,4 +58,3 @@ snapshot = page.accessibility.snapshot
62
58
  node = find_focused_node(snapshot)
63
59
  puts node['name']
64
60
  ```
65
-
@@ -4,23 +4,25 @@ sidebar_position: 10
4
4
 
5
5
  # APIRequestContext
6
6
 
7
+
7
8
  This API is used for the Web API testing. You can use it to trigger API endpoints, configure micro-services, prepare
8
9
  environment or the service to your e2e test.
9
10
 
10
- Each Playwright browser context has associated with it [APIRequestContext](./api_request_context) instance which shares cookie storage with the
11
- browser context and can be accessed via [BrowserContext#request](./browser_context#request) or [Page#request](./page#request). It is also
12
- possible to create a new APIRequestContext instance manually by calling [APIRequest#new_context](./api_request#new_context).
11
+ Each Playwright browser context has associated with it [APIRequestContext](./api_request_context) instance which shares cookie storage with
12
+ the browser context and can be accessed via [BrowserContext#request](./browser_context#request) or [Page#request](./page#request).
13
+ It is also possible to create a new APIRequestContext instance manually by calling [APIRequest#new_context](./api_request#new_context).
13
14
 
14
15
  **Cookie management**
15
16
 
16
17
  [APIRequestContext](./api_request_context) returned by [BrowserContext#request](./browser_context#request) and [Page#request](./page#request) shares cookie
17
- storage with the corresponding [BrowserContext](./browser_context). Each API request will have `Cookie` header populated with the values
18
- from the browser context. If the API response contains `Set-Cookie` header it will automatically update [BrowserContext](./browser_context)
19
- cookies and requests made from the page will pick them up. This means that if you log in using this API, your e2e test
20
- will be logged in and vice versa.
18
+ storage with the corresponding [BrowserContext](./browser_context). Each API request will have `Cookie` header populated with the
19
+ values from the browser context. If the API response contains `Set-Cookie` header it will automatically update
20
+ [BrowserContext](./browser_context) cookies and requests made from the page will pick them up. This means that if you log in using
21
+ this API, your e2e test will be logged in and vice versa.
21
22
 
22
23
  If you want API requests to not interfere with the browser cookies you should create a new [APIRequestContext](./api_request_context) by
23
- calling [APIRequest#new_context](./api_request#new_context). Such [APIRequestContext](./api_request_context) object will have its own isolated cookie storage.
24
+ calling [APIRequest#new_context](./api_request#new_context). Such [APIRequestContext](./api_request_context) object will have its own isolated cookie
25
+ storage.
24
26
 
25
27
  ```ruby
26
28
  playwright.chromium.launch do |browser|
@@ -55,7 +57,6 @@ playwright.chromium.launch do |browser|
55
57
  end
56
58
  ```
57
59
 
58
-
59
60
  ## delete
60
61
 
61
62
  ```
@@ -72,9 +73,10 @@ def delete(
72
73
  timeout: nil)
73
74
  ```
74
75
 
75
- Sends HTTP(S) [DELETE](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/DELETE) request and returns its
76
- response. The method will populate request cookies from the context and update context cookies from the response. The
77
- method will automatically follow redirects.
76
+
77
+ Sends HTTP(S) [DELETE](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/DELETE) request and returns its response.
78
+ The method will populate request cookies from the context and update
79
+ context cookies from the response. The method will automatically follow redirects.
78
80
 
79
81
  ## dispose
80
82
 
@@ -82,9 +84,9 @@ method will automatically follow redirects.
82
84
  def dispose
83
85
  ```
84
86
 
85
- All responses returned by [APIRequestContext#get](./api_request_context#get) and similar methods are stored in the memory, so that you
86
- can later call [APIResponse#body](./api_response#body). This method discards all stored responses, and makes
87
- [APIResponse#body](./api_response#body) throw "Response disposed" error.
87
+
88
+ All responses returned by [APIRequestContext#get](./api_request_context#get) and similar methods are stored in the memory, so that you can later call [APIResponse#body](./api_response#body). This method
89
+ discards all stored responses, and makes [APIResponse#body](./api_response#body) throw "Response disposed" error.
88
90
 
89
91
  ## fetch
90
92
 
@@ -103,10 +105,11 @@ def fetch(
103
105
  timeout: nil)
104
106
  ```
105
107
 
108
+
106
109
  Sends HTTP(S) request and returns its response. The method will populate request cookies from the context and update
107
- context cookies from the response. The method will automatically follow redirects.
110
+ context cookies from the response. The method will automatically follow redirects. JSON objects can be passed directly to the request.
108
111
 
109
- JSON objects can be passed directly to the request:
112
+ **Usage**
110
113
 
111
114
  ```ruby
112
115
  data = {
@@ -116,8 +119,7 @@ data = {
116
119
  api_request_context.fetch("https://example.com/api/create_book", method: 'post', data: data)
117
120
  ```
118
121
 
119
- The common way to send file(s) in the body of a request is to encode it as form fields with `multipart/form-data`
120
- encoding. You can achieve that with Playwright API like this:
122
+ The common way to send file(s) in the body of a request is to encode it as form fields with `multipart/form-data` encoding. You can achieve that with Playwright API like this:
121
123
 
122
124
  ```ruby
123
125
  api_request_context.fetch(
@@ -133,8 +135,6 @@ api_request_context.fetch(
133
135
  )
134
136
  ```
135
137
 
136
-
137
-
138
138
  ## get
139
139
 
140
140
  ```
@@ -151,9 +151,12 @@ def get(
151
151
  timeout: nil)
152
152
  ```
153
153
 
154
- Sends HTTP(S) [GET](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET) request and returns its response. The
155
- method will populate request cookies from the context and update context cookies from the response. The method will
156
- automatically follow redirects.
154
+
155
+ Sends HTTP(S) [GET](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET) request and returns its response.
156
+ The method will populate request cookies from the context and update
157
+ context cookies from the response. The method will automatically follow redirects.
158
+
159
+ **Usage**
157
160
 
158
161
  Request parameters can be configured with `params` option, they will be serialized into the URL search parameters:
159
162
 
@@ -165,8 +168,6 @@ query_params = {
165
168
  api_request_context.get("https://example.com/api/get_text", params: query_params)
166
169
  ```
167
170
 
168
-
169
-
170
171
  ## head
171
172
 
172
173
  ```
@@ -183,9 +184,10 @@ def head(
183
184
  timeout: nil)
184
185
  ```
185
186
 
187
+
186
188
  Sends HTTP(S) [HEAD](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD) request and returns its response.
187
- The method will populate request cookies from the context and update context cookies from the response. The method will
188
- automatically follow redirects.
189
+ The method will populate request cookies from the context and update
190
+ context cookies from the response. The method will automatically follow redirects.
189
191
 
190
192
  ## patch
191
193
 
@@ -203,9 +205,10 @@ def patch(
203
205
  timeout: nil)
204
206
  ```
205
207
 
208
+
206
209
  Sends HTTP(S) [PATCH](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PATCH) request and returns its response.
207
- The method will populate request cookies from the context and update context cookies from the response. The method will
208
- automatically follow redirects.
210
+ The method will populate request cookies from the context and update
211
+ context cookies from the response. The method will automatically follow redirects.
209
212
 
210
213
  ## post
211
214
 
@@ -223,9 +226,12 @@ def post(
223
226
  timeout: nil)
224
227
  ```
225
228
 
229
+
226
230
  Sends HTTP(S) [POST](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST) request and returns its response.
227
- The method will populate request cookies from the context and update context cookies from the response. The method will
228
- automatically follow redirects.
231
+ The method will populate request cookies from the context and update
232
+ context cookies from the response. The method will automatically follow redirects.
233
+
234
+ **Usage**
229
235
 
230
236
  JSON objects can be passed directly to the request:
231
237
 
@@ -237,8 +243,7 @@ data = {
237
243
  api_request_context.post("https://example.com/api/create_book", data: data)
238
244
  ```
239
245
 
240
- To send form data to the server use `form` option. Its value will be encoded into the request body with
241
- `application/x-www-form-urlencoded` encoding (see below how to use `multipart/form-data` form encoding to send files):
246
+ To send form data to the server use `form` option. Its value will be encoded into the request body with `application/x-www-form-urlencoded` encoding (see below how to use `multipart/form-data` form encoding to send files):
242
247
 
243
248
  ```ruby
244
249
  form_data = {
@@ -248,8 +253,7 @@ form_data = {
248
253
  api_request_context.post("https://example.com/api/find_book", form: form_data)
249
254
  ```
250
255
 
251
- The common way to send file(s) in the body of a request is to upload them as form fields with `multipart/form-data`
252
- encoding. You can achieve that with Playwright API like this:
256
+ The common way to send file(s) in the body of a request is to upload them as form fields with `multipart/form-data` encoding. You can achieve that with Playwright API like this:
253
257
 
254
258
  ```ruby
255
259
  api_request_context.post(
@@ -264,8 +268,6 @@ api_request_context.post(
264
268
  )
265
269
  ```
266
270
 
267
-
268
-
269
271
  ## put
270
272
 
271
273
  ```
@@ -282,6 +284,7 @@ def put(
282
284
  timeout: nil)
283
285
  ```
284
286
 
285
- Sends HTTP(S) [PUT](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PUT) request and returns its response. The
286
- method will populate request cookies from the context and update context cookies from the response. The method will
287
- automatically follow redirects.
287
+
288
+ Sends HTTP(S) [PUT](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PUT) request and returns its response.
289
+ The method will populate request cookies from the context and update
290
+ context cookies from the response. The method will automatically follow redirects.
@@ -4,6 +4,7 @@ sidebar_position: 10
4
4
 
5
5
  # APIResponse
6
6
 
7
+
7
8
  [APIResponse](./api_response) class represents responses returned by [APIRequestContext#get](./api_request_context#get) and similar methods.
8
9
 
9
10
  ```ruby
@@ -19,13 +20,13 @@ playwright.chromium.launch do |browser|
19
20
  end
20
21
  ```
21
22
 
22
-
23
23
  ## body
24
24
 
25
25
  ```
26
26
  def body
27
27
  ```
28
28
 
29
+
29
30
  Returns the buffer with response body.
30
31
 
31
32
  ## dispose
@@ -34,6 +35,7 @@ Returns the buffer with response body.
34
35
  def dispose
35
36
  ```
36
37
 
38
+
37
39
  Disposes the body of this response. If not called then the body will stay in memory until the context closes.
38
40
 
39
41
  ## headers
@@ -42,6 +44,7 @@ Disposes the body of this response. If not called then the body will stay in mem
42
44
  def headers
43
45
  ```
44
46
 
47
+
45
48
  An object with all the response HTTP headers associated with this response.
46
49
 
47
50
  ## headers_array
@@ -50,8 +53,9 @@ An object with all the response HTTP headers associated with this response.
50
53
  def headers_array
51
54
  ```
52
55
 
53
- An array with all the request HTTP headers associated with this response. Header names are not lower-cased. Headers with
54
- multiple entries, such as `Set-Cookie`, appear in the array multiple times.
56
+
57
+ An array with all the request HTTP headers associated with this response. Header names are not lower-cased.
58
+ Headers with multiple entries, such as `Set-Cookie`, appear in the array multiple times.
55
59
 
56
60
  ## json
57
61
 
@@ -59,6 +63,7 @@ multiple entries, such as `Set-Cookie`, appear in the array multiple times.
59
63
  def json
60
64
  ```
61
65
 
66
+
62
67
  Returns the JSON representation of response body.
63
68
 
64
69
  This method will throw if the response body is not parsable via `JSON.parse`.
@@ -69,6 +74,7 @@ This method will throw if the response body is not parsable via `JSON.parse`.
69
74
  def ok
70
75
  ```
71
76
 
77
+
72
78
  Contains a boolean stating whether the response was successful (status in the range 200-299) or not.
73
79
 
74
80
  ## status
@@ -77,6 +83,7 @@ Contains a boolean stating whether the response was successful (status in the ra
77
83
  def status
78
84
  ```
79
85
 
86
+
80
87
  Contains the status code of the response (e.g., 200 for a success).
81
88
 
82
89
  ## status_text
@@ -85,6 +92,7 @@ Contains the status code of the response (e.g., 200 for a success).
85
92
  def status_text
86
93
  ```
87
94
 
95
+
88
96
  Contains the status text of the response (e.g. usually an "OK" for a success).
89
97
 
90
98
  ## text
@@ -93,6 +101,7 @@ Contains the status text of the response (e.g. usually an "OK" for a success).
93
101
  def text
94
102
  ```
95
103
 
104
+
96
105
  Returns the text representation of response body.
97
106
 
98
107
  ## url
@@ -101,4 +110,5 @@ Returns the text representation of response body.
101
110
  def url
102
111
  ```
103
112
 
113
+
104
114
  Contains the URL of the response.
@@ -19,14 +19,13 @@ ensure
19
19
  end
20
20
  ```
21
21
 
22
-
23
-
24
22
  ## browser_type
25
23
 
26
24
  ```
27
25
  def browser_type
28
26
  ```
29
27
 
28
+
30
29
  Get the browser type (chromium, firefox or webkit) that the browser belongs to.
31
30
 
32
31
  ## close
@@ -35,15 +34,14 @@ Get the browser type (chromium, firefox or webkit) that the browser belongs to.
35
34
  def close
36
35
  ```
37
36
 
37
+
38
38
  In case this browser is obtained using [BrowserType#launch](./browser_type#launch), closes the browser and all of its pages (if any
39
39
  were opened).
40
40
 
41
41
  In case this browser is connected to, clears all created contexts belonging to this browser and disconnects from the
42
42
  browser server.
43
43
 
44
- > NOTE: This is similar to force quitting the browser. Therefore, you should call [BrowserContext#close](./browser_context#close) on
45
- any [BrowserContext](./browser_context)'s you explicitly created earlier with [Browser#new_context](./browser#new_context) **before** calling
46
- [Browser#close](./browser#close).
44
+ **NOTE**: This is similar to force quitting the browser. Therefore, you should call [BrowserContext#close](./browser_context#close) on any [BrowserContext](./browser_context)'s you explicitly created earlier with [Browser#new_context](./browser#new_context) **before** calling [Browser#close](./browser#close).
47
45
 
48
46
  The [Browser](./browser) object itself is considered to be disposed and cannot be used anymore.
49
47
 
@@ -53,8 +51,11 @@ The [Browser](./browser) object itself is considered to be disposed and cannot b
53
51
  def contexts
54
52
  ```
55
53
 
54
+
56
55
  Returns an array of all open browser contexts. In a newly created browser, this will return zero browser contexts.
57
56
 
57
+ **Usage**
58
+
58
59
  ```ruby
59
60
  playwright.webkit.launch do |browser|
60
61
  puts browser.contexts.count # => 0
@@ -63,14 +64,13 @@ playwright.webkit.launch do |browser|
63
64
  end
64
65
  ```
65
66
 
66
-
67
-
68
67
  ## connected?
69
68
 
70
69
  ```
71
70
  def connected?
72
71
  ```
73
72
 
73
+
74
74
  Indicates that the browser is connected.
75
75
 
76
76
  ## new_browser_cdp_session
@@ -79,7 +79,8 @@ Indicates that the browser is connected.
79
79
  def new_browser_cdp_session
80
80
  ```
81
81
 
82
- > NOTE: CDP Sessions are only supported on Chromium-based browsers.
82
+
83
+ **NOTE**: CDP Sessions are only supported on Chromium-based browsers.
83
84
 
84
85
  Returns the newly created browser session.
85
86
 
@@ -123,12 +124,13 @@ def new_context(
123
124
  &block)
124
125
  ```
125
126
 
127
+
126
128
  Creates a new browser context. It won't share cookies/cache with other browser contexts.
127
129
 
128
- > NOTE: If directly using this method to create [BrowserContext](./browser_context)s, it is best practice to explicitly close the returned
129
- context via [BrowserContext#close](./browser_context#close) when your code is done with the [BrowserContext](./browser_context), and before calling
130
- [Browser#close](./browser#close). This will ensure the `context` is closed gracefully and any artifacts—like HARs and
131
- videos—are fully flushed and saved.
130
+ **NOTE**: If directly using this method to create [BrowserContext](./browser_context)s, it is best practice to explicitly close the returned context via [BrowserContext#close](./browser_context#close) when your code is done with the [BrowserContext](./browser_context),
131
+ and before calling [Browser#close](./browser#close). This will ensure the `context` is closed gracefully and any artifacts—like HARs and videos—are fully flushed and saved.
132
+
133
+ **Usage**
132
134
 
133
135
  ```ruby
134
136
  playwright.firefox.launch do |browser| # or "chromium.launch" or "webkit.launch".
@@ -141,8 +143,6 @@ playwright.firefox.launch do |browser| # or "chromium.launch" or "webkit.launch"
141
143
  end
142
144
  ```
143
145
 
144
-
145
-
146
146
  ## new_page
147
147
 
148
148
  ```
@@ -183,6 +183,7 @@ def new_page(
183
183
  &block)
184
184
  ```
185
185
 
186
+
186
187
  Creates a new page in a new browser context. Closing this page will close the context as well.
187
188
 
188
189
  This is a convenience API that should only be used for the single-page scenarios and short snippets. Production code and
@@ -195,12 +196,13 @@ testing frameworks should explicitly create [Browser#new_context](./browser#new_
195
196
  def start_tracing(page: nil, categories: nil, path: nil, screenshots: nil)
196
197
  ```
197
198
 
198
- > NOTE: This API controls [Chromium Tracing](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool)
199
- which is a low-level chromium-specific debugging tool. API to control [Playwright Tracing](https://playwright.dev/python/docs/trace-viewer) could be
200
- found [here](./tracing).
201
199
 
202
- You can use [Browser#start_tracing](./browser#start_tracing) and [Browser#stop_tracing](./browser#stop_tracing) to create a trace file that can be
203
- opened in Chrome DevTools performance panel.
200
+ **NOTE**: This API controls [Chromium Tracing](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool) which is a low-level chromium-specific debugging tool. API to control [Playwright Tracing](https://playwright.dev/python/docs/trace-viewer) could be found [here](./tracing).
201
+
202
+ You can use [Browser#start_tracing](./browser#start_tracing) and [Browser#stop_tracing](./browser#stop_tracing) to create a trace file that can
203
+ be opened in Chrome DevTools performance panel.
204
+
205
+ **Usage**
204
206
 
205
207
  ```ruby
206
208
  browser.start_tracing(page: page, path: "trace.json")
@@ -211,16 +213,14 @@ ensure
211
213
  end
212
214
  ```
213
215
 
214
-
215
216
  ## stop_tracing
216
217
 
217
218
  ```
218
219
  def stop_tracing
219
220
  ```
220
221
 
221
- > NOTE: This API controls [Chromium Tracing](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool)
222
- which is a low-level chromium-specific debugging tool. API to control [Playwright Tracing](https://playwright.dev/python/docs/trace-viewer) could be
223
- found [here](./tracing).
222
+
223
+ **NOTE**: This API controls [Chromium Tracing](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool) which is a low-level chromium-specific debugging tool. API to control [Playwright Tracing](https://playwright.dev/python/docs/trace-viewer) could be found [here](./tracing).
224
224
 
225
225
  Returns the buffer with trace data.
226
226
 
@@ -230,4 +230,5 @@ Returns the buffer with trace data.
230
230
  def version
231
231
  ```
232
232
 
233
+
233
234
  Returns the browser version.