playwright-ruby-client 1.26.0 → 1.27.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/documentation/docs/api/api_request_context.md +86 -0
  3. data/documentation/docs/api/browser_context.md +3 -3
  4. data/documentation/docs/api/download.md +1 -1
  5. data/documentation/docs/api/element_handle.md +1 -1
  6. data/documentation/docs/api/file_chooser.md +1 -1
  7. data/documentation/docs/api/frame.md +103 -4
  8. data/documentation/docs/api/frame_locator.md +104 -4
  9. data/documentation/docs/api/locator.md +121 -6
  10. data/documentation/docs/api/page.md +118 -9
  11. data/documentation/docs/api/tracing.md +1 -1
  12. data/documentation/docs/article/guides/rails_integration_with_null_driver.md +59 -0
  13. data/documentation/docs/include/api_coverage.md +29 -0
  14. data/lib/playwright/channel_owners/frame.rb +4 -0
  15. data/lib/playwright/channel_owners/page.rb +2 -0
  16. data/lib/playwright/channel_owners/selectors.rb +4 -0
  17. data/lib/playwright/frame_locator_impl.rb +6 -2
  18. data/lib/playwright/locator_impl.rb +7 -31
  19. data/lib/playwright/locator_utils.rb +142 -0
  20. data/lib/playwright/version.rb +2 -2
  21. data/lib/playwright_api/api_request_context.rb +80 -2
  22. data/lib/playwright_api/browser_context.rb +3 -3
  23. data/lib/playwright_api/download.rb +1 -1
  24. data/lib/playwright_api/element_handle.rb +1 -1
  25. data/lib/playwright_api/file_chooser.rb +1 -1
  26. data/lib/playwright_api/frame.rb +78 -4
  27. data/lib/playwright_api/frame_locator.rb +78 -3
  28. data/lib/playwright_api/locator.rb +94 -5
  29. data/lib/playwright_api/page.rb +92 -9
  30. data/lib/playwright_api/request.rb +4 -4
  31. data/lib/playwright_api/response.rb +4 -4
  32. data/lib/playwright_api/selectors.rb +11 -0
  33. data/lib/playwright_api/tracing.rb +1 -1
  34. data/lib/playwright_api/worker.rb +4 -4
  35. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: beca54a9f8e488cefb33f9266bd227bdb002ea5e379f6525733375f30a26aad2
4
- data.tar.gz: a8cb017751e740755cb92a7525a59afde927b9393ed13d71e0af2797c857496e
3
+ metadata.gz: 9944a15cd23ff09a56c09f396ff276ec366670740f4c79cb553a9dedec346ff8
4
+ data.tar.gz: 33807cddbf67539e40d8659fd565827a1c0127ccc65c7b6a2864b8e80184053b
5
5
  SHA512:
