playwright-ruby-client 0.7.1 → 1.14.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +26 -0
- 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 +38 -4
- data/documentation/docs/api/experimental/android_device.md +1 -0
- data/documentation/docs/api/frame.md +89 -17
- data/documentation/docs/api/keyboard.md +11 -20
- data/documentation/docs/api/locator.md +650 -0
- data/documentation/docs/api/page.md +135 -19
- data/documentation/docs/api/response.md +16 -0
- 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 +77 -14
- data/lib/playwright.rb +36 -4
- 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/element_handle.rb +11 -4
- data/lib/playwright/channel_owners/frame.rb +107 -34
- data/lib/playwright/channel_owners/page.rb +163 -55
- data/lib/playwright/channel_owners/response.rb +8 -0
- data/lib/playwright/channel_owners/worker.rb +23 -0
- data/lib/playwright/connection.rb +2 -4
- 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/transport.rb +0 -1
- data/lib/playwright/url_matcher.rb +12 -2
- data/lib/playwright/version.rb +2 -2
- data/lib/playwright/web_socket_client.rb +164 -0
- data/lib/playwright/web_socket_transport.rb +104 -0
- data/lib/playwright_api/accessibility.rb +1 -1
- data/lib/playwright_api/android_device.rb +6 -5
- data/lib/playwright_api/browser.rb +10 -4
- data/lib/playwright_api/browser_context.rb +12 -7
- data/lib/playwright_api/browser_type.rb +2 -1
- data/lib/playwright_api/cdp_session.rb +6 -6
- data/lib/playwright_api/download.rb +70 -0
- data/lib/playwright_api/element_handle.rb +38 -18
- data/lib/playwright_api/frame.rb +95 -44
- data/lib/playwright_api/locator.rb +509 -0
- data/lib/playwright_api/page.rb +102 -49
- data/lib/playwright_api/response.rb +10 -0
- data/lib/playwright_api/touchscreen.rb +1 -1
- data/lib/playwright_api/worker.rb +13 -3
- metadata +17 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 301191e26a4aa496f59d5feb5bed3c8438d5de5dfaa3e769dea1dae12dfe091c
|
4
|
+
data.tar.gz: 19fb694b3528977da5f934eff87432fff83a89072de874531fae3ab489f30e41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0c3f28732256000b39c835cc6d38cd1f942c6e9defaa6e1aaf2f4269ba3e121422c0feebb76653ec323b64420bc24418b73ca1fc1fa98a7188e257f6e0ab359
|
7
|
+
data.tar.gz: 1c7ba51eef58fe196bee1411fd9b3da95f3f1a66cf150ce69a614e51511aad081fb7a18b8befdcc9ce2f7ebacae82e8ecb90f0a099b01530d3b7897f22c12142
|
data/README.md
CHANGED
@@ -159,6 +159,32 @@ end
|
|
159
159
|
|
160
160
|
```
|
161
161
|
|
162
|
+
### Communicate with Playwright server
|
163
|
+
|
164
|
+
If your environment doesn't accept installing browser or creating browser process, consider separating Ruby client and Playwright server.
|
165
|
+
|
166
|
+
![structure](https://user-images.githubusercontent.com/11763113/124934448-ad4d0700-e03f-11eb-942e-b9f3282bb703.png)
|
167
|
+
|
168
|
+
For launching Playwright server, just execute:
|
169
|
+
|
170
|
+
```
|
171
|
+
npx playwright install && npx playwright run-server 8080
|
172
|
+
```
|
173
|
+
|
174
|
+
and we can connect to the server with the code like this:
|
175
|
+
|
176
|
+
```ruby
|
177
|
+
Playwright.connect_to_playwright_server('ws://127.0.0.1:8080') do |playwright|
|
178
|
+
playwright.chromium.launch do |browser|
|
179
|
+
page = browser.new_page
|
180
|
+
page.goto('https://github.com/YusukeIwaki')
|
181
|
+
page.screenshot(path: './YusukeIwaki.png')
|
182
|
+
end
|
183
|
+
end
|
184
|
+
```
|
185
|
+
|
186
|
+
When `Playwright.connect_to_playwright_server` is used, playwright_cli_executable_path is not required.
|
187
|
+
|
162
188
|
## License
|
163
189
|
|
164
190
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
@@ -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
|
```
|
@@ -232,7 +257,7 @@ feed_handle.eval_on_selector_all(".tweet", "nodes => nodes.map(n => n.innerText)
|
|
232
257
|
## fill
|
233
258
|
|
234
259
|
```
|
235
|
-
def fill(value, noWaitAfter: nil, timeout: nil)
|
260
|
+
def fill(value, force: nil, noWaitAfter: nil, timeout: nil)
|
236
261
|
```
|
237
262
|
|
238
263
|
This method waits for [actionability](https://playwright.dev/python/docs/actionability) checks, focuses the element, fills it and triggers an `input`
|
@@ -300,6 +325,14 @@ def inner_text
|
|
300
325
|
|
301
326
|
Returns the `element.innerText`.
|
302
327
|
|
328
|
+
## input_value
|
329
|
+
|
330
|
+
```
|
331
|
+
def input_value(timeout: nil)
|
332
|
+
```
|
333
|
+
|
334
|
+
Returns `input.value` for `<input>` or `<textarea>` element. Throws for non-input elements.
|
335
|
+
|
303
336
|
## checked?
|
304
337
|
|
305
338
|
```
|
@@ -436,6 +469,7 @@ def select_option(
|
|
436
469
|
index: nil,
|
437
470
|
value: nil,
|
438
471
|
label: nil,
|
472
|
+
force: nil,
|
439
473
|
noWaitAfter: nil,
|
440
474
|
timeout: nil)
|
441
475
|
```
|
@@ -470,7 +504,7 @@ element_handle.select_option(value: "blue", index: 2, label: "red")
|
|
470
504
|
## select_text
|
471
505
|
|
472
506
|
```
|
473
|
-
def select_text(timeout: nil)
|
507
|
+
def select_text(force: nil, timeout: nil)
|
474
508
|
```
|
475
509
|
|
476
510
|
This method waits for [actionability](https://playwright.dev/python/docs/actionability) checks, then focuses the element and selects all its text
|
@@ -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,25 @@ 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
|
+
strict: nil,
|
216
|
+
timeout: nil,
|
217
|
+
trial: nil)
|
218
|
+
```
|
219
|
+
|
220
|
+
|
221
|
+
|
199
222
|
## eval_on_selector
|
200
223
|
|
201
224
|
```
|
202
|
-
def eval_on_selector(selector, expression, arg: nil)
|
225
|
+
def eval_on_selector(selector, expression, arg: nil, strict: nil)
|
203
226
|
```
|
204
227
|
|
205
228
|
Returns the return value of `expression`.
|
@@ -326,7 +349,13 @@ result_handle.dispose
|
|
326
349
|
## fill
|
327
350
|
|
328
351
|
```
|
329
|
-
def fill(
|
352
|
+
def fill(
|
353
|
+
selector,
|
354
|
+
value,
|
355
|
+
force: nil,
|
356
|
+
noWaitAfter: nil,
|
357
|
+
strict: nil,
|
358
|
+
timeout: nil)
|
330
359
|
```
|
331
360
|
|
332
361
|
This method waits for an element matching `selector`, waits for [actionability](https://playwright.dev/python/docs/actionability) checks, focuses the
|
@@ -343,7 +372,7 @@ To send fine-grained keyboard events, use [Frame#type](./frame#type).
|
|
343
372
|
## focus
|
344
373
|
|
345
374
|
```
|
346
|
-
def focus(selector, timeout: nil)
|
375
|
+
def focus(selector, strict: nil, timeout: nil)
|
347
376
|
```
|
348
377
|
|
349
378
|
This method fetches an element with `selector` and focuses it. If there's no element matching `selector`, the method
|
@@ -374,7 +403,7 @@ assert frame == content_frame
|
|
374
403
|
## get_attribute
|
375
404
|
|
376
405
|
```
|
377
|
-
def get_attribute(selector, name, timeout: nil)
|
406
|
+
def get_attribute(selector, name, strict: nil, timeout: nil)
|
378
407
|
```
|
379
408
|
|
380
409
|
Returns element attribute value.
|
@@ -412,6 +441,7 @@ def hover(
|
|
412
441
|
force: nil,
|
413
442
|
modifiers: nil,
|
414
443
|
position: nil,
|
444
|
+
strict: nil,
|
415
445
|
timeout: nil,
|
416
446
|
trial: nil)
|
417
447
|
```
|
@@ -430,7 +460,7 @@ zero timeout disables this.
|
|
430
460
|
## inner_html
|
431
461
|
|
432
462
|
```
|
433
|
-
def inner_html(selector, timeout: nil)
|
463
|
+
def inner_html(selector, strict: nil, timeout: nil)
|
434
464
|
```
|
435
465
|
|
436
466
|
Returns `element.innerHTML`.
|
@@ -438,15 +468,23 @@ Returns `element.innerHTML`.
|
|
438
468
|
## inner_text
|
439
469
|
|
440
470
|
```
|
441
|
-
def inner_text(selector, timeout: nil)
|
471
|
+
def inner_text(selector, strict: nil, timeout: nil)
|
442
472
|
```
|
443
473
|
|
444
474
|
Returns `element.innerText`.
|
445
475
|
|
476
|
+
## input_value
|
477
|
+
|
478
|
+
```
|
479
|
+
def input_value(selector, strict: nil, timeout: nil)
|
480
|
+
```
|
481
|
+
|
482
|
+
Returns `input.value` for the selected `<input>` or `<textarea>` element. Throws for non-input elements.
|
483
|
+
|
446
484
|
## checked?
|
447
485
|
|
448
486
|
```
|
449
|
-
def checked?(selector, timeout: nil)
|
487
|
+
def checked?(selector, strict: nil, timeout: nil)
|
450
488
|
```
|
451
489
|
|
452
490
|
Returns whether the element is checked. Throws if the element is not a checkbox or radio input.
|
@@ -462,7 +500,7 @@ Returns `true` if the frame has been detached, or `false` otherwise.
|
|
462
500
|
## disabled?
|
463
501
|
|
464
502
|
```
|
465
|
-
def disabled?(selector, timeout: nil)
|
503
|
+
def disabled?(selector, strict: nil, timeout: nil)
|
466
504
|
```
|
467
505
|
|
468
506
|
Returns whether the element is disabled, the opposite of [enabled](https://playwright.dev/python/docs/actionability).
|
@@ -470,7 +508,7 @@ Returns whether the element is disabled, the opposite of [enabled](https://playw
|
|
470
508
|
## editable?
|
471
509
|
|
472
510
|
```
|
473
|
-
def editable?(selector, timeout: nil)
|
511
|
+
def editable?(selector, strict: nil, timeout: nil)
|
474
512
|
```
|
475
513
|
|
476
514
|
Returns whether the element is [editable](https://playwright.dev/python/docs/actionability).
|
@@ -478,7 +516,7 @@ Returns whether the element is [editable](https://playwright.dev/python/docs/act
|
|
478
516
|
## enabled?
|
479
517
|
|
480
518
|
```
|
481
|
-
def enabled?(selector, timeout: nil)
|
519
|
+
def enabled?(selector, strict: nil, timeout: nil)
|
482
520
|
```
|
483
521
|
|
484
522
|
Returns whether the element is [enabled](https://playwright.dev/python/docs/actionability).
|
@@ -486,7 +524,7 @@ Returns whether the element is [enabled](https://playwright.dev/python/docs/acti
|
|
486
524
|
## hidden?
|
487
525
|
|
488
526
|
```
|
489
|
-
def hidden?(selector, timeout: nil)
|
527
|
+
def hidden?(selector, strict: nil, timeout: nil)
|
490
528
|
```
|
491
529
|
|
492
530
|
Returns whether the element is hidden, the opposite of [visible](https://playwright.dev/python/docs/actionability). `selector` that does not
|
@@ -495,12 +533,24 @@ match any elements is considered hidden.
|
|
495
533
|
## visible?
|
496
534
|
|
497
535
|
```
|
498
|
-
def visible?(selector, timeout: nil)
|
536
|
+
def visible?(selector, strict: nil, timeout: nil)
|
499
537
|
```
|
500
538
|
|
501
539
|
Returns whether the element is [visible](https://playwright.dev/python/docs/actionability). `selector` that does not match any elements is
|
502
540
|
considered not visible.
|
503
541
|
|
542
|
+
## locator
|
543
|
+
|
544
|
+
```
|
545
|
+
def locator(selector)
|
546
|
+
```
|
547
|
+
|
548
|
+
The method returns an element locator that can be used to perform actions in the frame. Locator is resolved to the
|
549
|
+
element immediately before performing an action, so a series of actions on the same locator can in fact be performed on
|
550
|
+
different DOM elements. That would happen if the DOM structure between those actions has changed.
|
551
|
+
|
552
|
+
Note that locator always implies visibility, so it will always be locating visible elements.
|
553
|
+
|
504
554
|
## name
|
505
555
|
|
506
556
|
```
|
@@ -537,6 +587,7 @@ def press(
|
|
537
587
|
key,
|
538
588
|
delay: nil,
|
539
589
|
noWaitAfter: nil,
|
590
|
+
strict: nil,
|
540
591
|
timeout: nil)
|
541
592
|
```
|
542
593
|
|
@@ -560,7 +611,7 @@ modifier, modifier is pressed and being held while the subsequent key is being p
|
|
560
611
|
## query_selector
|
561
612
|
|
562
613
|
```
|
563
|
-
def query_selector(selector)
|
614
|
+
def query_selector(selector, strict: nil)
|
564
615
|
```
|
565
616
|
|
566
617
|
Returns the ElementHandle pointing to the frame element.
|
@@ -588,7 +639,9 @@ def select_option(
|
|
588
639
|
index: nil,
|
589
640
|
value: nil,
|
590
641
|
label: nil,
|
642
|
+
force: nil,
|
591
643
|
noWaitAfter: nil,
|
644
|
+
strict: nil,
|
592
645
|
timeout: nil)
|
593
646
|
```
|
594
647
|
|
@@ -627,7 +680,12 @@ alias: `content=`
|
|
627
680
|
## set_input_files
|
628
681
|
|
629
682
|
```
|
630
|
-
def set_input_files(
|
683
|
+
def set_input_files(
|
684
|
+
selector,
|
685
|
+
files,
|
686
|
+
noWaitAfter: nil,
|
687
|
+
strict: nil,
|
688
|
+
timeout: nil)
|
631
689
|
```
|
632
690
|
|
633
691
|
This method expects `selector` to point to an
|
@@ -645,6 +703,7 @@ def tap_point(
|
|
645
703
|
modifiers: nil,
|
646
704
|
noWaitAfter: nil,
|
647
705
|
position: nil,
|
706
|
+
strict: nil,
|
648
707
|
timeout: nil,
|
649
708
|
trial: nil)
|
650
709
|
```
|
@@ -665,7 +724,7 @@ zero timeout disables this.
|
|
665
724
|
## text_content
|
666
725
|
|
667
726
|
```
|
668
|
-
def text_content(selector, timeout: nil)
|
727
|
+
def text_content(selector, strict: nil, timeout: nil)
|
669
728
|
```
|
670
729
|
|
671
730
|
Returns `element.textContent`.
|
@@ -686,6 +745,7 @@ def type(
|
|
686
745
|
text,
|
687
746
|
delay: nil,
|
688
747
|
noWaitAfter: nil,
|
748
|
+
strict: nil,
|
689
749
|
timeout: nil)
|
690
750
|
```
|
691
751
|
|
@@ -710,6 +770,7 @@ def uncheck(
|
|
710
770
|
force: nil,
|
711
771
|
noWaitAfter: nil,
|
712
772
|
position: nil,
|
773
|
+
strict: nil,
|
713
774
|
timeout: nil,
|
714
775
|
trial: nil)
|
715
776
|
```
|
@@ -817,7 +878,7 @@ considered a navigation.
|
|
817
878
|
## wait_for_selector
|
818
879
|
|
819
880
|
```
|
820
|
-
def wait_for_selector(selector, state: nil, timeout: nil)
|
881
|
+
def wait_for_selector(selector, state: nil, strict: nil, timeout: nil)
|
821
882
|
```
|
822
883
|
|
823
884
|
Returns when element specified by selector satisfies `state` option. Returns `null` if waiting for `hidden` or
|
@@ -849,6 +910,17 @@ with sync_playwright() as playwright:
|
|
849
910
|
|
850
911
|
|
851
912
|
|
913
|
+
## wait_for_timeout
|
914
|
+
|
915
|
+
```
|
916
|
+
def wait_for_timeout(timeout)
|
917
|
+
```
|
918
|
+
|
919
|
+
Waits for the given `timeout` in milliseconds.
|
920
|
+
|
921
|
+
Note that `frame.waitForTimeout()` should only be used for debugging. Tests using the timer in production are going to
|
922
|
+
be flaky. Use signals such as network events, selectors becoming visible and others instead.
|
923
|
+
|
852
924
|
## wait_for_url
|
853
925
|
|
854
926
|
```
|