playwright-ruby-client 0.8.0 → 1.14.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/documentation/docs/api/accessibility.md +52 -1
- data/documentation/docs/api/browser.md +8 -2
- data/documentation/docs/api/browser_context.md +28 -0
- data/documentation/docs/api/browser_type.md +1 -0
- data/documentation/docs/api/download.md +97 -0
- data/documentation/docs/api/element_handle.md +28 -3
- data/documentation/docs/api/experimental/android_device.md +1 -0
- data/documentation/docs/api/frame.md +78 -18
- data/documentation/docs/api/keyboard.md +11 -20
- data/documentation/docs/api/locator.md +650 -0
- data/documentation/docs/api/page.md +124 -20
- data/documentation/docs/api/touchscreen.md +8 -0
- data/documentation/docs/api/worker.md +37 -0
- data/documentation/docs/article/guides/inspector.md +31 -0
- data/documentation/docs/article/guides/playwright_on_alpine_linux.md +91 -0
- data/documentation/docs/article/guides/semi_automation.md +5 -1
- data/documentation/docs/include/api_coverage.md +72 -15
- data/lib/playwright.rb +0 -1
- data/lib/playwright/accessibility_impl.rb +50 -0
- data/lib/playwright/channel_owners/artifact.rb +4 -0
- data/lib/playwright/channel_owners/browser_context.rb +77 -3
- data/lib/playwright/channel_owners/frame.rb +101 -35
- data/lib/playwright/channel_owners/page.rb +157 -56
- data/lib/playwright/channel_owners/worker.rb +23 -0
- data/lib/playwright/{download.rb → download_impl.rb} +5 -1
- data/lib/playwright/javascript/expression.rb +5 -4
- data/lib/playwright/locator_impl.rb +314 -0
- data/lib/playwright/route_handler_entry.rb +3 -2
- data/lib/playwright/timeout_settings.rb +4 -4
- data/lib/playwright/touchscreen_impl.rb +7 -0
- data/lib/playwright/tracing_impl.rb +9 -8
- data/lib/playwright/url_matcher.rb +12 -2
- data/lib/playwright/version.rb +2 -2
- data/lib/playwright_api/accessibility.rb +1 -1
- data/lib/playwright_api/android.rb +6 -6
- data/lib/playwright_api/android_device.rb +8 -7
- data/lib/playwright_api/browser.rb +16 -10
- data/lib/playwright_api/browser_context.rb +16 -11
- data/lib/playwright_api/browser_type.rb +8 -7
- data/lib/playwright_api/cdp_session.rb +6 -6
- data/lib/playwright_api/console_message.rb +6 -6
- data/lib/playwright_api/dialog.rb +6 -6
- data/lib/playwright_api/download.rb +70 -0
- data/lib/playwright_api/element_handle.rb +34 -20
- data/lib/playwright_api/frame.rb +94 -52
- data/lib/playwright_api/js_handle.rb +6 -6
- data/lib/playwright_api/locator.rb +509 -0
- data/lib/playwright_api/page.rb +101 -57
- data/lib/playwright_api/playwright.rb +6 -6
- data/lib/playwright_api/request.rb +6 -6
- data/lib/playwright_api/response.rb +6 -6
- data/lib/playwright_api/route.rb +6 -11
- data/lib/playwright_api/selectors.rb +6 -6
- data/lib/playwright_api/touchscreen.rb +1 -1
- data/lib/playwright_api/web_socket.rb +6 -6
- data/lib/playwright_api/worker.rb +16 -6
- metadata +14 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e8cf4acb773b928d276eac118c170bb0eb2f0c8235f7c19bf0ebf2a4883a3e7
|
4
|
+
data.tar.gz: 7a70fbaad653abe274b8fac05b953ec413ca213bfc9d0e6396c3bf2c6c0f5b2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 981c3cab4a5060634f858b934b01ef51e0f1e887d2bf5e4bbb62dca636d1ab3b9459542e436965c49cf0240f8431732a5fa50f9b7dc6d324c7c21fc36b8b01b8
|
7
|
+
data.tar.gz: '08e490a08488fac3f0633ade8fc4f2299dc6e69fcc6cd86c5587197a9a7bfdca78e836de8fff6b0a578c64387b59c0cba2f245a93280ba7e7b0e6488875ae819'
|
@@ -4,4 +4,55 @@ sidebar_position: 10
|
|
4
4
|
|
5
5
|
# Accessibility
|
6
6
|
|
7
|
-
|
7
|
+
The Accessibility class provides methods for inspecting Chromium's accessibility tree. The accessibility tree is used by
|
8
|
+
assistive technology such as [screen readers](https://en.wikipedia.org/wiki/Screen_reader) or
|
9
|
+
[switches](https://en.wikipedia.org/wiki/Switch_access).
|
10
|
+
|
11
|
+
Accessibility is a very platform-specific thing. On different platforms, there are different screen readers that might
|
12
|
+
have wildly different output.
|
13
|
+
|
14
|
+
Rendering engines of Chromium, Firefox and WebKit have a concept of "accessibility tree", which is then translated into
|
15
|
+
different platform-specific APIs. Accessibility namespace gives access to this Accessibility Tree.
|
16
|
+
|
17
|
+
Most of the accessibility tree gets filtered out when converting from internal browser AX Tree to Platform-specific
|
18
|
+
AX-Tree or by assistive technologies themselves. By default, Playwright tries to approximate this filtering, exposing
|
19
|
+
only the "interesting" nodes of the tree.
|
20
|
+
|
21
|
+
## snapshot
|
22
|
+
|
23
|
+
```
|
24
|
+
def snapshot(interestingOnly: nil, root: nil)
|
25
|
+
```
|
26
|
+
|
27
|
+
Captures the current state of the accessibility tree. The returned object represents the root accessible node of the
|
28
|
+
page.
|
29
|
+
|
30
|
+
> NOTE: The Chromium accessibility tree contains nodes that go unused on most platforms and by most screen readers.
|
31
|
+
Playwright will discard them as well for an easier to process tree, unless `interestingOnly` is set to `false`.
|
32
|
+
|
33
|
+
An example of dumping the entire accessibility tree:
|
34
|
+
|
35
|
+
```python sync title=example_2e5019929403491cde0c78bed1e0e18e0c86ab423d7ac8715876c4de4814f483.py
|
36
|
+
snapshot = page.accessibility.snapshot()
|
37
|
+
print(snapshot)
|
38
|
+
|
39
|
+
```
|
40
|
+
|
41
|
+
An example of logging the focused node's name:
|
42
|
+
|
43
|
+
```python sync title=example_df2acadf9e261a7624d83399f0d8b0910293a6a7081c812474715f22f8af7a4a.py
|
44
|
+
def find_focused_node(node):
|
45
|
+
if (node.get("focused"))
|
46
|
+
return node
|
47
|
+
for child in (node.get("children") or []):
|
48
|
+
found_node = find_focused_node(child)
|
49
|
+
return found_node
|
50
|
+
return None
|
51
|
+
|
52
|
+
snapshot = page.accessibility.snapshot()
|
53
|
+
node = find_focused_node(snapshot)
|
54
|
+
if node:
|
55
|
+
print(node["name"])
|
56
|
+
|
57
|
+
```
|
58
|
+
|
@@ -76,6 +76,7 @@ Returns the newly created browser session.
|
|
76
76
|
```
|
77
77
|
def new_context(
|
78
78
|
acceptDownloads: nil,
|
79
|
+
baseURL: nil,
|
79
80
|
bypassCSP: nil,
|
80
81
|
colorScheme: nil,
|
81
82
|
deviceScaleFactor: nil,
|
@@ -124,6 +125,7 @@ end
|
|
124
125
|
```
|
125
126
|
def new_page(
|
126
127
|
acceptDownloads: nil,
|
128
|
+
baseURL: nil,
|
127
129
|
bypassCSP: nil,
|
128
130
|
colorScheme: nil,
|
129
131
|
deviceScaleFactor: nil,
|
@@ -164,7 +166,9 @@ testing frameworks should explicitly create [Browser#new_context](./browser#new_
|
|
164
166
|
def start_tracing(page: nil, categories: nil, path: nil, screenshots: nil)
|
165
167
|
```
|
166
168
|
|
167
|
-
> NOTE:
|
169
|
+
> NOTE: This API controls [Chromium Tracing](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool)
|
170
|
+
which is a low-level chromium-specific debugging tool. API to control [Playwright Tracing](https://playwright.dev/python/docs/trace-viewer) could be
|
171
|
+
found [here](./tracing).
|
168
172
|
|
169
173
|
You can use [Browser#start_tracing](./browser#start_tracing) and [Browser#stop_tracing](./browser#stop_tracing) to create a trace file that can be
|
170
174
|
opened in Chrome DevTools performance panel.
|
@@ -185,7 +189,9 @@ end
|
|
185
189
|
def stop_tracing
|
186
190
|
```
|
187
191
|
|
188
|
-
> NOTE:
|
192
|
+
> NOTE: This API controls [Chromium Tracing](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool)
|
193
|
+
which is a low-level chromium-specific debugging tool. API to control [Playwright Tracing](https://playwright.dev/python/docs/trace-viewer) could be
|
194
|
+
found [here](./tracing).
|
189
195
|
|
190
196
|
Returns the buffer with trace data.
|
191
197
|
|
@@ -67,6 +67,16 @@ browser_context.add_init_script(path: "preload.js")
|
|
67
67
|
> NOTE: The order of evaluation of multiple scripts installed via [BrowserContext#add_init_script](./browser_context#add_init_script) and
|
68
68
|
[Page#add_init_script](./page#add_init_script) is not defined.
|
69
69
|
|
70
|
+
## background_pages
|
71
|
+
|
72
|
+
```
|
73
|
+
def background_pages
|
74
|
+
```
|
75
|
+
|
76
|
+
> NOTE: Background pages are only supported on Chromium-based browsers.
|
77
|
+
|
78
|
+
All existing background pages in the context.
|
79
|
+
|
70
80
|
## browser
|
71
81
|
|
72
82
|
```
|
@@ -301,6 +311,16 @@ To remove a route with its handler you can use [BrowserContext#unroute](./browse
|
|
301
311
|
|
302
312
|
> NOTE: Enabling routing disables http cache.
|
303
313
|
|
314
|
+
## service_workers
|
315
|
+
|
316
|
+
```
|
317
|
+
def service_workers
|
318
|
+
```
|
319
|
+
|
320
|
+
> NOTE: Service workers are only supported on Chromium-based browsers.
|
321
|
+
|
322
|
+
All existing service workers in the context.
|
323
|
+
|
304
324
|
## set_default_navigation_timeout
|
305
325
|
|
306
326
|
```
|
@@ -369,6 +389,14 @@ alias: `offline=`
|
|
369
389
|
|
370
390
|
|
371
391
|
|
392
|
+
## storage_state
|
393
|
+
|
394
|
+
```
|
395
|
+
def storage_state(path: nil)
|
396
|
+
```
|
397
|
+
|
398
|
+
Returns storage state for this browser context, contains current cookies and local storage snapshot.
|
399
|
+
|
372
400
|
## unroute
|
373
401
|
|
374
402
|
```
|
@@ -0,0 +1,97 @@
|
|
1
|
+
---
|
2
|
+
sidebar_position: 10
|
3
|
+
---
|
4
|
+
|
5
|
+
# Download
|
6
|
+
|
7
|
+
[Download](./download) objects are dispatched by page via the [`event: Page.download`] event.
|
8
|
+
|
9
|
+
All the downloaded files belonging to the browser context are deleted when the browser context is closed.
|
10
|
+
|
11
|
+
Download event is emitted once the download starts. Download path becomes available once download completes:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
download = page.expect_download do
|
15
|
+
page.click('a')
|
16
|
+
end
|
17
|
+
|
18
|
+
# wait for download to complete
|
19
|
+
path = download.path
|
20
|
+
```
|
21
|
+
|
22
|
+
> NOTE: Browser context **must** be created with the `acceptDownloads` set to `true` when user needs access to the
|
23
|
+
downloaded content. If `acceptDownloads` is not set, download events are emitted, but the actual download is not
|
24
|
+
performed and user has no access to the downloaded files.
|
25
|
+
|
26
|
+
## cancel
|
27
|
+
|
28
|
+
```
|
29
|
+
def cancel
|
30
|
+
```
|
31
|
+
|
32
|
+
Cancels a download. Will not fail if the download is already finished or canceled. Upon successful cancellations,
|
33
|
+
`download.failure()` would resolve to `'canceled'`.
|
34
|
+
|
35
|
+
## delete
|
36
|
+
|
37
|
+
```
|
38
|
+
def delete
|
39
|
+
```
|
40
|
+
|
41
|
+
Deletes the downloaded file. Will wait for the download to finish if necessary.
|
42
|
+
|
43
|
+
## failure
|
44
|
+
|
45
|
+
```
|
46
|
+
def failure
|
47
|
+
```
|
48
|
+
|
49
|
+
Returns download error if any. Will wait for the download to finish if necessary.
|
50
|
+
|
51
|
+
## page
|
52
|
+
|
53
|
+
```
|
54
|
+
def page
|
55
|
+
```
|
56
|
+
|
57
|
+
Get the page that the download belongs to.
|
58
|
+
|
59
|
+
## path
|
60
|
+
|
61
|
+
```
|
62
|
+
def path
|
63
|
+
```
|
64
|
+
|
65
|
+
Returns path to the downloaded file in case of successful download. The method will wait for the download to finish if
|
66
|
+
necessary. The method throws when connected remotely.
|
67
|
+
|
68
|
+
Note that the download's file name is a random GUID, use [Download#suggested_filename](./download#suggested_filename) to get suggested file
|
69
|
+
name.
|
70
|
+
|
71
|
+
## save_as
|
72
|
+
|
73
|
+
```
|
74
|
+
def save_as(path)
|
75
|
+
```
|
76
|
+
|
77
|
+
Copy the download to a user-specified path. It is safe to call this method while the download is still in progress. Will
|
78
|
+
wait for the download to finish if necessary.
|
79
|
+
|
80
|
+
## suggested_filename
|
81
|
+
|
82
|
+
```
|
83
|
+
def suggested_filename
|
84
|
+
```
|
85
|
+
|
86
|
+
Returns suggested filename for this download. It is typically computed by the browser from the
|
87
|
+
[`Content-Disposition`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition) response header
|
88
|
+
or the `download` attribute. See the spec on [whatwg](https://html.spec.whatwg.org/#downloading-resources). Different
|
89
|
+
browsers can use different logic for computing it.
|
90
|
+
|
91
|
+
## url
|
92
|
+
|
93
|
+
```
|
94
|
+
def url
|
95
|
+
```
|
96
|
+
|
97
|
+
Returns downloaded url.
|
@@ -10,10 +10,8 @@ ElementHandle represents an in-page DOM element. ElementHandles can be created w
|
|
10
10
|
method.
|
11
11
|
|
12
12
|
```ruby
|
13
|
-
page.goto("https://example.com")
|
14
13
|
href_element = page.query_selector("a")
|
15
14
|
href_element.click
|
16
|
-
# ...
|
17
15
|
```
|
18
16
|
|
19
17
|
ElementHandle prevents DOM element from garbage collection unless the handle is disposed with
|
@@ -22,6 +20,33 @@ ElementHandle prevents DOM element from garbage collection unless the handle is
|
|
22
20
|
ElementHandle instances can be used as an argument in [Page#eval_on_selector](./page#eval_on_selector) and [Page#evaluate](./page#evaluate)
|
23
21
|
methods.
|
24
22
|
|
23
|
+
> NOTE: In most cases, you would want to use the [Locator](./locator) object instead. You should only use [ElementHandle](./element_handle) if you
|
24
|
+
want to retain a handle to a particular DOM Node that you intend to pass into [Page#evaluate](./page#evaluate) as an argument.
|
25
|
+
|
26
|
+
The difference between the [Locator](./locator) and ElementHandle is that the ElementHandle points to a particular element, while
|
27
|
+
[Locator](./locator) captures the logic of how to retrieve an element.
|
28
|
+
|
29
|
+
In the example below, handle points to a particular DOM element on page. If that element changes text or is used by
|
30
|
+
React to render an entirely different component, handle is still pointing to that very DOM element. This can lead to
|
31
|
+
unexpected behaviors.
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
handle = page.query_selector("text=Submit")
|
35
|
+
handle.hover
|
36
|
+
handle.click
|
37
|
+
```
|
38
|
+
|
39
|
+
With the locator, every time the `element` is used, up-to-date DOM element is located in the page using the selector. So
|
40
|
+
in the snippet below, underlying DOM element is going to be located twice.
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
locator = page.locator("text=Submit")
|
44
|
+
locator.hover
|
45
|
+
locator.click
|
46
|
+
```
|
47
|
+
|
48
|
+
|
49
|
+
|
25
50
|
## bounding_box
|
26
51
|
|
27
52
|
```
|
@@ -306,7 +331,7 @@ Returns the `element.innerText`.
|
|
306
331
|
def input_value(timeout: nil)
|
307
332
|
```
|
308
333
|
|
309
|
-
Returns `input.value` for `<input>` or `<textarea>` element. Throws for non-input elements.
|
334
|
+
Returns `input.value` for `<input>` or `<textarea>` or `<select>` element. Throws for non-input elements.
|
310
335
|
|
311
336
|
## checked?
|
312
337
|
|
@@ -68,6 +68,7 @@ def check(
|
|
68
68
|
force: nil,
|
69
69
|
noWaitAfter: nil,
|
70
70
|
position: nil,
|
71
|
+
strict: nil,
|
71
72
|
timeout: nil,
|
72
73
|
trial: nil)
|
73
74
|
```
|
@@ -106,6 +107,7 @@ def click(
|
|
106
107
|
modifiers: nil,
|
107
108
|
noWaitAfter: nil,
|
108
109
|
position: nil,
|
110
|
+
strict: nil,
|
109
111
|
timeout: nil,
|
110
112
|
trial: nil)
|
111
113
|
```
|
@@ -140,6 +142,7 @@ def dblclick(
|
|
140
142
|
modifiers: nil,
|
141
143
|
noWaitAfter: nil,
|
142
144
|
position: nil,
|
145
|
+
strict: nil,
|
143
146
|
timeout: nil,
|
144
147
|
trial: nil)
|
145
148
|
```
|
@@ -161,7 +164,12 @@ zero timeout disables this.
|
|
161
164
|
## dispatch_event
|
162
165
|
|
163
166
|
```
|
164
|
-
def dispatch_event(
|
167
|
+
def dispatch_event(
|
168
|
+
selector,
|
169
|
+
type,
|
170
|
+
eventInit: nil,
|
171
|
+
strict: nil,
|
172
|
+
timeout: nil)
|
165
173
|
```
|
166
174
|
|
167
175
|
The snippet below dispatches the `click` event on the element. Regardless of the visibility state of the element,
|
@@ -196,10 +204,27 @@ frame.dispatch_event("#source", "dragstart", { "dataTransfer": data_transfer })
|
|
196
204
|
|
197
205
|
|
198
206
|
|
207
|
+
## drag_and_drop
|
208
|
+
|
209
|
+
```
|
210
|
+
def drag_and_drop(
|
211
|
+
source,
|
212
|
+
target,
|
213
|
+
force: nil,
|
214
|
+
noWaitAfter: nil,
|
215
|
+
sourcePosition: nil,
|
216
|
+
strict: nil,
|
217
|
+
targetPosition: nil,
|
218
|
+
timeout: nil,
|
219
|
+
trial: nil)
|
220
|
+
```
|
221
|
+
|
222
|
+
|
223
|
+
|
199
224
|
## eval_on_selector
|
200
225
|
|
201
226
|
```
|
202
|
-
def eval_on_selector(selector, expression, arg: nil)
|
227
|
+
def eval_on_selector(selector, expression, arg: nil, strict: nil)
|
203
228
|
```
|
204
229
|
|
205
230
|
Returns the return value of `expression`.
|
@@ -331,6 +356,7 @@ def fill(
|
|
331
356
|
value,
|
332
357
|
force: nil,
|
333
358
|
noWaitAfter: nil,
|
359
|
+
strict: nil,
|
334
360
|
timeout: nil)
|
335
361
|
```
|
336
362
|
|
@@ -348,7 +374,7 @@ To send fine-grained keyboard events, use [Frame#type](./frame#type).
|
|
348
374
|
## focus
|
349
375
|
|
350
376
|
```
|
351
|
-
def focus(selector, timeout: nil)
|
377
|
+
def focus(selector, strict: nil, timeout: nil)
|
352
378
|
```
|
353
379
|
|
354
380
|
This method fetches an element with `selector` and focuses it. If there's no element matching `selector`, the method
|
@@ -379,7 +405,7 @@ assert frame == content_frame
|
|
379
405
|
## get_attribute
|
380
406
|
|
381
407
|
```
|
382
|
-
def get_attribute(selector, name, timeout: nil)
|
408
|
+
def get_attribute(selector, name, strict: nil, timeout: nil)
|
383
409
|
```
|
384
410
|
|
385
411
|
Returns element attribute value.
|
@@ -417,6 +443,7 @@ def hover(
|
|
417
443
|
force: nil,
|
418
444
|
modifiers: nil,
|
419
445
|
position: nil,
|
446
|
+
strict: nil,
|
420
447
|
timeout: nil,
|
421
448
|
trial: nil)
|
422
449
|
```
|
@@ -435,7 +462,7 @@ zero timeout disables this.
|
|
435
462
|
## inner_html
|
436
463
|
|
437
464
|
```
|
438
|
-
def inner_html(selector, timeout: nil)
|
465
|
+
def inner_html(selector, strict: nil, timeout: nil)
|
439
466
|
```
|
440
467
|
|
441
468
|
Returns `element.innerHTML`.
|
@@ -443,7 +470,7 @@ Returns `element.innerHTML`.
|
|
443
470
|
## inner_text
|
444
471
|
|
445
472
|
```
|
446
|
-
def inner_text(selector, timeout: nil)
|
473
|
+
def inner_text(selector, strict: nil, timeout: nil)
|
447
474
|
```
|
448
475
|
|
449
476
|
Returns `element.innerText`.
|
@@ -451,15 +478,15 @@ Returns `element.innerText`.
|
|
451
478
|
## input_value
|
452
479
|
|
453
480
|
```
|
454
|
-
def input_value(selector, timeout: nil)
|
481
|
+
def input_value(selector, strict: nil, timeout: nil)
|
455
482
|
```
|
456
483
|
|
457
|
-
Returns `input.value` for the selected `<input>` or `<textarea>` element. Throws for non-input elements.
|
484
|
+
Returns `input.value` for the selected `<input>` or `<textarea>` or `<select>` element. Throws for non-input elements.
|
458
485
|
|
459
486
|
## checked?
|
460
487
|
|
461
488
|
```
|
462
|
-
def checked?(selector, timeout: nil)
|
489
|
+
def checked?(selector, strict: nil, timeout: nil)
|
463
490
|
```
|
464
491
|
|
465
492
|
Returns whether the element is checked. Throws if the element is not a checkbox or radio input.
|
@@ -475,7 +502,7 @@ Returns `true` if the frame has been detached, or `false` otherwise.
|
|
475
502
|
## disabled?
|
476
503
|
|
477
504
|
```
|
478
|
-
def disabled?(selector, timeout: nil)
|
505
|
+
def disabled?(selector, strict: nil, timeout: nil)
|
479
506
|
```
|
480
507
|
|
481
508
|
Returns whether the element is disabled, the opposite of [enabled](https://playwright.dev/python/docs/actionability).
|
@@ -483,7 +510,7 @@ Returns whether the element is disabled, the opposite of [enabled](https://playw
|
|
483
510
|
## editable?
|
484
511
|
|
485
512
|
```
|
486
|
-
def editable?(selector, timeout: nil)
|
513
|
+
def editable?(selector, strict: nil, timeout: nil)
|
487
514
|
```
|
488
515
|
|
489
516
|
Returns whether the element is [editable](https://playwright.dev/python/docs/actionability).
|
@@ -491,7 +518,7 @@ Returns whether the element is [editable](https://playwright.dev/python/docs/act
|
|
491
518
|
## enabled?
|
492
519
|
|
493
520
|
```
|
494
|
-
def enabled?(selector, timeout: nil)
|
521
|
+
def enabled?(selector, strict: nil, timeout: nil)
|
495
522
|
```
|
496
523
|
|
497
524
|
Returns whether the element is [enabled](https://playwright.dev/python/docs/actionability).
|
@@ -499,7 +526,7 @@ Returns whether the element is [enabled](https://playwright.dev/python/docs/acti
|
|
499
526
|
## hidden?
|
500
527
|
|
501
528
|
```
|
502
|
-
def hidden?(selector, timeout: nil)
|
529
|
+
def hidden?(selector, strict: nil, timeout: nil)
|
503
530
|
```
|
504
531
|
|
505
532
|
Returns whether the element is hidden, the opposite of [visible](https://playwright.dev/python/docs/actionability). `selector` that does not
|
@@ -508,12 +535,24 @@ match any elements is considered hidden.
|
|
508
535
|
## visible?
|
509
536
|
|
510
537
|
```
|
511
|
-
def visible?(selector, timeout: nil)
|
538
|
+
def visible?(selector, strict: nil, timeout: nil)
|
512
539
|
```
|
513
540
|
|
514
541
|
Returns whether the element is [visible](https://playwright.dev/python/docs/actionability). `selector` that does not match any elements is
|
515
542
|
considered not visible.
|
516
543
|
|
544
|
+
## locator
|
545
|
+
|
546
|
+
```
|
547
|
+
def locator(selector)
|
548
|
+
```
|
549
|
+
|
550
|
+
The method returns an element locator that can be used to perform actions in the frame. Locator is resolved to the
|
551
|
+
element immediately before performing an action, so a series of actions on the same locator can in fact be performed on
|
552
|
+
different DOM elements. That would happen if the DOM structure between those actions has changed.
|
553
|
+
|
554
|
+
Note that locator always implies visibility, so it will always be locating visible elements.
|
555
|
+
|
517
556
|
## name
|
518
557
|
|
519
558
|
```
|
@@ -550,6 +589,7 @@ def press(
|
|
550
589
|
key,
|
551
590
|
delay: nil,
|
552
591
|
noWaitAfter: nil,
|
592
|
+
strict: nil,
|
553
593
|
timeout: nil)
|
554
594
|
```
|
555
595
|
|
@@ -573,7 +613,7 @@ modifier, modifier is pressed and being held while the subsequent key is being p
|
|
573
613
|
## query_selector
|
574
614
|
|
575
615
|
```
|
576
|
-
def query_selector(selector)
|
616
|
+
def query_selector(selector, strict: nil)
|
577
617
|
```
|
578
618
|
|
579
619
|
Returns the ElementHandle pointing to the frame element.
|
@@ -603,6 +643,7 @@ def select_option(
|
|
603
643
|
label: nil,
|
604
644
|
force: nil,
|
605
645
|
noWaitAfter: nil,
|
646
|
+
strict: nil,
|
606
647
|
timeout: nil)
|
607
648
|
```
|
608
649
|
|
@@ -641,7 +682,12 @@ alias: `content=`
|
|
641
682
|
## set_input_files
|
642
683
|
|
643
684
|
```
|
644
|
-
def set_input_files(
|
685
|
+
def set_input_files(
|
686
|
+
selector,
|
687
|
+
files,
|
688
|
+
noWaitAfter: nil,
|
689
|
+
strict: nil,
|
690
|
+
timeout: nil)
|
645
691
|
```
|
646
692
|
|
647
693
|
This method expects `selector` to point to an
|
@@ -659,6 +705,7 @@ def tap_point(
|
|
659
705
|
modifiers: nil,
|
660
706
|
noWaitAfter: nil,
|
661
707
|
position: nil,
|
708
|
+
strict: nil,
|
662
709
|
timeout: nil,
|
663
710
|
trial: nil)
|
664
711
|
```
|
@@ -679,7 +726,7 @@ zero timeout disables this.
|
|
679
726
|
## text_content
|
680
727
|
|
681
728
|
```
|
682
|
-
def text_content(selector, timeout: nil)
|
729
|
+
def text_content(selector, strict: nil, timeout: nil)
|
683
730
|
```
|
684
731
|
|
685
732
|
Returns `element.textContent`.
|
@@ -700,6 +747,7 @@ def type(
|
|
700
747
|
text,
|
701
748
|
delay: nil,
|
702
749
|
noWaitAfter: nil,
|
750
|
+
strict: nil,
|
703
751
|
timeout: nil)
|
704
752
|
```
|
705
753
|
|
@@ -724,6 +772,7 @@ def uncheck(
|
|
724
772
|
force: nil,
|
725
773
|
noWaitAfter: nil,
|
726
774
|
position: nil,
|
775
|
+
strict: nil,
|
727
776
|
timeout: nil,
|
728
777
|
trial: nil)
|
729
778
|
```
|
@@ -831,7 +880,7 @@ considered a navigation.
|
|
831
880
|
## wait_for_selector
|
832
881
|
|
833
882
|
```
|
834
|
-
def wait_for_selector(selector, state: nil, timeout: nil)
|
883
|
+
def wait_for_selector(selector, state: nil, strict: nil, timeout: nil)
|
835
884
|
```
|
836
885
|
|
837
886
|
Returns when element specified by selector satisfies `state` option. Returns `null` if waiting for `hidden` or
|
@@ -863,6 +912,17 @@ with sync_playwright() as playwright:
|
|
863
912
|
|
864
913
|
|
865
914
|
|
915
|
+
## wait_for_timeout
|
916
|
+
|
917
|
+
```
|
918
|
+
def wait_for_timeout(timeout)
|
919
|
+
```
|
920
|
+
|
921
|
+
Waits for the given `timeout` in milliseconds.
|
922
|
+
|
923
|
+
Note that `frame.waitForTimeout()` should only be used for debugging. Tests using the timer in production are going to
|
924
|
+
be flaky. Use signals such as network events, selectors becoming visible and others instead.
|
925
|
+
|
866
926
|
## wait_for_url
|
867
927
|
|
868
928
|
```
|