playwright-ruby-client 1.39.0 → 1.39.1
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/browser.md +9 -13
- data/documentation/docs/api/browser_context.md +32 -51
- data/documentation/docs/api/browser_type.md +7 -12
- data/documentation/docs/api/dialog.md +15 -18
- data/documentation/docs/api/download.md +9 -10
- data/documentation/docs/api/element_handle.md +5 -6
- data/documentation/docs/api/frame.md +24 -54
- data/documentation/docs/api/locator.md +20 -22
- data/documentation/docs/api/locator_assertions.md +642 -0
- data/documentation/docs/api/page.md +48 -101
- data/documentation/docs/api/playwright.md +20 -23
- data/documentation/docs/api/selectors.md +29 -34
- data/documentation/docs/include/api_coverage.md +43 -0
- data/lib/playwright/channel.rb +1 -1
- data/lib/playwright/errors.rb +2 -0
- data/lib/playwright/javascript/value_serializer.rb +1 -1
- data/lib/playwright/locator_assertions_impl.rb +417 -0
- data/lib/playwright/locator_impl.rb +24 -5
- data/lib/playwright/test.rb +68 -0
- data/lib/playwright/version.rb +1 -1
- data/lib/playwright_api/locator.rb +5 -0
- data/lib/playwright_api/locator_assertions.rb +551 -0
- data/sig/playwright.rbs +43 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9c0bd246e9fc2ccd9358b60aa056266dfcee1f3fd2ee0174ae7a23173a1a9cb
|
4
|
+
data.tar.gz: 7e68e6e420040c24cdb9514dcde89ec6a2fd68ceda91b9590ed367ef5b1e52b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e67763b081ab137ab5da3cfbb0e397a664b4489574a3368e0059566b0e6c519d8685e252bedf76213cd7a8cad34cde3e0b2c4587adcc2241b255095ad1ffa3c7
|
7
|
+
data.tar.gz: 675f7ad040dace09c78d5d12672999d7c5a6d2ae067c89a078dd75e6f866db53191d1890a76d816f8aef797d83f0b12ed7d1311c3cbf00c90f62d38cfb407e62
|
@@ -8,19 +8,15 @@ sidebar_position: 10
|
|
8
8
|
|
9
9
|
A Browser is created via [BrowserType#launch](./browser_type#launch). An example of using a [Browser](./browser) to create a [Page](./page):
|
10
10
|
|
11
|
-
```
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
with sync_playwright() as playwright:
|
22
|
-
run(playwright)
|
23
|
-
|
11
|
+
```ruby
|
12
|
+
firefox = playwright.firefox
|
13
|
+
browser = firefox.launch
|
14
|
+
begin
|
15
|
+
page = browser.new_page
|
16
|
+
page.goto("https://example.com")
|
17
|
+
ensure
|
18
|
+
browser.close
|
19
|
+
end
|
24
20
|
```
|
25
21
|
|
26
22
|
## browser_type
|
@@ -158,29 +158,21 @@ See [Page#expose_binding](./page#expose_binding) for page-only version.
|
|
158
158
|
|
159
159
|
An example of exposing page URL to all frames in all pages in the context:
|
160
160
|
|
161
|
-
```
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
}
|
175
|
-
</script>
|
176
|
-
<button onclick="onClick()">Click me</button>
|
177
|
-
<div></div>
|
178
|
-
""")
|
179
|
-
page.get_by_role("button").click()
|
180
|
-
|
181
|
-
with sync_playwright() as playwright:
|
182
|
-
run(playwright)
|
161
|
+
```ruby
|
162
|
+
browser_context.expose_binding("pageURL", ->(source) { source[:page].url })
|
163
|
+
page = browser_context.new_page
|
164
|
+
|
165
|
+
page.content = <<~HTML
|
166
|
+
<script>
|
167
|
+
async function onClick() {
|
168
|
+
document.querySelector('div').textContent = await window.pageURL();
|
169
|
+
}
|
170
|
+
</script>
|
171
|
+
<button onclick="onClick()">Click me</button>
|
172
|
+
<div></div>
|
173
|
+
HTML
|
183
174
|
|
175
|
+
page.get_by_role("button").click
|
184
176
|
```
|
185
177
|
|
186
178
|
An example of passing an element handle:
|
@@ -225,36 +217,25 @@ See [Page#expose_function](./page#expose_function) for page-only version.
|
|
225
217
|
|
226
218
|
An example of adding a `sha256` function to all pages in the context:
|
227
219
|
|
228
|
-
```
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
m.update(bytes(text, "utf8"))
|
235
|
-
return m.hexdigest()
|
236
|
-
|
237
|
-
|
238
|
-
def run(playwright: Playwright):
|
239
|
-
webkit = playwright.webkit
|
240
|
-
browser = webkit.launch(headless=False)
|
241
|
-
context = browser.new_context()
|
242
|
-
context.expose_function("sha256", sha256)
|
243
|
-
page = context.new_page()
|
244
|
-
page.set_content("""
|
245
|
-
<script>
|
246
|
-
async function onClick() {
|
247
|
-
document.querySelector('div').textContent = await window.sha256('PLAYWRIGHT');
|
248
|
-
}
|
249
|
-
</script>
|
250
|
-
<button onclick="onClick()">Click me</button>
|
251
|
-
<div></div>
|
252
|
-
""")
|
253
|
-
page.get_by_role("button").click()
|
254
|
-
|
255
|
-
with sync_playwright() as playwright:
|
256
|
-
run(playwright)
|
220
|
+
```ruby
|
221
|
+
require 'digest'
|
222
|
+
|
223
|
+
def sha256(text)
|
224
|
+
Digest::SHA256.hexdigest(text)
|
225
|
+
end
|
257
226
|
|
227
|
+
browser_context.expose_function("sha256", method(:sha256))
|
228
|
+
page = browser_context.new_page()
|
229
|
+
page.content = <<~HTML
|
230
|
+
<script>
|
231
|
+
async function onClick() {
|
232
|
+
document.querySelector('div').textContent = await window.sha256('PLAYWRIGHT');
|
233
|
+
}
|
234
|
+
</script>
|
235
|
+
<button onclick="onClick()">Click me</button>
|
236
|
+
<div></div>
|
237
|
+
HTML
|
238
|
+
page.get_by_role("button").click
|
258
239
|
```
|
259
240
|
|
260
241
|
## grant_permissions
|
@@ -8,20 +8,15 @@ sidebar_position: 10
|
|
8
8
|
BrowserType provides methods to launch a specific browser instance or connect to an existing one. The following is a
|
9
9
|
typical example of using Playwright to drive automation:
|
10
10
|
|
11
|
-
```
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
browser = chromium.launch()
|
17
|
-
page = browser.new_page()
|
18
|
-
page.goto("https://example.com")
|
19
|
-
# other actions...
|
20
|
-
browser.close()
|
11
|
+
```ruby
|
12
|
+
chromium = playwright.chromium
|
13
|
+
chromium.launch do |browser|
|
14
|
+
page = browser.new_page
|
15
|
+
page.goto('https://example.com/')
|
21
16
|
|
22
|
-
|
23
|
-
run(playwright)
|
17
|
+
# other actions
|
24
18
|
|
19
|
+
end
|
25
20
|
```
|
26
21
|
|
27
22
|
## connect_over_cdp
|
@@ -9,24 +9,21 @@ sidebar_position: 10
|
|
9
9
|
|
10
10
|
An example of using [Dialog](./dialog) class:
|
11
11
|
|
12
|
-
```
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
with sync_playwright() as playwright:
|
28
|
-
run(playwright)
|
29
|
-
|
12
|
+
```ruby
|
13
|
+
def handle_dialog(dialog)
|
14
|
+
puts "[#{dialog.type}] #{dialog.message}"
|
15
|
+
if dialog.message =~ /foo/
|
16
|
+
dialog.accept
|
17
|
+
else
|
18
|
+
dialog.dismiss
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
page.on("dialog", method(:handle_dialog))
|
23
|
+
page.evaluate("confirm('foo')") # will be accepted
|
24
|
+
# => [confirm] foo
|
25
|
+
page.evaluate("alert('bar')") # will be dismissed
|
26
|
+
# => [alert] bar
|
30
27
|
```
|
31
28
|
|
32
29
|
**NOTE**: Dialogs are dismissed automatically, unless there is a [`event: Page.dialog`] listener.
|
@@ -12,16 +12,16 @@ browser context is closed.
|
|
12
12
|
|
13
13
|
Download event is emitted once the download starts. Download path becomes available once download completes.
|
14
14
|
|
15
|
-
```
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
page.get_by_text("Download file").click()
|
20
|
-
download = download_info.value
|
15
|
+
```ruby
|
16
|
+
download = page.expect_download do
|
17
|
+
page.get_by_text("Download file").click
|
18
|
+
end
|
21
19
|
|
22
20
|
# Wait for the download process to complete and save the downloaded file somewhere
|
23
|
-
|
21
|
+
path = File.join(download_dir, download.suggested_filename)
|
22
|
+
download.save_as(path)
|
24
23
|
|
24
|
+
path
|
25
25
|
```
|
26
26
|
|
27
27
|
## cancel
|
@@ -86,9 +86,8 @@ is still in progress. Will wait for the download to finish if necessary.
|
|
86
86
|
|
87
87
|
**Usage**
|
88
88
|
|
89
|
-
```
|
90
|
-
download.save_as(
|
91
|
-
|
89
|
+
```ruby
|
90
|
+
download.save_as(File.join(download_dir, download.suggested_filename))
|
92
91
|
```
|
93
92
|
|
94
93
|
## suggested_filename
|
@@ -505,14 +505,13 @@ Triggers a `change` and `input` event once all the provided options have been se
|
|
505
505
|
|
506
506
|
**Usage**
|
507
507
|
|
508
|
-
```
|
509
|
-
#
|
510
|
-
|
508
|
+
```ruby
|
509
|
+
# single selection matching the value
|
510
|
+
element_handle.select_option(value: "blue")
|
511
511
|
# single selection matching both the label
|
512
|
-
|
512
|
+
element_handle.select_option(label: "blue")
|
513
513
|
# multiple selection
|
514
|
-
|
515
|
-
|
514
|
+
element_handle.select_option(value: ["red", "green", "blue"])
|
516
515
|
```
|
517
516
|
|
518
517
|
## select_text
|
@@ -15,25 +15,16 @@ At every point of time, page exposes its current frame tree via the [Page#main_f
|
|
15
15
|
|
16
16
|
An example of dumping frame tree:
|
17
17
|
|
18
|
-
```
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
page.goto("https://www.theverge.com")
|
26
|
-
dump_frame_tree(page.main_frame, "")
|
27
|
-
browser.close()
|
28
|
-
|
29
|
-
def dump_frame_tree(frame, indent):
|
30
|
-
print(indent + frame.name + '@' + frame.url)
|
31
|
-
for child in frame.child_frames:
|
32
|
-
dump_frame_tree(child, indent + " ")
|
33
|
-
|
34
|
-
with sync_playwright() as playwright:
|
35
|
-
run(playwright)
|
18
|
+
```ruby
|
19
|
+
def dump_frame_tree(frame, indent = 0)
|
20
|
+
puts "#{' ' * indent}#{frame.name}@#{frame.url}"
|
21
|
+
frame.child_frames.each do |child|
|
22
|
+
dump_frame_tree(child, indent + 2)
|
23
|
+
end
|
24
|
+
end
|
36
25
|
|
26
|
+
page.goto("https://www.theverge.com")
|
27
|
+
dump_frame_tree(page.main_frame)
|
37
28
|
```
|
38
29
|
|
39
30
|
## add_script_tag
|
@@ -920,14 +911,13 @@ Triggers a `change` and `input` event once all the provided options have been se
|
|
920
911
|
|
921
912
|
**Usage**
|
922
913
|
|
923
|
-
```
|
924
|
-
#
|
925
|
-
frame.select_option("select#colors", "blue")
|
914
|
+
```ruby
|
915
|
+
# single selection matching the value
|
916
|
+
frame.select_option("select#colors", value: "blue")
|
926
917
|
# single selection matching both the label
|
927
|
-
frame.select_option("select#colors", label
|
918
|
+
frame.select_option("select#colors", label: "blue")
|
928
919
|
# multiple selection
|
929
|
-
frame.select_option("select#colors", value
|
930
|
-
|
920
|
+
frame.select_option("select#colors", value: ["red", "green", "blue"])
|
931
921
|
```
|
932
922
|
|
933
923
|
## set_checked
|
@@ -1099,20 +1089,9 @@ Returns when the `expression` returns a truthy value, returns that value.
|
|
1099
1089
|
|
1100
1090
|
The [Frame#wait_for_function](./frame#wait_for_function) can be used to observe viewport size change:
|
1101
1091
|
|
1102
|
-
```
|
1103
|
-
|
1104
|
-
|
1105
|
-
def run(playwright: Playwright):
|
1106
|
-
webkit = playwright.webkit
|
1107
|
-
browser = webkit.launch()
|
1108
|
-
page = browser.new_page()
|
1109
|
-
page.evaluate("window.x = 0; setTimeout(() => { window.x = 100 }, 1000);")
|
1110
|
-
page.main_frame.wait_for_function("() => window.x > 0")
|
1111
|
-
browser.close()
|
1112
|
-
|
1113
|
-
with sync_playwright() as playwright:
|
1114
|
-
run(playwright)
|
1115
|
-
|
1092
|
+
```ruby
|
1093
|
+
frame.evaluate("window.x = 0; setTimeout(() => { window.x = 100 }, 1000);")
|
1094
|
+
frame.wait_for_function("() => window.x > 0")
|
1116
1095
|
```
|
1117
1096
|
|
1118
1097
|
To pass an argument to the predicate of `frame.waitForFunction` function:
|
@@ -1188,22 +1167,13 @@ function will throw.
|
|
1188
1167
|
|
1189
1168
|
This method works across navigations:
|
1190
1169
|
|
1191
|
-
```
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1196
|
-
|
1197
|
-
|
1198
|
-
for current_url in ["https://google.com", "https://bbc.com"]:
|
1199
|
-
page.goto(current_url, wait_until="domcontentloaded")
|
1200
|
-
element = page.main_frame.wait_for_selector("img")
|
1201
|
-
print("Loaded image: " + str(element.get_attribute("src")))
|
1202
|
-
browser.close()
|
1203
|
-
|
1204
|
-
with sync_playwright() as playwright:
|
1205
|
-
run(playwright)
|
1206
|
-
|
1170
|
+
```ruby
|
1171
|
+
%w[https://google.com https://bbc.com].each do |current_url|
|
1172
|
+
page.goto(current_url, waitUntil: "domcontentloaded")
|
1173
|
+
frame = page.main_frame
|
1174
|
+
element = frame.wait_for_selector("img")
|
1175
|
+
puts "Loaded image: #{element["src"]}"
|
1176
|
+
end
|
1207
1177
|
```
|
1208
1178
|
|
1209
1179
|
## wait_for_timeout
|
@@ -42,7 +42,7 @@ def all_inner_texts
|
|
42
42
|
|
43
43
|
Returns an array of `node.innerText` values for all matching nodes.
|
44
44
|
|
45
|
-
**NOTE**: If you need to assert text on the page, prefer [
|
45
|
+
**NOTE**: If you need to assert text on the page, prefer [LocatorAssertions#to_have_text](./locator_assertions#to_have_text) with `useInnerText` option to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
|
46
46
|
|
47
47
|
**Usage**
|
48
48
|
|
@@ -59,7 +59,7 @@ def all_text_contents
|
|
59
59
|
|
60
60
|
Returns an array of `node.textContent` values for all matching nodes.
|
61
61
|
|
62
|
-
**NOTE**: If you need to assert text on the page, prefer [
|
62
|
+
**NOTE**: If you need to assert text on the page, prefer [LocatorAssertions#to_have_text](./locator_assertions#to_have_text) to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
|
63
63
|
|
64
64
|
**Usage**
|
65
65
|
|
@@ -236,7 +236,7 @@ def count
|
|
236
236
|
|
237
237
|
Returns the number of elements matching the locator.
|
238
238
|
|
239
|
-
**NOTE**: If you need to assert the number of elements on the page, prefer [
|
239
|
+
**NOTE**: If you need to assert the number of elements on the page, prefer [LocatorAssertions#to_have_count](./locator_assertions#to_have_count) to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
|
240
240
|
|
241
241
|
**Usage**
|
242
242
|
|
@@ -532,7 +532,7 @@ alias: `[]`
|
|
532
532
|
|
533
533
|
Returns the matching element's attribute value.
|
534
534
|
|
535
|
-
**NOTE**: If you need to assert an element's attribute, prefer [
|
535
|
+
**NOTE**: If you need to assert an element's attribute, prefer [LocatorAssertions#to_have_attribute](./locator_assertions#to_have_attribute) to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
|
536
536
|
|
537
537
|
## get_by_alt_text
|
538
538
|
|
@@ -816,7 +816,7 @@ def inner_text(timeout: nil)
|
|
816
816
|
|
817
817
|
Returns the [`element.innerText`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/innerText).
|
818
818
|
|
819
|
-
**NOTE**: If you need to assert text on the page, prefer [
|
819
|
+
**NOTE**: If you need to assert text on the page, prefer [LocatorAssertions#to_have_text](./locator_assertions#to_have_text) with `useInnerText` option to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
|
820
820
|
|
821
821
|
## input_value
|
822
822
|
|
@@ -827,7 +827,7 @@ def input_value(timeout: nil)
|
|
827
827
|
|
828
828
|
Returns the value for the matching `<input>` or `<textarea>` or `<select>` element.
|
829
829
|
|
830
|
-
**NOTE**: If you need to assert input value, prefer [
|
830
|
+
**NOTE**: If you need to assert input value, prefer [LocatorAssertions#to_have_value](./locator_assertions#to_have_value) to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
|
831
831
|
|
832
832
|
**Usage**
|
833
833
|
|
@@ -848,7 +848,7 @@ def checked?(timeout: nil)
|
|
848
848
|
|
849
849
|
Returns whether the element is checked. Throws if the element is not a checkbox or radio input.
|
850
850
|
|
851
|
-
**NOTE**: If you need to assert that checkbox is checked, prefer [
|
851
|
+
**NOTE**: If you need to assert that checkbox is checked, prefer [LocatorAssertions#to_be_checked](./locator_assertions#to_be_checked) to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
|
852
852
|
|
853
853
|
**Usage**
|
854
854
|
|
@@ -865,7 +865,7 @@ def disabled?(timeout: nil)
|
|
865
865
|
|
866
866
|
Returns whether the element is disabled, the opposite of [enabled](https://playwright.dev/python/docs/actionability#enabled).
|
867
867
|
|
868
|
-
**NOTE**: If you need to assert that an element is disabled, prefer [
|
868
|
+
**NOTE**: If you need to assert that an element is disabled, prefer [LocatorAssertions#to_be_disabled](./locator_assertions#to_be_disabled) to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
|
869
869
|
|
870
870
|
**Usage**
|
871
871
|
|
@@ -882,7 +882,7 @@ def editable?(timeout: nil)
|
|
882
882
|
|
883
883
|
Returns whether the element is [editable](https://playwright.dev/python/docs/actionability#editable).
|
884
884
|
|
885
|
-
**NOTE**: If you need to assert that an element is editable, prefer [
|
885
|
+
**NOTE**: If you need to assert that an element is editable, prefer [LocatorAssertions#to_be_editable](./locator_assertions#to_be_editable) to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
|
886
886
|
|
887
887
|
**Usage**
|
888
888
|
|
@@ -899,7 +899,7 @@ def enabled?(timeout: nil)
|
|
899
899
|
|
900
900
|
Returns whether the element is [enabled](https://playwright.dev/python/docs/actionability#enabled).
|
901
901
|
|
902
|
-
**NOTE**: If you need to assert that an element is enabled, prefer [
|
902
|
+
**NOTE**: If you need to assert that an element is enabled, prefer [LocatorAssertions#to_be_enabled](./locator_assertions#to_be_enabled) to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
|
903
903
|
|
904
904
|
**Usage**
|
905
905
|
|
@@ -916,7 +916,7 @@ def hidden?(timeout: nil)
|
|
916
916
|
|
917
917
|
Returns whether the element is hidden, the opposite of [visible](https://playwright.dev/python/docs/actionability#visible).
|
918
918
|
|
919
|
-
**NOTE**: If you need to assert that element is hidden, prefer [
|
919
|
+
**NOTE**: If you need to assert that element is hidden, prefer [LocatorAssertions#to_be_hidden](./locator_assertions#to_be_hidden) to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
|
920
920
|
|
921
921
|
**Usage**
|
922
922
|
|
@@ -933,7 +933,7 @@ def visible?(timeout: nil)
|
|
933
933
|
|
934
934
|
Returns whether the element is [visible](https://playwright.dev/python/docs/actionability#visible).
|
935
935
|
|
936
|
-
**NOTE**: If you need to assert that element is visible, prefer [
|
936
|
+
**NOTE**: If you need to assert that element is visible, prefer [LocatorAssertions#to_be_visible](./locator_assertions#to_be_visible) to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
|
937
937
|
|
938
938
|
**Usage**
|
939
939
|
|
@@ -1071,19 +1071,17 @@ To press a special key, like `Control` or `ArrowDown`, use [Locator#press](./loc
|
|
1071
1071
|
|
1072
1072
|
**Usage**
|
1073
1073
|
|
1074
|
-
```
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1074
|
+
```ruby
|
1075
|
+
element.press_sequentially("hello") # types instantly
|
1076
|
+
element.press_sequentially("world", delay: 100) # types slower, like a user
|
1078
1077
|
```
|
1079
1078
|
|
1080
1079
|
An example of typing into a text field and then submitting the form:
|
1081
1080
|
|
1082
|
-
```
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1081
|
+
```ruby
|
1082
|
+
element = page.get_by_label("Password")
|
1083
|
+
element.press_sequentially("my password")
|
1084
|
+
element.press("Enter")
|
1087
1085
|
```
|
1088
1086
|
|
1089
1087
|
## screenshot
|
@@ -1301,7 +1299,7 @@ def text_content(timeout: nil)
|
|
1301
1299
|
|
1302
1300
|
Returns the [`node.textContent`](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent).
|
1303
1301
|
|
1304
|
-
**NOTE**: If you need to assert text on the page, prefer [
|
1302
|
+
**NOTE**: If you need to assert text on the page, prefer [LocatorAssertions#to_have_text](./locator_assertions#to_have_text) to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
|
1305
1303
|
|
1306
1304
|
## type
|
1307
1305
|
|