playwright-ruby-client 0.7.0 → 0.9.0
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/browser.md +18 -2
- data/documentation/docs/api/browser_context.md +10 -0
- data/documentation/docs/api/browser_type.md +1 -0
- data/documentation/docs/api/cdp_session.md +41 -1
- 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 +78 -17
- data/documentation/docs/api/keyboard.md +11 -20
- data/documentation/docs/api/locator.md +650 -0
- data/documentation/docs/api/page.md +107 -19
- data/documentation/docs/api/response.md +16 -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/rails_integration.md +1 -1
- data/documentation/docs/article/guides/semi_automation.md +5 -1
- data/documentation/docs/include/api_coverage.md +70 -7
- data/lib/playwright.rb +36 -4
- data/lib/playwright/channel_owners/artifact.rb +4 -0
- data/lib/playwright/channel_owners/browser.rb +5 -0
- data/lib/playwright/channel_owners/browser_context.rb +37 -3
- data/lib/playwright/channel_owners/cdp_session.rb +19 -0
- data/lib/playwright/channel_owners/element_handle.rb +11 -4
- data/lib/playwright/channel_owners/frame.rb +103 -34
- data/lib/playwright/channel_owners/page.rb +140 -53
- data/lib/playwright/channel_owners/response.rb +9 -1
- 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/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/android.rb +6 -6
- data/lib/playwright_api/android_device.rb +10 -9
- data/lib/playwright_api/browser.rb +17 -11
- data/lib/playwright_api/browser_context.rb +14 -9
- data/lib/playwright_api/browser_type.rb +8 -7
- data/lib/playwright_api/cdp_session.rb +30 -8
- 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 +44 -24
- data/lib/playwright_api/frame.rb +100 -49
- data/lib/playwright_api/js_handle.rb +6 -6
- data/lib/playwright_api/locator.rb +509 -0
- data/lib/playwright_api/page.rb +110 -57
- data/lib/playwright_api/playwright.rb +6 -6
- data/lib/playwright_api/request.rb +6 -6
- data/lib/playwright_api/response.rb +15 -10
- data/lib/playwright_api/route.rb +6 -6
- data/lib/playwright_api/selectors.rb +6 -6
- data/lib/playwright_api/web_socket.rb +6 -6
- data/lib/playwright_api/worker.rb +6 -6
- metadata +15 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c0e5286a6e8faaa590ce17ed083f4e6f93c54fb6899571c5edc2a99c4148b15
|
4
|
+
data.tar.gz: bccd47264ec992c5c901c94faf28ec346a606d75e4636ae80828e5d64a685bf0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c34792ec1bb838c99b5a540833c7e02c718147738d2b6129eb9ba63f53e6d6d1460e5abc62f9e94fecec2bc9dd07321c9badc1c4e4173ae0548151ebcbc38e12
|
7
|
+
data.tar.gz: 12b99906a534b8ec3a5eef041824ec4d0357fe70e3a1c696dc4f11a95c1b54edbe8c7a5d67694c7b9dc846bd34fa6e18fbb3d84f241aa345a1d89c8af4ac4a39
|
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).
|
@@ -61,11 +61,22 @@ def connected?
|
|
61
61
|
|
62
62
|
Indicates that the browser is connected.
|
63
63
|
|
64
|
+
## new_browser_cdp_session
|
65
|
+
|
66
|
+
```
|
67
|
+
def new_browser_cdp_session
|
68
|
+
```
|
69
|
+
|
70
|
+
> NOTE: CDP Sessions are only supported on Chromium-based browsers.
|
71
|
+
|
72
|
+
Returns the newly created browser session.
|
73
|
+
|
64
74
|
## new_context
|
65
75
|
|
66
76
|
```
|
67
77
|
def new_context(
|
68
78
|
acceptDownloads: nil,
|
79
|
+
baseURL: nil,
|
69
80
|
bypassCSP: nil,
|
70
81
|
colorScheme: nil,
|
71
82
|
deviceScaleFactor: nil,
|
@@ -114,6 +125,7 @@ end
|
|
114
125
|
```
|
115
126
|
def new_page(
|
116
127
|
acceptDownloads: nil,
|
128
|
+
baseURL: nil,
|
117
129
|
bypassCSP: nil,
|
118
130
|
colorScheme: nil,
|
119
131
|
deviceScaleFactor: nil,
|
@@ -154,7 +166,9 @@ testing frameworks should explicitly create [Browser#new_context](./browser#new_
|
|
154
166
|
def start_tracing(page: nil, categories: nil, path: nil, screenshots: nil)
|
155
167
|
```
|
156
168
|
|
157
|
-
> 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).
|
158
172
|
|
159
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
|
160
174
|
opened in Chrome DevTools performance panel.
|
@@ -175,7 +189,9 @@ end
|
|
175
189
|
def stop_tracing
|
176
190
|
```
|
177
191
|
|
178
|
-
> 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).
|
179
195
|
|
180
196
|
Returns the buffer with trace data.
|
181
197
|
|
@@ -226,6 +226,16 @@ def grant_permissions(permissions, origin: nil)
|
|
226
226
|
Grants specified permissions to the browser context. Only grants corresponding permissions to the given origin if
|
227
227
|
specified.
|
228
228
|
|
229
|
+
## new_cdp_session
|
230
|
+
|
231
|
+
```
|
232
|
+
def new_cdp_session(page)
|
233
|
+
```
|
234
|
+
|
235
|
+
> NOTE: CDP sessions are only supported on Chromium-based browsers.
|
236
|
+
|
237
|
+
Returns the newly created session.
|
238
|
+
|
229
239
|
## new_page
|
230
240
|
|
231
241
|
```
|
@@ -4,4 +4,44 @@ sidebar_position: 10
|
|
4
4
|
|
5
5
|
# CDPSession
|
6
6
|
|
7
|
-
|
7
|
+
- extends: [EventEmitter]
|
8
|
+
|
9
|
+
The [CDPSession](./cdp_session) instances are used to talk raw Chrome Devtools Protocol:
|
10
|
+
- protocol methods can be called with `session.send_message` method.
|
11
|
+
- protocol events can be subscribed to with `session.on` method.
|
12
|
+
|
13
|
+
Useful links:
|
14
|
+
- Documentation on DevTools Protocol can be found here:
|
15
|
+
[DevTools Protocol Viewer](https://chromedevtools.github.io/devtools-protocol/).
|
16
|
+
- Getting Started with DevTools Protocol:
|
17
|
+
https://github.com/aslushnikov/getting-started-with-cdp/blob/master/README.md
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
client = page.context.new_cdp_session(page)
|
21
|
+
client.send_message('Animation.enable')
|
22
|
+
client.on('Animation.animationCreated', -> (_) { puts 'Animation Created' })
|
23
|
+
response = client.send_message('Animation.getPlaybackRate')
|
24
|
+
puts "Playback rate is #{response['playbackRate']}"
|
25
|
+
client.send_message(
|
26
|
+
'Animation.setPlaybackRate',
|
27
|
+
params: { playbackRate: response['playbackRate'] / 2.0 },
|
28
|
+
)
|
29
|
+
```
|
30
|
+
|
31
|
+
|
32
|
+
## detach
|
33
|
+
|
34
|
+
```
|
35
|
+
def detach
|
36
|
+
```
|
37
|
+
|
38
|
+
Detaches the CDPSession from the target. Once detached, the CDPSession object won't emit any events and can't be used to
|
39
|
+
send messages.
|
40
|
+
|
41
|
+
## send_message
|
42
|
+
|
43
|
+
```
|
44
|
+
def send_message(method, params: nil)
|
45
|
+
```
|
46
|
+
|
47
|
+
|
@@ -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
|