6
- metadata.gz: f7ede551835e7916acf830ef26664cd6421910c966d96f9e85c599383c48fc7707467f2d095a848c6f23071310e6072cde47b7412b4d83d1f381373dc42b6011
7
- data.tar.gz: c4aa082a27871b37b64236c0fc40c17083884696fb2ceef8a3bd9e6c72d5089081a81ac616fd1a8116cf7052575888fa63abc47866d2cff413b21aee9a695f10
6
+ metadata.gz: ece68b2c84a789d011b00dd17f27a280e26b23349cc474ec04ca00eab18df2a813a1ebda61143603de02f3abec0fc988818122a09a35d57aa101fbb5429c2beb
7
+ data.tar.gz: 5070dd01c89f50580c98e196e1d97b5ffcc34ab1fc7856ac9943a6bfc4743e418cac2b3632566a88c24f99ed7fad1c0c3f1c7f66f873a76c02b993eb0baf74bc
@@ -106,15 +106,47 @@ def fetch(
106
106
  Sends HTTP(S) request and returns its response. The method will populate request cookies from the context and update
107
107
  context cookies from the response. The method will automatically follow redirects.
108
108
 
109
+ JSON objects can be passed directly to the request:
110
+
111
+ ```ruby
112
+ data = {
113
+ title: "Book Title",
114
+ body: "John Doe",
115
+ }
116
+ api_request_context.fetch("https://example.com/api/create_book", method: 'post', data: data)
117
+ ```
118
+
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:
121
+
122
+ ```ruby
123
+ api_request_context.fetch(
124
+ "https://example.com/api/upload_script",
125
+ method: 'post',
126
+ multipart: {
127
+ fileField: {
128
+ name: "f.js",
129
+ mimeType: "text/javascript",
130
+ buffer: "console.log(2022);",
131
+ },
132
+ },
133
+ )
134
+ ```
135
+
136
+
137
+
109
138
  ## get
110
139
 
111
140
  ```
112
141
  def get(
113
142
  url,
143
+ data: nil,
114
144
  failOnStatusCode: nil,
145
+ form: nil,
115
146
  headers: nil,
116
147
  ignoreHTTPSErrors: nil,
117
148
  maxRedirects: nil,
149
+ multipart: nil,
118
150
  params: nil,
119
151
  timeout: nil)
120
152
  ```
@@ -123,15 +155,30 @@ Sends HTTP(S) [GET](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GE
123
155
  method will populate request cookies from the context and update context cookies from the response. The method will
124
156
  automatically follow redirects.
125
157
 
158
+ Request parameters can be configured with `params` option, they will be serialized into the URL search parameters:
159
+
160
+ ```ruby
161
+ query_params = {
162
+ isbn: "1234",
163
+ page: "23"
164
+ }
165
+ api_request_context.get("https://example.com/api/get_text", params: query_params)
166
+ ```
167
+
168
+
169
+
126
170
  ## head
127
171
 
128
172
  ```
129
173
  def head(
130
174
  url,
175
+ data: nil,
131
176
  failOnStatusCode: nil,
177
+ form: nil,
132
178
  headers: nil,
133
179
  ignoreHTTPSErrors: nil,
134
180
  maxRedirects: nil,
181
+ multipart: nil,
135
182
  params: nil,
136
183
  timeout: nil)
137
184
  ```
@@ -180,6 +227,45 @@ Sends HTTP(S) [POST](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/P
180
227
  The method will populate request cookies from the context and update context cookies from the response. The method will
181
228
  automatically follow redirects.
182
229
 
230
+ JSON objects can be passed directly to the request:
231
+
232
+ ```ruby
233
+ data = {
234
+ title: "Book Title",
235
+ body: "John Doe",
236
+ }
237
+ api_request_context.post("https://example.com/api/create_book", data: data)
238
+ ```
239
+
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):
242
+
243
+ ```ruby
244
+ form_data = {
245
+ title: "Book Title",
246
+ body: "John Doe",
247
+ }
248
+ api_request_context.post("https://example.com/api/find_book", form: form_data)
249
+ ```
250
+
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:
253
+
254
+ ```ruby
255
+ api_request_context.post(
256
+ "https://example.com/api/upload_script",
257
+ multipart: {
258
+ fileField: {
259
+ name: "f.js",
260
+ mimeType: "text/javascript",
261
+ buffer: "console.log(2022);",
262
+ },
263
+ },
264
+ )
265
+ ```
266
+
267
+
268
+
183
269
  ## put
184
270
 
185
271
  ```
@@ -161,7 +161,7 @@ page.content = <<~HTML
161
161
  <div></div>
162
162
  HTML
163
163
 
164
- page.locator("button").click
164
+ page.get_by_role("button").click
165
165
  ```
166
166
 
167
167
  An example of passing an element handle:
@@ -222,7 +222,7 @@ page.content = <<~HTML
222
222
  <button onclick="onClick()">Click me</button>
223
223
  <div></div>
224
224
  HTML
225
- page.locator("button").click
225
+ page.get_by_role("button").click
226
226
  ```
227
227
 
228
228
 
@@ -434,7 +434,7 @@ value. Will throw an error if the context closes before the event is fired. Retu
434
434
 
435
435
  ```ruby
436
436
  new_page = browser_context.expect_event('page') do
437
- page.locator('button').click
437
+ page.get_by_role("button").click
438
438
  end
439
439
  ```
440
440
 
@@ -12,7 +12,7 @@ Download event is emitted once the download starts. Download path becomes availa
12
12
 
13
13
  ```ruby
14
14
  download = page.expect_download do
15
- page.locator('a').click
15
+ page.get_by_text("Download file").click
16
16
  end
17
17
 
18
18
  # wait for download to complete
@@ -39,7 +39,7 @@ With the locator, every time the `element` is used, up-to-date DOM element is lo
39
39
  in the snippet below, underlying DOM element is going to be located twice.
40
40
 
41
41
  ```ruby
42
- locator = page.locator("text=Submit")
42
+ locator = page.get_by_text("Submit")
43
43
  locator.hover
44
44
  locator.click
45
45
  ```
@@ -8,7 +8,7 @@ sidebar_position: 10
8
8
 
9
9
  ```ruby
10
10
  file_chooser = page.expect_file_chooser do
11
- page.locator("upload").click # action to trigger file uploading
11
+ page.get_by_text("Upload").click # action to trigger file uploading
12
12
  end
13
13
  file_chooser.set_files("myfile.pdf")
14
14
  ```
@@ -401,7 +401,7 @@ that iframe. Following snippet locates element with text "Submit" in the iframe
401
401
  id="my-frame">`:
402
402
 
403
403
  ```ruby
404
- locator = frame.frame_locator("#my-iframe").locator("text=Submit")
404
+ locator = frame.frame_locator("#my-iframe").get_by_text("Submit")
405
405
  locator.click
406
406
  ```
407
407
 
@@ -415,6 +415,103 @@ def get_attribute(selector, name, strict: nil, timeout: nil)
415
415
 
416
416
  Returns element attribute value.
417
417
 
418
+ ## get_by_alt_text
419
+
420
+ ```
421
+ def get_by_alt_text(text, exact: nil)
422
+ ```
423
+
424
+ Allows locating elements by their alt text. For example, this method will find the image by alt text "Castle":
425
+
426
+ ```html
427
+ <img alt='Castle'>
428
+ ```
429
+
430
+
431
+ ## get_by_label
432
+
433
+ ```
434
+ def get_by_label(text, exact: nil)
435
+ ```
436
+
437
+ Allows locating input elements by the text of the associated label. For example, this method will find the input by
438
+ label text Password in the following DOM:
439
+
440
+ ```html
441
+ <label for="password-input">Password:</label>
442
+ <input id="password-input">
443
+ ```
444
+
445
+
446
+ ## get_by_placeholder
447
+
448
+ ```
449
+ def get_by_placeholder(text, exact: nil)
450
+ ```
451
+
452
+ Allows locating input elements by the placeholder text. For example, this method will find the input by placeholder
453
+ "Country":
454
+
455
+ ```html
456
+ <input placeholder="Country">
457
+ ```
458
+
459
+
460
+ ## get_by_role
461
+
462
+ ```
463
+ def get_by_role(
464
+ role,
465
+ checked: nil,
466
+ disabled: nil,
467
+ expanded: nil,
468
+ includeHidden: nil,
469
+ level: nil,
470
+ name: nil,
471
+ pressed: nil,
472
+ selected: nil)
473
+ ```
474
+
475
+ Allows locating elements by their [ARIA role](https://www.w3.org/TR/wai-aria-1.2/#roles),
476
+ [ARIA attributes](https://www.w3.org/TR/wai-aria-1.2/#aria-attributes) and
477
+ [accessible name](https://w3c.github.io/accname/#dfn-accessible-name). Note that role selector **does not replace**
478
+ accessibility audits and conformance tests, but rather gives early feedback about the ARIA guidelines.
479
+
480
+ Note that many html elements have an implicitly
481
+ [defined role](https://w3c.github.io/html-aam/#html-element-role-mappings) that is recognized by the role selector. You
482
+ can find all the [supported roles here](https://www.w3.org/TR/wai-aria-1.2/#role_definitions). ARIA guidelines **do not
483
+ recommend** duplicating implicit roles and attributes by setting `role` and/or `aria-*` attributes to default values.
484
+
485
+ ## get_by_test_id
486
+
487
+ ```
488
+ def get_by_test_id(testId)
489
+ ```
490
+
491
+ Locate element by the test id. By default, the `data-testid` attribute is used as a test id. Use
492
+ [Selectors#set_test_id_attribute](./selectors#set_test_id_attribute) to configure a different test id attribute if necessary.
493
+
494
+ ## get_by_text
495
+
496
+ ```
497
+ def get_by_text(text, exact: nil)
498
+ ```
499
+
500
+ Allows locating elements that contain given text.
501
+
502
+ ## get_by_title
503
+
504
+ ```
505
+ def get_by_title(text, exact: nil)
506
+ ```
507
+
508
+ Allows locating elements by their title. For example, this method will find the button by its title "Submit":
509
+
510
+ ```html
511
+ <button title='Place the order'>Order Now</button>
512
+ ```
513
+
514
+
418
515
  ## goto
419
516
 
420
517
  ```
@@ -555,9 +652,11 @@ considered not visible.
555
652
  def locator(selector, has: nil, hasText: nil)
556
653
  ```
557
654
 
558
- The method returns an element locator that can be used to perform actions in the frame. Locator is resolved to the
559
- element immediately before performing an action, so a series of actions on the same locator can in fact be performed on
560
- different DOM elements. That would happen if the DOM structure between those actions has changed.
655
+ The method returns an element locator that can be used to perform actions on this page / frame. Locator is resolved to
656
+ the element immediately before performing an action, so a series of actions on the same locator can in fact be performed
657
+ on different DOM elements. That would happen if the DOM structure between those actions has changed.
658
+
659
+ [Learn more about locators](https://playwright.dev/python/docs/locators).
561
660
 
562
661
  [Learn more about locators](https://playwright.dev/python/docs/locators).
563
662
 
@@ -9,7 +9,7 @@ and locate elements in that iframe. FrameLocator can be created with either [Pag
9
9
  [Locator#frame_locator](./locator#frame_locator) method.
10
10
 
11
11
  ```ruby
12
- locator = page.frame_locator("my-frame").locator("text=Submit")
12
+ locator = page.frame_locator("my-frame").get_by_text("Submit")
13
13
  locator.click
14
14
  ```
15
15
 
@@ -20,10 +20,10 @@ a given selector.
20
20
 
21
21
  ```ruby
22
22
  # Throws if there are several frames in DOM:
23
- page.frame_locator('.result-frame').locator('button').click
23
+ page.frame_locator('.result-frame').get_by_role('button').click
24
24
 
25
25
  # Works because we explicitly tell locator to pick the first frame:
26
- page.frame_locator('.result-frame').first.locator('button').click
26
+ page.frame_locator('.result-frame').first.get_by_role('button').click
27
27
  ```
28
28
 
29
29
  **Converting Locator to FrameLocator**
@@ -54,6 +54,103 @@ def frame_locator(selector)
54
54
  When working with iframes, you can create a frame locator that will enter the iframe and allow selecting elements in
55
55
  that iframe.
56
56
 
57
+ ## get_by_alt_text
58
+
59
+ ```
60
+ def get_by_alt_text(text, exact: nil)
61
+ ```
62
+
63
+ Allows locating elements by their alt text. For example, this method will find the image by alt text "Castle":
64
+
65
+ ```html
66
+ <img alt='Castle'>
67
+ ```
68
+
69
+
70
+ ## get_by_label
71
+
72
+ ```
73
+ def get_by_label(text, exact: nil)
74
+ ```
75
+
76
+ Allows locating input elements by the text of the associated label. For example, this method will find the input by
77
+ label text Password in the following DOM:
78
+
79
+ ```html
80
+ <label for="password-input">Password:</label>
81
+ <input id="password-input">
82
+ ```
83
+
84
+
85
+ ## get_by_placeholder
86
+
87
+ ```
88
+ def get_by_placeholder(text, exact: nil)
89
+ ```
90
+
91
+ Allows locating input elements by the placeholder text. For example, this method will find the input by placeholder
92
+ "Country":
93
+
94
+ ```html
95
+ <input placeholder="Country">
96
+ ```
97
+
98
+
99
+ ## get_by_role
100
+
101
+ ```
102
+ def get_by_role(
103
+ role,
104
+ checked: nil,
105
+ disabled: nil,
106
+ expanded: nil,
107
+ includeHidden: nil,
108
+ level: nil,
109
+ name: nil,
110
+ pressed: nil,
111
+ selected: nil)
112
+ ```
113
+
114
+ Allows locating elements by their [ARIA role](https://www.w3.org/TR/wai-aria-1.2/#roles),
115
+ [ARIA attributes](https://www.w3.org/TR/wai-aria-1.2/#aria-attributes) and
116
+ [accessible name](https://w3c.github.io/accname/#dfn-accessible-name). Note that role selector **does not replace**
117
+ accessibility audits and conformance tests, but rather gives early feedback about the ARIA guidelines.
118
+
119
+ Note that many html elements have an implicitly
120
+ [defined role](https://w3c.github.io/html-aam/#html-element-role-mappings) that is recognized by the role selector. You
121
+ can find all the [supported roles here](https://www.w3.org/TR/wai-aria-1.2/#role_definitions). ARIA guidelines **do not
122
+ recommend** duplicating implicit roles and attributes by setting `role` and/or `aria-*` attributes to default values.
123
+
124
+ ## get_by_test_id
125
+
126
+ ```
127
+ def get_by_test_id(testId)
128
+ ```
129
+
130
+ Locate element by the test id. By default, the `data-testid` attribute is used as a test id. Use
131
+ [Selectors#set_test_id_attribute](./selectors#set_test_id_attribute) to configure a different test id attribute if necessary.
132
+
133
+ ## get_by_text
134
+
135
+ ```
136
+ def get_by_text(text, exact: nil)
137
+ ```
138
+
139
+ Allows locating elements that contain given text.
140
+
141
+ ## get_by_title
142
+
143
+ ```
144
+ def get_by_title(text, exact: nil)
145
+ ```
146
+
147
+ Allows locating elements by their title. For example, this method will find the button by its title "Submit":
148
+
149
+ ```html
150
+ <button title='Place the order'>Order Now</button>
151
+ ```
152
+
153
+
57
154
  ## last
58
155
 
59
156
  ```
@@ -68,7 +165,10 @@ Returns locator to the last matching frame.
68
165
  def locator(selector, has: nil, hasText: nil)
69
166
  ```
70
167
 
71
- The method finds an element matching the specified selector in the FrameLocator's subtree.
168
+ The method finds an element matching the specified selector in the locator's subtree. It also accepts filter options,
169
+ similar to [Locator#filter](./locator#filter) method.
170
+
171
+ [Learn more about locators](https://playwright.dev/python/docs/locators).
72
172
 
73
173
  ## nth
74
174
 
@@ -190,6 +190,22 @@ def drag_to(
190
190
  trial: nil)
191
191
  ```
192
192
 
193
+ This method drags the locator to another target locator or target position. It will first move to the source element,
194
+ perform a `mousedown`, then move to the target element or position and perform a `mouseup`.
195
+
196
+ ```ruby
197
+ source = page.locator("#source")
198
+ target = page.locator("#target")
199
+
200
+ source.drag_to(target)
201
+ # or specify exact positions relative to the top-left corners of the elements:
202
+ source.drag_to(
203
+ target,
204
+ sourcePosition: { x: 34, y: 7 },
205
+ targetPosition: { x: 10, y: 20 },
206
+ )
207
+ ```
208
+
193
209
 
194
210
 
195
211
  ## element_handle
@@ -298,8 +314,8 @@ multiple times.
298
314
  row_locator = page.locator("tr")
299
315
  # ...
300
316
  row_locator.
301
- filter(has_text="text in column 1").
302
- filter(has=page.locator("tr", has_text="column 2 button")).
317
+ filter(hasText: "text in column 1").
318
+ filter(has: page.get_by_role("button", name: "column 2 button")).
303
319
  screenshot
304
320
  ```
305
321
 
@@ -331,7 +347,7 @@ When working with iframes, you can create a frame locator that will enter the if
331
347
  that iframe:
332
348
 
333
349
  ```ruby
334
- locator = page.frame_locator("iframe").locator("text=Submit")
350
+ locator = page.frame_locator("iframe").get_by_text("Submit")
335
351
  locator.click
336
352
  ```
337
353
 
@@ -346,6 +362,103 @@ alias: `[]`
346
362
 
347
363
  Returns element attribute value.
348
364
 
365
+ ## get_by_alt_text
366
+
367
+ ```
368
+ def get_by_alt_text(text, exact: nil)
369
+ ```
370
+
371
+ Allows locating elements by their alt text. For example, this method will find the image by alt text "Castle":
372
+
373
+ ```html
374
+ <img alt='Castle'>
375
+ ```
376
+
377
+
378
+ ## get_by_label
379
+
380
+ ```
381
+ def get_by_label(text, exact: nil)
382
+ ```
383
+
384
+ Allows locating input elements by the text of the associated label. For example, this method will find the input by
385
+ label text Password in the following DOM:
386
+
387
+ ```html
388
+ <label for="password-input">Password:</label>
389
+ <input id="password-input">
390
+ ```
391
+
392
+
393
+ ## get_by_placeholder
394
+
395
+ ```
396
+ def get_by_placeholder(text, exact: nil)
397
+ ```
398
+
399
+ Allows locating input elements by the placeholder text. For example, this method will find the input by placeholder
400
+ "Country":
401
+
402
+ ```html
403
+ <input placeholder="Country">
404
+ ```
405
+
406
+
407
+ ## get_by_role
408
+
409
+ ```
410
+ def get_by_role(
411
+ role,
412
+ checked: nil,
413
+ disabled: nil,
414
+ expanded: nil,
415
+ includeHidden: nil,
416
+ level: nil,
417
+ name: nil,
418
+ pressed: nil,
419
+ selected: nil)
420
+ ```
421
+
422
+ Allows locating elements by their [ARIA role](https://www.w3.org/TR/wai-aria-1.2/#roles),
423
+ [ARIA attributes](https://www.w3.org/TR/wai-aria-1.2/#aria-attributes) and
424
+ [accessible name](https://w3c.github.io/accname/#dfn-accessible-name). Note that role selector **does not replace**
425
+ accessibility audits and conformance tests, but rather gives early feedback about the ARIA guidelines.
426
+
427
+ Note that many html elements have an implicitly
428
+ [defined role](https://w3c.github.io/html-aam/#html-element-role-mappings) that is recognized by the role selector. You
429
+ can find all the [supported roles here](https://www.w3.org/TR/wai-aria-1.2/#role_definitions). ARIA guidelines **do not
430
+ recommend** duplicating implicit roles and attributes by setting `role` and/or `aria-*` attributes to default values.
431
+
432
+ ## get_by_test_id
433
+
434
+ ```
435
+ def get_by_test_id(testId)
436
+ ```
437
+
438
+ Locate element by the test id. By default, the `data-testid` attribute is used as a test id. Use
439
+ [Selectors#set_test_id_attribute](./selectors#set_test_id_attribute) to configure a different test id attribute if necessary.
440
+
441
+ ## get_by_text
442
+
443
+ ```
444
+ def get_by_text(text, exact: nil)
445
+ ```
446
+
447
+ Allows locating elements that contain given text.
448
+
449
+ ## get_by_title
450
+
451
+ ```
452
+ def get_by_title(text, exact: nil)
453
+ ```
454
+
455
+ Allows locating elements by their title. For example, this method will find the button by its title "Submit":
456
+
457
+ ```html
458
+ <button title='Place the order'>Order Now</button>
459
+ ```
460
+
461
+
349
462
  ## highlight
350
463
 
351
464
  ```
@@ -466,9 +579,11 @@ Returns locator to the last matching element.
466
579
  def locator(selector, has: nil, hasText: nil)
467
580
  ```
468
581
 
469
- The method finds an element matching the specified selector in the [Locator](./locator)'s subtree. It also accepts filter options,
582
+ The method finds an element matching the specified selector in the locator's subtree. It also accepts filter options,
470
583
  similar to [Locator#filter](./locator#filter) method.
471
584
 
585
+ [Learn more about locators](https://playwright.dev/python/docs/locators).
586
+
472
587
  ## nth
473
588
 
474
589
  ```
@@ -684,8 +799,8 @@ element.type("world", delay: 100) # types slower, like a user
684
799
  An example of typing into a text field and then submitting the form:
685
800
 
686
801
  ```ruby
687
- element = page.locator("input")
688
- element.type("some text")
802
+ element = page.get_by_label("Password")
803
+ element.type("my password")
689
804
  element.press("Enter")
690
805
  ```
691
806