playwright-ruby-client 1.29.1 → 1.30.beta1
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.
- checksums.yaml +4 -4
- data/documentation/docs/api/frame.md +99 -14
- data/documentation/docs/api/frame_locator.md +99 -14
- data/documentation/docs/api/locator.md +355 -49
- data/documentation/docs/api/page.md +99 -14
- data/lib/playwright/version.rb +2 -2
- data/lib/playwright_api/frame.rb +101 -14
- data/lib/playwright_api/frame_locator.rb +101 -14
- data/lib/playwright_api/locator.rb +365 -50
- data/lib/playwright_api/page.rb +101 -14
- data/lib/playwright_api/route.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61056019ca6df698c7edd2ee3ed1bff6ae00edac2e624f2b4f13fad3d165d52d
|
4
|
+
data.tar.gz: 6de6bd7e113c9267cac2e4bb258279d9fa30518efdd737faa8568f3874c50315
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10987b776181bee9d503b2ee15a21367fa99a4938cbe17865562360532776df57521b8371d65cdb3ddec6c3a89d58fd4d8ffd7e5956ed387f5c131754fc7ee79
|
7
|
+
data.tar.gz: 1879a9a9387991ad8bf8634e9e1194d789554ca3e8e75ac5a17b83d42d215dcc5c323e07fd33de8d788163b8a3c4015c2bd8a9a94433581a0adca4bd392f1b0a
|
@@ -418,10 +418,18 @@ def get_by_alt_text(text, exact: nil)
|
|
418
418
|
```
|
419
419
|
|
420
420
|
|
421
|
-
Allows locating elements by their alt text.
|
421
|
+
Allows locating elements by their alt text.
|
422
|
+
|
423
|
+
**Usage**
|
424
|
+
|
425
|
+
For example, this method will find the image by alt text "Playwright logo":
|
422
426
|
|
423
427
|
```html
|
424
|
-
<img alt='
|
428
|
+
<img alt='Playwright logo'>
|
429
|
+
```
|
430
|
+
|
431
|
+
```ruby
|
432
|
+
page.get_by_alt_text("Playwright logo").click
|
425
433
|
```
|
426
434
|
|
427
435
|
## get_by_label
|
@@ -431,13 +439,21 @@ def get_by_label(text, exact: nil)
|
|
431
439
|
```
|
432
440
|
|
433
441
|
|
434
|
-
Allows locating input elements by the text of the associated label.
|
442
|
+
Allows locating input elements by the text of the associated label.
|
443
|
+
|
444
|
+
**Usage**
|
445
|
+
|
446
|
+
For example, this method will find the input by label text "Password" in the following DOM:
|
435
447
|
|
436
448
|
```html
|
437
449
|
<label for="password-input">Password:</label>
|
438
450
|
<input id="password-input">
|
439
451
|
```
|
440
452
|
|
453
|
+
```ruby
|
454
|
+
page.get_by_label("Password").fill("secret")
|
455
|
+
```
|
456
|
+
|
441
457
|
## get_by_placeholder
|
442
458
|
|
443
459
|
```
|
@@ -445,10 +461,20 @@ def get_by_placeholder(text, exact: nil)
|
|
445
461
|
```
|
446
462
|
|
447
463
|
|
448
|
-
Allows locating input elements by the placeholder text.
|
464
|
+
Allows locating input elements by the placeholder text.
|
465
|
+
|
466
|
+
**Usage**
|
467
|
+
|
468
|
+
For example, consider the following DOM structure.
|
449
469
|
|
450
470
|
```html
|
451
|
-
<input placeholder="
|
471
|
+
<input type="email" placeholder="name@example.com" />
|
472
|
+
```
|
473
|
+
|
474
|
+
You can fill the input after locating it by the placeholder text:
|
475
|
+
|
476
|
+
```ruby
|
477
|
+
page.get_by_placeholder("name@example.com").fill("playwright@microsoft.com")
|
452
478
|
```
|
453
479
|
|
454
480
|
## get_by_role
|
@@ -468,9 +494,34 @@ def get_by_role(
|
|
468
494
|
```
|
469
495
|
|
470
496
|
|
471
|
-
Allows locating elements by their [ARIA role](https://www.w3.org/TR/wai-aria-1.2/#roles), [ARIA attributes](https://www.w3.org/TR/wai-aria-1.2/#aria-attributes) and [accessible name](https://w3c.github.io/accname/#dfn-accessible-name).
|
497
|
+
Allows locating elements by their [ARIA role](https://www.w3.org/TR/wai-aria-1.2/#roles), [ARIA attributes](https://www.w3.org/TR/wai-aria-1.2/#aria-attributes) and [accessible name](https://w3c.github.io/accname/#dfn-accessible-name).
|
498
|
+
|
499
|
+
**Usage**
|
500
|
+
|
501
|
+
Consider the following DOM structure.
|
502
|
+
|
503
|
+
```html
|
504
|
+
<h3>Sign up</h3>
|
505
|
+
<label>
|
506
|
+
<input type="checkbox" /> Subscribe
|
507
|
+
</label>
|
508
|
+
<br/>
|
509
|
+
<button>Submit</button>
|
510
|
+
```
|
511
|
+
|
512
|
+
You can locate each element by it's implicit role:
|
513
|
+
|
514
|
+
```ruby
|
515
|
+
page.get_by_role("heading", name: "Sign up").visible? # => true
|
516
|
+
page.get_by_role("checkbox", name: "Subscribe").check
|
517
|
+
page.get_by_role("button", name: /submit/i).click
|
518
|
+
```
|
519
|
+
|
520
|
+
**Details**
|
521
|
+
|
522
|
+
Role selector **does not replace** accessibility audits and conformance tests, but rather gives early feedback about the ARIA guidelines.
|
472
523
|
|
473
|
-
|
524
|
+
Many html elements have an implicitly [defined role](https://w3c.github.io/html-aam/#html-element-role-mappings) that is recognized by the role selector. You can find all the [supported roles here](https://www.w3.org/TR/wai-aria-1.2/#role_definitions). ARIA guidelines **do not recommend** duplicating implicit roles and attributes by setting `role` and/or `aria-*` attributes to default values.
|
474
525
|
|
475
526
|
## get_by_test_id
|
476
527
|
|
@@ -479,7 +530,25 @@ def get_by_test_id(testId)
|
|
479
530
|
```
|
480
531
|
|
481
532
|
|
482
|
-
Locate element by the test id.
|
533
|
+
Locate element by the test id.
|
534
|
+
|
535
|
+
**Usage**
|
536
|
+
|
537
|
+
Consider the following DOM structure.
|
538
|
+
|
539
|
+
```html
|
540
|
+
<button data-testid="directions">Itinéraire</button>
|
541
|
+
```
|
542
|
+
|
543
|
+
You can locate the element by it's test id:
|
544
|
+
|
545
|
+
```ruby
|
546
|
+
page.get_by_test_id("directions").click
|
547
|
+
```
|
548
|
+
|
549
|
+
**Details**
|
550
|
+
|
551
|
+
By default, the `data-testid` attribute is used as a test id. Use [Selectors#set_test_id_attribute](./selectors#set_test_id_attribute) to configure a different test id attribute if necessary.
|
483
552
|
|
484
553
|
## get_by_text
|
485
554
|
|
@@ -488,7 +557,13 @@ def get_by_text(text, exact: nil)
|
|
488
557
|
```
|
489
558
|
|
490
559
|
|
491
|
-
Allows locating elements that contain given text.
|
560
|
+
Allows locating elements that contain given text.
|
561
|
+
|
562
|
+
See also [Locator#filter](./locator#filter) that allows to match by another criteria, like an accessible role, and then filter by the text content.
|
563
|
+
|
564
|
+
**Usage**
|
565
|
+
|
566
|
+
Consider the following DOM structure:
|
492
567
|
|
493
568
|
```html
|
494
569
|
<div>Hello <span>world</span></div>
|
@@ -526,11 +601,11 @@ locator = page.get_by_text(/^hello$/i)
|
|
526
601
|
expect(locator.evaluate('e => e.outerHTML')).to eq('<div>Hello</div>')
|
527
602
|
```
|
528
603
|
|
529
|
-
|
604
|
+
**Details**
|
530
605
|
|
531
|
-
|
606
|
+
Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one, turns line breaks into spaces and ignores leading and trailing whitespace.
|
532
607
|
|
533
|
-
|
608
|
+
Input elements of the type `button` and `submit` are matched by their `value` instead of the text content. For example, locating by text `"Log in"` matches `<input type=button value="Log in">`.
|
534
609
|
|
535
610
|
## get_by_title
|
536
611
|
|
@@ -539,10 +614,20 @@ def get_by_title(text, exact: nil)
|
|
539
614
|
```
|
540
615
|
|
541
616
|
|
542
|
-
Allows locating elements by their title.
|
617
|
+
Allows locating elements by their title attribute.
|
618
|
+
|
619
|
+
**Usage**
|
620
|
+
|
621
|
+
Consider the following DOM structure.
|
543
622
|
|
544
623
|
```html
|
545
|
-
<
|
624
|
+
<span title='Issues count'>25 issues</span>
|
625
|
+
```
|
626
|
+
|
627
|
+
You can check the issues count after locating it by the title text:
|
628
|
+
|
629
|
+
```ruby
|
630
|
+
page.get_by_title("Issues count").text_content # => "25 issues"
|
546
631
|
```
|
547
632
|
|
548
633
|
## goto
|
@@ -58,10 +58,18 @@ def get_by_alt_text(text, exact: nil)
|
|
58
58
|
```
|
59
59
|
|
60
60
|
|
61
|
-
Allows locating elements by their alt text.
|
61
|
+
Allows locating elements by their alt text.
|
62
|
+
|
63
|
+
**Usage**
|
64
|
+
|
65
|
+
For example, this method will find the image by alt text "Playwright logo":
|
62
66
|
|
63
67
|
```html
|
64
|
-
<img alt='
|
68
|
+
<img alt='Playwright logo'>
|
69
|
+
```
|
70
|
+
|
71
|
+
```ruby
|
72
|
+
page.get_by_alt_text("Playwright logo").click
|
65
73
|
```
|
66
74
|
|
67
75
|
## get_by_label
|
@@ -71,13 +79,21 @@ def get_by_label(text, exact: nil)
|
|
71
79
|
```
|
72
80
|
|
73
81
|
|
74
|
-
Allows locating input elements by the text of the associated label.
|
82
|
+
Allows locating input elements by the text of the associated label.
|
83
|
+
|
84
|
+
**Usage**
|
85
|
+
|
86
|
+
For example, this method will find the input by label text "Password" in the following DOM:
|
75
87
|
|
76
88
|
```html
|
77
89
|
<label for="password-input">Password:</label>
|
78
90
|
<input id="password-input">
|
79
91
|
```
|
80
92
|
|
93
|
+
```ruby
|
94
|
+
page.get_by_label("Password").fill("secret")
|
95
|
+
```
|
96
|
+
|
81
97
|
## get_by_placeholder
|
82
98
|
|
83
99
|
```
|
@@ -85,10 +101,20 @@ def get_by_placeholder(text, exact: nil)
|
|
85
101
|
```
|
86
102
|
|
87
103
|
|
88
|
-
Allows locating input elements by the placeholder text.
|
104
|
+
Allows locating input elements by the placeholder text.
|
105
|
+
|
106
|
+
**Usage**
|
107
|
+
|
108
|
+
For example, consider the following DOM structure.
|
89
109
|
|
90
110
|
```html
|
91
|
-
<input placeholder="
|
111
|
+
<input type="email" placeholder="name@example.com" />
|
112
|
+
```
|
113
|
+
|
114
|
+
You can fill the input after locating it by the placeholder text:
|
115
|
+
|
116
|
+
```ruby
|
117
|
+
page.get_by_placeholder("name@example.com").fill("playwright@microsoft.com")
|
92
118
|
```
|
93
119
|
|
94
120
|
## get_by_role
|
@@ -108,9 +134,34 @@ def get_by_role(
|
|
108
134
|
```
|
109
135
|
|
110
136
|
|
111
|
-
Allows locating elements by their [ARIA role](https://www.w3.org/TR/wai-aria-1.2/#roles), [ARIA attributes](https://www.w3.org/TR/wai-aria-1.2/#aria-attributes) and [accessible name](https://w3c.github.io/accname/#dfn-accessible-name).
|
137
|
+
Allows locating elements by their [ARIA role](https://www.w3.org/TR/wai-aria-1.2/#roles), [ARIA attributes](https://www.w3.org/TR/wai-aria-1.2/#aria-attributes) and [accessible name](https://w3c.github.io/accname/#dfn-accessible-name).
|
138
|
+
|
139
|
+
**Usage**
|
140
|
+
|
141
|
+
Consider the following DOM structure.
|
142
|
+
|
143
|
+
```html
|
144
|
+
<h3>Sign up</h3>
|
145
|
+
<label>
|
146
|
+
<input type="checkbox" /> Subscribe
|
147
|
+
</label>
|
148
|
+
<br/>
|
149
|
+
<button>Submit</button>
|
150
|
+
```
|
151
|
+
|
152
|
+
You can locate each element by it's implicit role:
|
153
|
+
|
154
|
+
```ruby
|
155
|
+
page.get_by_role("heading", name: "Sign up").visible? # => true
|
156
|
+
page.get_by_role("checkbox", name: "Subscribe").check
|
157
|
+
page.get_by_role("button", name: /submit/i).click
|
158
|
+
```
|
112
159
|
|
113
|
-
|
160
|
+
**Details**
|
161
|
+
|
162
|
+
Role selector **does not replace** accessibility audits and conformance tests, but rather gives early feedback about the ARIA guidelines.
|
163
|
+
|
164
|
+
Many html elements have an implicitly [defined role](https://w3c.github.io/html-aam/#html-element-role-mappings) that is recognized by the role selector. You can find all the [supported roles here](https://www.w3.org/TR/wai-aria-1.2/#role_definitions). ARIA guidelines **do not recommend** duplicating implicit roles and attributes by setting `role` and/or `aria-*` attributes to default values.
|
114
165
|
|
115
166
|
## get_by_test_id
|
116
167
|
|
@@ -119,7 +170,25 @@ def get_by_test_id(testId)
|
|
119
170
|
```
|
120
171
|
|
121
172
|
|
122
|
-
Locate element by the test id.
|
173
|
+
Locate element by the test id.
|
174
|
+
|
175
|
+
**Usage**
|
176
|
+
|
177
|
+
Consider the following DOM structure.
|
178
|
+
|
179
|
+
```html
|
180
|
+
<button data-testid="directions">Itinéraire</button>
|
181
|
+
```
|
182
|
+
|
183
|
+
You can locate the element by it's test id:
|
184
|
+
|
185
|
+
```ruby
|
186
|
+
page.get_by_test_id("directions").click
|
187
|
+
```
|
188
|
+
|
189
|
+
**Details**
|
190
|
+
|
191
|
+
By default, the `data-testid` attribute is used as a test id. Use [Selectors#set_test_id_attribute](./selectors#set_test_id_attribute) to configure a different test id attribute if necessary.
|
123
192
|
|
124
193
|
## get_by_text
|
125
194
|
|
@@ -128,7 +197,13 @@ def get_by_text(text, exact: nil)
|
|
128
197
|
```
|
129
198
|
|
130
199
|
|
131
|
-
Allows locating elements that contain given text.
|
200
|
+
Allows locating elements that contain given text.
|
201
|
+
|
202
|
+
See also [Locator#filter](./locator#filter) that allows to match by another criteria, like an accessible role, and then filter by the text content.
|
203
|
+
|
204
|
+
**Usage**
|
205
|
+
|
206
|
+
Consider the following DOM structure:
|
132
207
|
|
133
208
|
```html
|
134
209
|
<div>Hello <span>world</span></div>
|
@@ -166,11 +241,11 @@ locator = page.get_by_text(/^hello$/i)
|
|
166
241
|
expect(locator.evaluate('e => e.outerHTML')).to eq('<div>Hello</div>')
|
167
242
|
```
|
168
243
|
|
169
|
-
|
244
|
+
**Details**
|
170
245
|
|
171
|
-
|
246
|
+
Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one, turns line breaks into spaces and ignores leading and trailing whitespace.
|
172
247
|
|
173
|
-
|
248
|
+
Input elements of the type `button` and `submit` are matched by their `value` instead of the text content. For example, locating by text `"Log in"` matches `<input type=button value="Log in">`.
|
174
249
|
|
175
250
|
## get_by_title
|
176
251
|
|
@@ -179,10 +254,20 @@ def get_by_title(text, exact: nil)
|
|
179
254
|
```
|
180
255
|
|
181
256
|
|
182
|
-
Allows locating elements by their title.
|
257
|
+
Allows locating elements by their title attribute.
|
258
|
+
|
259
|
+
**Usage**
|
260
|
+
|
261
|
+
Consider the following DOM structure.
|
183
262
|
|
184
263
|
```html
|
185
|
-
<
|
264
|
+
<span title='Issues count'>25 issues</span>
|
265
|
+
```
|
266
|
+
|
267
|
+
You can check the issues count after locating it by the title text:
|
268
|
+
|
269
|
+
```ruby
|
270
|
+
page.get_by_title("Issues count").text_content # => "25 issues"
|
186
271
|
```
|
187
272
|
|
188
273
|
## last
|