playwright-ruby-client 1.20.2 → 1.23.0
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/api_request_context.md +15 -2
- data/documentation/docs/api/browser.md +16 -0
- data/documentation/docs/api/browser_context.md +15 -2
- data/documentation/docs/api/browser_type.md +5 -1
- data/documentation/docs/api/console_message.md +27 -1
- data/documentation/docs/api/element_handle.md +23 -13
- data/documentation/docs/api/experimental/android.md +1 -1
- data/documentation/docs/api/experimental/android_device.md +4 -0
- data/documentation/docs/api/file_chooser.md +1 -1
- data/documentation/docs/api/frame.md +12 -5
- data/documentation/docs/api/frame_locator.md +1 -1
- data/documentation/docs/api/locator.md +44 -13
- data/documentation/docs/api/page.md +32 -9
- data/documentation/docs/api/request.md +3 -1
- data/documentation/docs/api/response.md +12 -1
- data/documentation/docs/api/route.md +67 -0
- data/documentation/docs/include/api_coverage.md +6 -3
- data/documentation/package.json +6 -6
- data/documentation/yarn.lock +2931 -3220
- data/lib/playwright/channel.rb +1 -3
- data/lib/playwright/channel_owners/browser.rb +13 -0
- data/lib/playwright/channel_owners/browser_context.rb +89 -13
- data/lib/playwright/channel_owners/browser_type.rb +4 -0
- data/lib/playwright/channel_owners/element_handle.rb +12 -3
- data/lib/playwright/channel_owners/frame.rb +20 -7
- data/lib/playwright/channel_owners/local_utils.rb +29 -0
- data/lib/playwright/channel_owners/page.rb +54 -22
- data/lib/playwright/channel_owners/request.rb +31 -6
- data/lib/playwright/channel_owners/response.rb +6 -0
- data/lib/playwright/channel_owners/route.rb +104 -45
- data/lib/playwright/channel_owners/writable_stream.rb +14 -0
- data/lib/playwright/connection.rb +6 -1
- data/lib/playwright/har_router.rb +82 -0
- data/lib/playwright/http_headers.rb +1 -1
- data/lib/playwright/input_files.rb +60 -8
- data/lib/playwright/javascript/regex.rb +23 -0
- data/lib/playwright/javascript/value_parser.rb +17 -2
- data/lib/playwright/javascript/value_serializer.rb +16 -6
- data/lib/playwright/javascript/visitor_info.rb +26 -0
- data/lib/playwright/javascript.rb +1 -0
- data/lib/playwright/locator_impl.rb +18 -5
- data/lib/playwright/playwright_api.rb +26 -6
- data/lib/playwright/route_handler.rb +2 -6
- data/lib/playwright/transport.rb +12 -2
- data/lib/playwright/utils.rb +31 -6
- data/lib/playwright/version.rb +2 -2
- data/lib/playwright.rb +2 -0
- data/lib/playwright_api/accessibility.rb +2 -1
- data/lib/playwright_api/android.rb +2 -2
- data/lib/playwright_api/android_device.rb +5 -1
- data/lib/playwright_api/api_request.rb +3 -3
- data/lib/playwright_api/api_request_context.rb +15 -2
- data/lib/playwright_api/browser.rb +15 -2
- data/lib/playwright_api/browser_context.rb +17 -7
- data/lib/playwright_api/browser_type.rb +7 -3
- data/lib/playwright_api/console_message.rb +20 -1
- data/lib/playwright_api/element_handle.rb +53 -49
- data/lib/playwright_api/file_chooser.rb +1 -1
- data/lib/playwright_api/frame.rb +30 -23
- data/lib/playwright_api/frame_locator.rb +1 -1
- data/lib/playwright_api/locator.rb +58 -38
- data/lib/playwright_api/page.rb +52 -32
- data/lib/playwright_api/playwright.rb +1 -1
- data/lib/playwright_api/request.rb +8 -1
- data/lib/playwright_api/response.rb +14 -1
- data/lib/playwright_api/route.rb +63 -2
- data/lib/playwright_api/selectors.rb +1 -1
- data/lib/playwright_api/tracing.rb +1 -1
- metadata +7 -4
- data/lib/playwright_api/local_utils.rb +0 -9
@@ -66,7 +66,7 @@ module Playwright
|
|
66
66
|
# This method checks the element by performing the following steps:
|
67
67
|
# 1. Ensure that element is a checkbox or a radio input. If not, this method throws. If the element is already checked,
|
68
68
|
# this method returns immediately.
|
69
|
-
# 1. Wait for [actionability](
|
69
|
+
# 1. Wait for [actionability](../actionability.md) checks on the element, unless `force` option is set.
|
70
70
|
# 1. Scroll the element into view if needed.
|
71
71
|
# 1. Use [`property: Page.mouse`] to click in the center of the element.
|
72
72
|
# 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
|
@@ -86,7 +86,7 @@ module Playwright
|
|
86
86
|
end
|
87
87
|
|
88
88
|
# This method clicks the element by performing the following steps:
|
89
|
-
# 1. Wait for [actionability](
|
89
|
+
# 1. Wait for [actionability](../actionability.md) checks on the element, unless `force` option is set.
|
90
90
|
# 1. Scroll the element into view if needed.
|
91
91
|
# 1. Use [`property: Page.mouse`] to click in the center of the element, or the specified `position`.
|
92
92
|
# 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
|
@@ -114,7 +114,7 @@ module Playwright
|
|
114
114
|
end
|
115
115
|
|
116
116
|
# This method double clicks the element by performing the following steps:
|
117
|
-
# 1. Wait for [actionability](
|
117
|
+
# 1. Wait for [actionability](../actionability.md) checks on the element, unless `force` option is set.
|
118
118
|
# 1. Scroll the element into view if needed.
|
119
119
|
# 1. Use [`property: Page.mouse`] to double click in the center of the element, or the specified `position`.
|
120
120
|
# 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set. Note that if the
|
@@ -172,7 +172,7 @@ module Playwright
|
|
172
172
|
# Returns the return value of `expression`.
|
173
173
|
#
|
174
174
|
# The method finds an element matching the specified selector in the `ElementHandle`s subtree and passes it as a first
|
175
|
-
# argument to `expression`. See [Working with selectors](
|
175
|
+
# argument to `expression`. See [Working with selectors](../selectors.md) for more details. If no elements match the
|
176
176
|
# selector, the method throws an error.
|
177
177
|
#
|
178
178
|
# If `expression` returns a [Promise], then [`method: ElementHandle.evalOnSelector`] would wait for the promise to resolve
|
@@ -192,7 +192,7 @@ module Playwright
|
|
192
192
|
# Returns the return value of `expression`.
|
193
193
|
#
|
194
194
|
# The method finds all elements matching the specified selector in the `ElementHandle`'s subtree and passes an array of
|
195
|
-
# matched elements as a first argument to `expression`. See [Working with selectors](
|
195
|
+
# matched elements as a first argument to `expression`. See [Working with selectors](../selectors.md) for more details.
|
196
196
|
#
|
197
197
|
# If `expression` returns a [Promise], then [`method: ElementHandle.evalOnSelectorAll`] would wait for the promise to
|
198
198
|
# resolve and return its value.
|
@@ -214,7 +214,7 @@ module Playwright
|
|
214
214
|
wrap_impl(@impl.eval_on_selector_all(unwrap_impl(selector), unwrap_impl(expression), arg: unwrap_impl(arg)))
|
215
215
|
end
|
216
216
|
|
217
|
-
# This method waits for [actionability](
|
217
|
+
# This method waits for [actionability](../actionability.md) checks, focuses the element, fills it and triggers an `input`
|
218
218
|
# event after filling. Note that you can pass an empty string to clear the input field.
|
219
219
|
#
|
220
220
|
# If the target element is not an `<input>`, `<textarea>` or `[contenteditable]` element, this method throws an error.
|
@@ -239,7 +239,7 @@ module Playwright
|
|
239
239
|
alias_method :[], :get_attribute
|
240
240
|
|
241
241
|
# This method hovers over the element by performing the following steps:
|
242
|
-
# 1. Wait for [actionability](
|
242
|
+
# 1. Wait for [actionability](../actionability.md) checks on the element, unless `force` option is set.
|
243
243
|
# 1. Scroll the element into view if needed.
|
244
244
|
# 1. Use [`property: Page.mouse`] to hover over the center of the element, or the specified `position`.
|
245
245
|
# 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
|
@@ -267,7 +267,10 @@ module Playwright
|
|
267
267
|
wrap_impl(@impl.inner_text)
|
268
268
|
end
|
269
269
|
|
270
|
-
# Returns `input.value` for `<input>` or `<textarea>` or `<select>` element.
|
270
|
+
# Returns `input.value` for the selected `<input>` or `<textarea>` or `<select>` element.
|
271
|
+
#
|
272
|
+
# Throws for non-input elements. However, if the element is inside the `<label>` element that has an associated
|
273
|
+
# [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), returns the value of the control.
|
271
274
|
def input_value(timeout: nil)
|
272
275
|
wrap_impl(@impl.input_value(timeout: unwrap_impl(timeout)))
|
273
276
|
end
|
@@ -277,27 +280,27 @@ module Playwright
|
|
277
280
|
wrap_impl(@impl.checked?)
|
278
281
|
end
|
279
282
|
|
280
|
-
# Returns whether the element is disabled, the opposite of [enabled](
|
283
|
+
# Returns whether the element is disabled, the opposite of [enabled](../actionability.md#enabled).
|
281
284
|
def disabled?
|
282
285
|
wrap_impl(@impl.disabled?)
|
283
286
|
end
|
284
287
|
|
285
|
-
# Returns whether the element is [editable](
|
288
|
+
# Returns whether the element is [editable](../actionability.md#editable).
|
286
289
|
def editable?
|
287
290
|
wrap_impl(@impl.editable?)
|
288
291
|
end
|
289
292
|
|
290
|
-
# Returns whether the element is [enabled](
|
293
|
+
# Returns whether the element is [enabled](../actionability.md#enabled).
|
291
294
|
def enabled?
|
292
295
|
wrap_impl(@impl.enabled?)
|
293
296
|
end
|
294
297
|
|
295
|
-
# Returns whether the element is hidden, the opposite of [visible](
|
298
|
+
# Returns whether the element is hidden, the opposite of [visible](../actionability.md#visible).
|
296
299
|
def hidden?
|
297
300
|
wrap_impl(@impl.hidden?)
|
298
301
|
end
|
299
302
|
|
300
|
-
# Returns whether the element is [visible](
|
303
|
+
# Returns whether the element is [visible](../actionability.md#visible).
|
301
304
|
def visible?
|
302
305
|
wrap_impl(@impl.visible?)
|
303
306
|
end
|
@@ -330,33 +333,39 @@ module Playwright
|
|
330
333
|
end
|
331
334
|
|
332
335
|
# The method finds an element matching the specified selector in the `ElementHandle`'s subtree. See
|
333
|
-
# [Working with selectors](
|
336
|
+
# [Working with selectors](../selectors.md) for more details. If no elements match the selector, returns `null`.
|
334
337
|
def query_selector(selector)
|
335
338
|
wrap_impl(@impl.query_selector(unwrap_impl(selector)))
|
336
339
|
end
|
337
340
|
|
338
341
|
# The method finds all elements matching the specified selector in the `ElementHandle`s subtree. See
|
339
|
-
# [Working with selectors](
|
342
|
+
# [Working with selectors](../selectors.md) for more details. If no elements match the selector, returns empty array.
|
340
343
|
def query_selector_all(selector)
|
341
344
|
wrap_impl(@impl.query_selector_all(unwrap_impl(selector)))
|
342
345
|
end
|
343
346
|
|
344
|
-
#
|
347
|
+
# This method captures a screenshot of the page, clipped to the size and position of this particular element. If the
|
348
|
+
# element is covered by other elements, it will not be actually visible on the screenshot. If the element is a scrollable
|
349
|
+
# container, only the currently scrolled content will be visible on the screenshot.
|
345
350
|
#
|
346
|
-
# This method waits for the [actionability](
|
351
|
+
# This method waits for the [actionability](../actionability.md) checks, then scrolls element into view before taking a
|
347
352
|
# screenshot. If the element is detached from DOM, the method throws an error.
|
353
|
+
#
|
354
|
+
# Returns the buffer with the captured screenshot.
|
348
355
|
def screenshot(
|
349
356
|
animations: nil,
|
357
|
+
caret: nil,
|
350
358
|
mask: nil,
|
351
359
|
omitBackground: nil,
|
352
360
|
path: nil,
|
353
361
|
quality: nil,
|
362
|
+
scale: nil,
|
354
363
|
timeout: nil,
|
355
364
|
type: nil)
|
356
|
-
wrap_impl(@impl.screenshot(animations: unwrap_impl(animations), mask: unwrap_impl(mask), omitBackground: unwrap_impl(omitBackground), path: unwrap_impl(path), quality: unwrap_impl(quality), timeout: unwrap_impl(timeout), type: unwrap_impl(type)))
|
365
|
+
wrap_impl(@impl.screenshot(animations: unwrap_impl(animations), caret: unwrap_impl(caret), mask: unwrap_impl(mask), omitBackground: unwrap_impl(omitBackground), path: unwrap_impl(path), quality: unwrap_impl(quality), scale: unwrap_impl(scale), timeout: unwrap_impl(timeout), type: unwrap_impl(type)))
|
357
366
|
end
|
358
367
|
|
359
|
-
# This method waits for [actionability](
|
368
|
+
# This method waits for [actionability](../actionability.md) checks, then tries to scroll element into view, unless it is
|
360
369
|
# completely visible as defined by
|
361
370
|
# [IntersectionObserver](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API)'s `ratio`.
|
362
371
|
#
|
@@ -366,7 +375,7 @@ module Playwright
|
|
366
375
|
wrap_impl(@impl.scroll_into_view_if_needed(timeout: unwrap_impl(timeout)))
|
367
376
|
end
|
368
377
|
|
369
|
-
# This method waits for [actionability](
|
378
|
+
# This method waits for [actionability](../actionability.md) checks, waits until all specified options are present in the
|
370
379
|
# `<select>` element and selects these options.
|
371
380
|
#
|
372
381
|
# If the target element is not a `<select>` element, this method throws an error. However, if the element is inside the
|
@@ -385,17 +394,6 @@ module Playwright
|
|
385
394
|
# # multiple selection
|
386
395
|
# handle.select_option(value=["red", "green", "blue"])
|
387
396
|
# ```
|
388
|
-
#
|
389
|
-
# ```python sync
|
390
|
-
# # single selection matching the value
|
391
|
-
# handle.select_option("blue")
|
392
|
-
# # single selection matching both the value and the label
|
393
|
-
# handle.select_option(label="blue")
|
394
|
-
# # multiple selection
|
395
|
-
# handle.select_option("red", "green", "blue")
|
396
|
-
# # multiple selection for blue, red and second option
|
397
|
-
# handle.select_option(value="blue", { index: 2 }, "red")
|
398
|
-
# ```
|
399
397
|
def select_option(
|
400
398
|
element: nil,
|
401
399
|
index: nil,
|
@@ -407,8 +405,12 @@ module Playwright
|
|
407
405
|
wrap_impl(@impl.select_option(element: unwrap_impl(element), index: unwrap_impl(index), value: unwrap_impl(value), label: unwrap_impl(label), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout)))
|
408
406
|
end
|
409
407
|
|
410
|
-
# This method waits for [actionability](
|
408
|
+
# This method waits for [actionability](../actionability.md) checks, then focuses the element and selects all its text
|
411
409
|
# content.
|
410
|
+
#
|
411
|
+
# If the element is inside the `<label>` element that has an associated
|
412
|
+
# [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), focuses and selects text in the
|
413
|
+
# control instead.
|
412
414
|
def select_text(force: nil, timeout: nil)
|
413
415
|
wrap_impl(@impl.select_text(force: unwrap_impl(force), timeout: unwrap_impl(timeout)))
|
414
416
|
end
|
@@ -416,7 +418,7 @@ module Playwright
|
|
416
418
|
# This method checks or unchecks an element by performing the following steps:
|
417
419
|
# 1. Ensure that element is a checkbox or a radio input. If not, this method throws.
|
418
420
|
# 1. If the element already has the right checked state, this method returns immediately.
|
419
|
-
# 1. Wait for [actionability](
|
421
|
+
# 1. Wait for [actionability](../actionability.md) checks on the matched element, unless `force` option is set. If the
|
420
422
|
# element is detached during the checks, the whole action is retried.
|
421
423
|
# 1. Scroll the element into view if needed.
|
422
424
|
# 1. Use [`property: Page.mouse`] to click in the center of the element.
|
@@ -436,18 +438,20 @@ module Playwright
|
|
436
438
|
end
|
437
439
|
alias_method :checked=, :set_checked
|
438
440
|
|
439
|
-
# This method expects `elementHandle` to point to an
|
440
|
-
# [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).
|
441
|
-
#
|
442
441
|
# Sets the value of the file input to these file paths or files. If some of the `filePaths` are relative paths, then they
|
443
|
-
# are resolved relative to the
|
442
|
+
# are resolved relative to the current working directory. For empty array, clears the selected files.
|
443
|
+
#
|
444
|
+
# This method expects `ElementHandle` to point to an
|
445
|
+
# [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input). However, if the element is inside the
|
446
|
+
# `<label>` element that has an associated
|
447
|
+
# [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), targets the control instead.
|
444
448
|
def set_input_files(files, noWaitAfter: nil, timeout: nil)
|
445
449
|
wrap_impl(@impl.set_input_files(unwrap_impl(files), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout)))
|
446
450
|
end
|
447
451
|
alias_method :input_files=, :set_input_files
|
448
452
|
|
449
453
|
# This method taps the element by performing the following steps:
|
450
|
-
# 1. Wait for [actionability](
|
454
|
+
# 1. Wait for [actionability](../actionability.md) checks on the element, unless `force` option is set.
|
451
455
|
# 1. Scroll the element into view if needed.
|
452
456
|
# 1. Use [`property: Page.touchscreen`] to tap the center of the element, or the specified `position`.
|
453
457
|
# 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
|
@@ -496,7 +500,7 @@ module Playwright
|
|
496
500
|
# This method checks the element by performing the following steps:
|
497
501
|
# 1. Ensure that element is a checkbox or a radio input. If not, this method throws. If the element is already
|
498
502
|
# unchecked, this method returns immediately.
|
499
|
-
# 1. Wait for [actionability](
|
503
|
+
# 1. Wait for [actionability](../actionability.md) checks on the element, unless `force` option is set.
|
500
504
|
# 1. Scroll the element into view if needed.
|
501
505
|
# 1. Use [`property: Page.mouse`] to click in the center of the element.
|
502
506
|
# 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
|
@@ -517,16 +521,16 @@ module Playwright
|
|
517
521
|
|
518
522
|
# Returns when the element satisfies the `state`.
|
519
523
|
#
|
520
|
-
# Depending on the `state` parameter, this method waits for one of the [actionability](
|
521
|
-
# This method throws when the element is detached while waiting, unless waiting for the `"hidden"` state.
|
522
|
-
# - `"visible"` Wait until the element is [visible](
|
523
|
-
# - `"hidden"` Wait until the element is [not visible](
|
524
|
-
# [not attached](
|
525
|
-
# - `"stable"` Wait until the element is both [visible](
|
526
|
-
# [stable](
|
527
|
-
# - `"enabled"` Wait until the element is [enabled](
|
528
|
-
# - `"disabled"` Wait until the element is [not enabled](
|
529
|
-
# - `"editable"` Wait until the element is [editable](
|
524
|
+
# Depending on the `state` parameter, this method waits for one of the [actionability](../actionability.md) checks to
|
525
|
+
# pass. This method throws when the element is detached while waiting, unless waiting for the `"hidden"` state.
|
526
|
+
# - `"visible"` Wait until the element is [visible](../actionability.md#visible).
|
527
|
+
# - `"hidden"` Wait until the element is [not visible](../actionability.md#visible) or
|
528
|
+
# [not attached](../actionability.md#attached). Note that waiting for hidden does not throw when the element detaches.
|
529
|
+
# - `"stable"` Wait until the element is both [visible](../actionability.md#visible) and
|
530
|
+
# [stable](../actionability.md#stable).
|
531
|
+
# - `"enabled"` Wait until the element is [enabled](../actionability.md#enabled).
|
532
|
+
# - `"disabled"` Wait until the element is [not enabled](../actionability.md#enabled).
|
533
|
+
# - `"editable"` Wait until the element is [editable](../actionability.md#editable).
|
530
534
|
#
|
531
535
|
# If the element does not satisfy the condition for the `timeout` milliseconds, this method will throw.
|
532
536
|
def wait_for_element_state(state, timeout: nil)
|
@@ -25,7 +25,7 @@ module Playwright
|
|
25
25
|
end
|
26
26
|
|
27
27
|
# Sets the value of the file input this chooser is associated with. If some of the `filePaths` are relative paths, then
|
28
|
-
# they are resolved relative to the
|
28
|
+
# they are resolved relative to the current working directory. For empty array, clears the selected files.
|
29
29
|
def set_files(files, noWaitAfter: nil, timeout: nil)
|
30
30
|
wrap_impl(@impl.set_files(unwrap_impl(files), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout)))
|
31
31
|
end
|
data/lib/playwright_api/frame.rb
CHANGED
@@ -51,7 +51,7 @@ module Playwright
|
|
51
51
|
# 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
|
52
52
|
# 1. Ensure that matched element is a checkbox or a radio input. If not, this method throws. If the element is already
|
53
53
|
# checked, this method returns immediately.
|
54
|
-
# 1. Wait for [actionability](
|
54
|
+
# 1. Wait for [actionability](../actionability.md) checks on the matched element, unless `force` option is set. If the
|
55
55
|
# element is detached during the checks, the whole action is retried.
|
56
56
|
# 1. Scroll the element into view if needed.
|
57
57
|
# 1. Use [`property: Page.mouse`] to click in the center of the element.
|
@@ -77,7 +77,7 @@ module Playwright
|
|
77
77
|
|
78
78
|
# This method clicks an element matching `selector` by performing the following steps:
|
79
79
|
# 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
|
80
|
-
# 1. Wait for [actionability](
|
80
|
+
# 1. Wait for [actionability](../actionability.md) checks on the matched element, unless `force` option is set. If the
|
81
81
|
# element is detached during the checks, the whole action is retried.
|
82
82
|
# 1. Scroll the element into view if needed.
|
83
83
|
# 1. Use [`property: Page.mouse`] to click in the center of the element, or the specified `position`.
|
@@ -107,7 +107,7 @@ module Playwright
|
|
107
107
|
|
108
108
|
# This method double clicks an element matching `selector` by performing the following steps:
|
109
109
|
# 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
|
110
|
-
# 1. Wait for [actionability](
|
110
|
+
# 1. Wait for [actionability](../actionability.md) checks on the matched element, unless `force` option is set. If the
|
111
111
|
# element is detached during the checks, the whole action is retried.
|
112
112
|
# 1. Scroll the element into view if needed.
|
113
113
|
# 1. Use [`property: Page.mouse`] to double click in the center of the element, or the specified `position`.
|
@@ -187,7 +187,7 @@ module Playwright
|
|
187
187
|
# tests. Use [`method: Locator.evaluate`], other `Locator` helper methods or web-first assertions instead.
|
188
188
|
#
|
189
189
|
# The method finds an element matching the specified selector within the frame and passes it as a first argument to
|
190
|
-
# `expression`. See [Working with selectors](
|
190
|
+
# `expression`. See [Working with selectors](../selectors.md) for more details. If no elements match the selector, the
|
191
191
|
# method throws an error.
|
192
192
|
#
|
193
193
|
# If `expression` returns a [Promise], then [`method: Frame.evalOnSelector`] would wait for the promise to resolve and
|
@@ -210,7 +210,7 @@ module Playwright
|
|
210
210
|
# better job.
|
211
211
|
#
|
212
212
|
# The method finds all elements matching the specified selector within the frame and passes an array of matched elements
|
213
|
-
# as a first argument to `expression`. See [Working with selectors](
|
213
|
+
# as a first argument to `expression`. See [Working with selectors](../selectors.md) for more details.
|
214
214
|
#
|
215
215
|
# If `expression` returns a [Promise], then [`method: Frame.evalOnSelectorAll`] would wait for the promise to resolve and
|
216
216
|
# return its value.
|
@@ -288,7 +288,7 @@ module Playwright
|
|
288
288
|
wrap_impl(@impl.evaluate_handle(unwrap_impl(expression), arg: unwrap_impl(arg)))
|
289
289
|
end
|
290
290
|
|
291
|
-
# This method waits for an element matching `selector`, waits for [actionability](
|
291
|
+
# This method waits for an element matching `selector`, waits for [actionability](../actionability.md) checks, focuses the
|
292
292
|
# element, fills it and triggers an `input` event after filling. Note that you can pass an empty string to clear the input
|
293
293
|
# field.
|
294
294
|
#
|
@@ -371,7 +371,7 @@ module Playwright
|
|
371
371
|
|
372
372
|
# This method hovers over an element matching `selector` by performing the following steps:
|
373
373
|
# 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
|
374
|
-
# 1. Wait for [actionability](
|
374
|
+
# 1. Wait for [actionability](../actionability.md) checks on the matched element, unless `force` option is set. If the
|
375
375
|
# element is detached during the checks, the whole action is retried.
|
376
376
|
# 1. Scroll the element into view if needed.
|
377
377
|
# 1. Use [`property: Page.mouse`] to hover over the center of the element, or the specified `position`.
|
@@ -400,7 +400,10 @@ module Playwright
|
|
400
400
|
wrap_impl(@impl.inner_text(unwrap_impl(selector), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
|
401
401
|
end
|
402
402
|
|
403
|
-
# Returns `input.value` for the selected `<input>` or `<textarea>` or `<select>` element.
|
403
|
+
# Returns `input.value` for the selected `<input>` or `<textarea>` or `<select>` element.
|
404
|
+
#
|
405
|
+
# Throws for non-input elements. However, if the element is inside the `<label>` element that has an associated
|
406
|
+
# [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), returns the value of the control.
|
404
407
|
def input_value(selector, strict: nil, timeout: nil)
|
405
408
|
wrap_impl(@impl.input_value(unwrap_impl(selector), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
|
406
409
|
end
|
@@ -415,28 +418,28 @@ module Playwright
|
|
415
418
|
wrap_impl(@impl.detached?)
|
416
419
|
end
|
417
420
|
|
418
|
-
# Returns whether the element is disabled, the opposite of [enabled](
|
421
|
+
# Returns whether the element is disabled, the opposite of [enabled](../actionability.md#enabled).
|
419
422
|
def disabled?(selector, strict: nil, timeout: nil)
|
420
423
|
wrap_impl(@impl.disabled?(unwrap_impl(selector), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
|
421
424
|
end
|
422
425
|
|
423
|
-
# Returns whether the element is [editable](
|
426
|
+
# Returns whether the element is [editable](../actionability.md#editable).
|
424
427
|
def editable?(selector, strict: nil, timeout: nil)
|
425
428
|
wrap_impl(@impl.editable?(unwrap_impl(selector), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
|
426
429
|
end
|
427
430
|
|
428
|
-
# Returns whether the element is [enabled](
|
431
|
+
# Returns whether the element is [enabled](../actionability.md#enabled).
|
429
432
|
def enabled?(selector, strict: nil, timeout: nil)
|
430
433
|
wrap_impl(@impl.enabled?(unwrap_impl(selector), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
|
431
434
|
end
|
432
435
|
|
433
|
-
# Returns whether the element is hidden, the opposite of [visible](
|
436
|
+
# Returns whether the element is hidden, the opposite of [visible](../actionability.md#visible). `selector` that does not
|
434
437
|
# match any elements is considered hidden.
|
435
438
|
def hidden?(selector, strict: nil, timeout: nil)
|
436
439
|
wrap_impl(@impl.hidden?(unwrap_impl(selector), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
|
437
440
|
end
|
438
441
|
|
439
|
-
# Returns whether the element is [visible](
|
442
|
+
# Returns whether the element is [visible](../actionability.md#visible). `selector` that does not match any elements is
|
440
443
|
# considered not visible.
|
441
444
|
def visible?(selector, strict: nil, timeout: nil)
|
442
445
|
wrap_impl(@impl.visible?(unwrap_impl(selector), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
|
@@ -445,6 +448,8 @@ module Playwright
|
|
445
448
|
# The method returns an element locator that can be used to perform actions in the frame. Locator is resolved to the
|
446
449
|
# element immediately before performing an action, so a series of actions on the same locator can in fact be performed on
|
447
450
|
# different DOM elements. That would happen if the DOM structure between those actions has changed.
|
451
|
+
#
|
452
|
+
# [Learn more about locators](../locators.md).
|
448
453
|
def locator(selector, has: nil, hasText: nil)
|
449
454
|
wrap_impl(@impl.locator(unwrap_impl(selector), has: unwrap_impl(has), hasText: unwrap_impl(hasText)))
|
450
455
|
end
|
@@ -499,7 +504,7 @@ module Playwright
|
|
499
504
|
# > NOTE: The use of `ElementHandle` is discouraged, use `Locator` objects and web-first assertions instead.
|
500
505
|
#
|
501
506
|
# The method finds an element matching the specified selector within the frame. See
|
502
|
-
# [Working with selectors](
|
507
|
+
# [Working with selectors](../selectors.md) for more details. If no elements match the selector, returns `null`.
|
503
508
|
def query_selector(selector, strict: nil)
|
504
509
|
wrap_impl(@impl.query_selector(unwrap_impl(selector), strict: unwrap_impl(strict)))
|
505
510
|
end
|
@@ -509,12 +514,12 @@ module Playwright
|
|
509
514
|
# > NOTE: The use of `ElementHandle` is discouraged, use `Locator` objects instead.
|
510
515
|
#
|
511
516
|
# The method finds all elements matching the specified selector within the frame. See
|
512
|
-
# [Working with selectors](
|
517
|
+
# [Working with selectors](../selectors.md) for more details. If no elements match the selector, returns empty array.
|
513
518
|
def query_selector_all(selector)
|
514
519
|
wrap_impl(@impl.query_selector_all(unwrap_impl(selector)))
|
515
520
|
end
|
516
521
|
|
517
|
-
# This method waits for an element matching `selector`, waits for [actionability](
|
522
|
+
# This method waits for an element matching `selector`, waits for [actionability](../actionability.md) checks, waits until
|
518
523
|
# all specified options are present in the `<select>` element and selects these options.
|
519
524
|
#
|
520
525
|
# If the target element is not a `<select>` element, this method throws an error. However, if the element is inside the
|
@@ -550,7 +555,7 @@ module Playwright
|
|
550
555
|
# 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
|
551
556
|
# 1. Ensure that matched element is a checkbox or a radio input. If not, this method throws.
|
552
557
|
# 1. If the element already has the right checked state, this method returns immediately.
|
553
|
-
# 1. Wait for [actionability](
|
558
|
+
# 1. Wait for [actionability](../actionability.md) checks on the matched element, unless `force` option is set. If the
|
554
559
|
# element is detached during the checks, the whole action is retried.
|
555
560
|
# 1. Scroll the element into view if needed.
|
556
561
|
# 1. Use [`property: Page.mouse`] to click in the center of the element.
|
@@ -576,11 +581,13 @@ module Playwright
|
|
576
581
|
end
|
577
582
|
alias_method :content=, :set_content
|
578
583
|
|
579
|
-
# This method expects `selector` to point to an
|
580
|
-
# [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).
|
581
|
-
#
|
582
584
|
# Sets the value of the file input to these file paths or files. If some of the `filePaths` are relative paths, then they
|
583
|
-
# are resolved relative to the
|
585
|
+
# are resolved relative to the current working directory. For empty array, clears the selected files.
|
586
|
+
#
|
587
|
+
# This method expects `selector` to point to an
|
588
|
+
# [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input). However, if the element is inside the
|
589
|
+
# `<label>` element that has an associated
|
590
|
+
# [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), targets the control instead.
|
584
591
|
def set_input_files(
|
585
592
|
selector,
|
586
593
|
files,
|
@@ -592,7 +599,7 @@ module Playwright
|
|
592
599
|
|
593
600
|
# This method taps an element matching `selector` by performing the following steps:
|
594
601
|
# 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
|
595
|
-
# 1. Wait for [actionability](
|
602
|
+
# 1. Wait for [actionability](../actionability.md) checks on the matched element, unless `force` option is set. If the
|
596
603
|
# element is detached during the checks, the whole action is retried.
|
597
604
|
# 1. Scroll the element into view if needed.
|
598
605
|
# 1. Use [`property: Page.touchscreen`] to tap the center of the element, or the specified `position`.
|
@@ -647,7 +654,7 @@ module Playwright
|
|
647
654
|
# 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
|
648
655
|
# 1. Ensure that matched element is a checkbox or a radio input. If not, this method throws. If the element is already
|
649
656
|
# unchecked, this method returns immediately.
|
650
|
-
# 1. Wait for [actionability](
|
657
|
+
# 1. Wait for [actionability](../actionability.md) checks on the matched element, unless `force` option is set. If the
|
651
658
|
# element is detached during the checks, the whole action is retried.
|
652
659
|
# 1. Scroll the element into view if needed.
|
653
660
|
# 1. Use [`property: Page.mouse`] to click in the center of the element.
|
@@ -52,7 +52,7 @@ module Playwright
|
|
52
52
|
wrap_impl(@impl.locator(unwrap_impl(selector), has: unwrap_impl(has), hasText: unwrap_impl(hasText)))
|
53
53
|
end
|
54
54
|
|
55
|
-
# Returns locator to the n-th matching frame.
|
55
|
+
# Returns locator to the n-th matching frame. It's zero based, `nth(0)` selects the first frame.
|
56
56
|
def nth(index)
|
57
57
|
wrap_impl(@impl.nth(unwrap_impl(index)))
|
58
58
|
end
|