playwright-ruby-client 1.20.2 → 1.21.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_type.md +1 -1
- data/documentation/docs/api/console_message.md +27 -1
- data/documentation/docs/api/element_handle.md +4 -2
- data/documentation/docs/api/experimental/android.md +1 -1
- data/documentation/docs/api/frame_locator.md +1 -1
- data/documentation/docs/api/locator.md +3 -1
- data/documentation/docs/api/page.md +4 -1
- data/documentation/package.json +6 -6
- data/documentation/yarn.lock +2931 -3220
- data/lib/playwright/channel_owners/browser_context.rb +8 -0
- data/lib/playwright/channel_owners/element_handle.rb +12 -3
- data/lib/playwright/channel_owners/frame.rb +4 -5
- data/lib/playwright/channel_owners/page.rb +11 -7
- data/lib/playwright/channel_owners/writable_stream.rb +14 -0
- data/lib/playwright/input_files.rb +60 -8
- data/lib/playwright/locator_impl.rb +5 -0
- data/lib/playwright/transport.rb +12 -2
- data/lib/playwright/version.rb +2 -2
- data/lib/playwright_api/accessibility.rb +2 -1
- data/lib/playwright_api/android.rb +8 -8
- data/lib/playwright_api/android_device.rb +6 -6
- data/lib/playwright_api/api_request.rb +3 -3
- data/lib/playwright_api/api_request_context.rb +21 -8
- data/lib/playwright_api/browser.rb +6 -6
- data/lib/playwright_api/browser_context.rb +11 -11
- data/lib/playwright_api/browser_type.rb +8 -8
- data/lib/playwright_api/cdp_session.rb +6 -6
- data/lib/playwright_api/console_message.rb +26 -7
- data/lib/playwright_api/dialog.rb +6 -6
- data/lib/playwright_api/element_handle.rb +40 -38
- data/lib/playwright_api/frame.rb +24 -24
- data/lib/playwright_api/frame_locator.rb +1 -1
- data/lib/playwright_api/js_handle.rb +6 -6
- data/lib/playwright_api/locator.rb +22 -20
- data/lib/playwright_api/page.rb +31 -28
- data/lib/playwright_api/playwright.rb +9 -9
- data/lib/playwright_api/request.rb +6 -6
- data/lib/playwright_api/response.rb +6 -6
- data/lib/playwright_api/route.rb +6 -6
- data/lib/playwright_api/selectors.rb +7 -7
- data/lib/playwright_api/tracing.rb +7 -7
- data/lib/playwright_api/web_socket.rb +6 -6
- data/lib/playwright_api/worker.rb +8 -8
- metadata +4 -3
@@ -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.
|
@@ -277,27 +277,27 @@ module Playwright
|
|
277
277
|
wrap_impl(@impl.checked?)
|
278
278
|
end
|
279
279
|
|
280
|
-
# Returns whether the element is disabled, the opposite of [enabled](
|
280
|
+
# Returns whether the element is disabled, the opposite of [enabled](../actionability.md#enabled).
|
281
281
|
def disabled?
|
282
282
|
wrap_impl(@impl.disabled?)
|
283
283
|
end
|
284
284
|
|
285
|
-
# Returns whether the element is [editable](
|
285
|
+
# Returns whether the element is [editable](../actionability.md#editable).
|
286
286
|
def editable?
|
287
287
|
wrap_impl(@impl.editable?)
|
288
288
|
end
|
289
289
|
|
290
|
-
# Returns whether the element is [enabled](
|
290
|
+
# Returns whether the element is [enabled](../actionability.md#enabled).
|
291
291
|
def enabled?
|
292
292
|
wrap_impl(@impl.enabled?)
|
293
293
|
end
|
294
294
|
|
295
|
-
# Returns whether the element is hidden, the opposite of [visible](
|
295
|
+
# Returns whether the element is hidden, the opposite of [visible](../actionability.md#visible).
|
296
296
|
def hidden?
|
297
297
|
wrap_impl(@impl.hidden?)
|
298
298
|
end
|
299
299
|
|
300
|
-
# Returns whether the element is [visible](
|
300
|
+
# Returns whether the element is [visible](../actionability.md#visible).
|
301
301
|
def visible?
|
302
302
|
wrap_impl(@impl.visible?)
|
303
303
|
end
|
@@ -330,33 +330,35 @@ module Playwright
|
|
330
330
|
end
|
331
331
|
|
332
332
|
# The method finds an element matching the specified selector in the `ElementHandle`'s subtree. See
|
333
|
-
# [Working with selectors](
|
333
|
+
# [Working with selectors](../selectors.md) for more details. If no elements match the selector, returns `null`.
|
334
334
|
def query_selector(selector)
|
335
335
|
wrap_impl(@impl.query_selector(unwrap_impl(selector)))
|
336
336
|
end
|
337
337
|
|
338
338
|
# The method finds all elements matching the specified selector in the `ElementHandle`s subtree. See
|
339
|
-
# [Working with selectors](
|
339
|
+
# [Working with selectors](../selectors.md) for more details. If no elements match the selector, returns empty array.
|
340
340
|
def query_selector_all(selector)
|
341
341
|
wrap_impl(@impl.query_selector_all(unwrap_impl(selector)))
|
342
342
|
end
|
343
343
|
|
344
344
|
# Returns the buffer with the captured screenshot.
|
345
345
|
#
|
346
|
-
# This method waits for the [actionability](
|
346
|
+
# This method waits for the [actionability](../actionability.md) checks, then scrolls element into view before taking a
|
347
347
|
# screenshot. If the element is detached from DOM, the method throws an error.
|
348
348
|
def screenshot(
|
349
349
|
animations: nil,
|
350
|
+
caret: nil,
|
350
351
|
mask: nil,
|
351
352
|
omitBackground: nil,
|
352
353
|
path: nil,
|
353
354
|
quality: nil,
|
355
|
+
scale: nil,
|
354
356
|
timeout: nil,
|
355
357
|
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)))
|
358
|
+
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
359
|
end
|
358
360
|
|
359
|
-
# This method waits for [actionability](
|
361
|
+
# This method waits for [actionability](../actionability.md) checks, then tries to scroll element into view, unless it is
|
360
362
|
# completely visible as defined by
|
361
363
|
# [IntersectionObserver](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API)'s `ratio`.
|
362
364
|
#
|
@@ -366,7 +368,7 @@ module Playwright
|
|
366
368
|
wrap_impl(@impl.scroll_into_view_if_needed(timeout: unwrap_impl(timeout)))
|
367
369
|
end
|
368
370
|
|
369
|
-
# This method waits for [actionability](
|
371
|
+
# This method waits for [actionability](../actionability.md) checks, waits until all specified options are present in the
|
370
372
|
# `<select>` element and selects these options.
|
371
373
|
#
|
372
374
|
# If the target element is not a `<select>` element, this method throws an error. However, if the element is inside the
|
@@ -407,7 +409,7 @@ module Playwright
|
|
407
409
|
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
410
|
end
|
409
411
|
|
410
|
-
# This method waits for [actionability](
|
412
|
+
# This method waits for [actionability](../actionability.md) checks, then focuses the element and selects all its text
|
411
413
|
# content.
|
412
414
|
def select_text(force: nil, timeout: nil)
|
413
415
|
wrap_impl(@impl.select_text(force: unwrap_impl(force), timeout: unwrap_impl(timeout)))
|
@@ -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.
|
@@ -447,7 +449,7 @@ module Playwright
|
|
447
449
|
alias_method :input_files=, :set_input_files
|
448
450
|
|
449
451
|
# This method taps the element by performing the following steps:
|
450
|
-
# 1. Wait for [actionability](
|
452
|
+
# 1. Wait for [actionability](../actionability.md) checks on the element, unless `force` option is set.
|
451
453
|
# 1. Scroll the element into view if needed.
|
452
454
|
# 1. Use [`property: Page.touchscreen`] to tap the center of the element, or the specified `position`.
|
453
455
|
# 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
|
@@ -496,7 +498,7 @@ module Playwright
|
|
496
498
|
# This method checks the element by performing the following steps:
|
497
499
|
# 1. Ensure that element is a checkbox or a radio input. If not, this method throws. If the element is already
|
498
500
|
# unchecked, this method returns immediately.
|
499
|
-
# 1. Wait for [actionability](
|
501
|
+
# 1. Wait for [actionability](../actionability.md) checks on the element, unless `force` option is set.
|
500
502
|
# 1. Scroll the element into view if needed.
|
501
503
|
# 1. Use [`property: Page.mouse`] to click in the center of the element.
|
502
504
|
# 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
|
@@ -517,16 +519,16 @@ module Playwright
|
|
517
519
|
|
518
520
|
# Returns when the element satisfies the `state`.
|
519
521
|
#
|
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](
|
522
|
+
# Depending on the `state` parameter, this method waits for one of the [actionability](../actionability.md) checks to
|
523
|
+
# pass. This method throws when the element is detached while waiting, unless waiting for the `"hidden"` state.
|
524
|
+
# - `"visible"` Wait until the element is [visible](../actionability.md#visible).
|
525
|
+
# - `"hidden"` Wait until the element is [not visible](../actionability.md#visible) or
|
526
|
+
# [not attached](../actionability.md#attached). Note that waiting for hidden does not throw when the element detaches.
|
527
|
+
# - `"stable"` Wait until the element is both [visible](../actionability.md#visible) and
|
528
|
+
# [stable](../actionability.md#stable).
|
529
|
+
# - `"enabled"` Wait until the element is [enabled](../actionability.md#enabled).
|
530
|
+
# - `"disabled"` Wait until the element is [not enabled](../actionability.md#enabled).
|
531
|
+
# - `"editable"` Wait until the element is [editable](../actionability.md#editable).
|
530
532
|
#
|
531
533
|
# If the element does not satisfy the condition for the `timeout` milliseconds, this method will throw.
|
532
534
|
def wait_for_element_state(state, timeout: nil)
|
@@ -553,12 +555,6 @@ module Playwright
|
|
553
555
|
wrap_impl(@impl.wait_for_selector(unwrap_impl(selector), state: unwrap_impl(state), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
|
554
556
|
end
|
555
557
|
|
556
|
-
# -- inherited from EventEmitter --
|
557
|
-
# @nodoc
|
558
|
-
def off(event, callback)
|
559
|
-
event_emitter_proxy.off(event, callback)
|
560
|
-
end
|
561
|
-
|
562
558
|
# -- inherited from EventEmitter --
|
563
559
|
# @nodoc
|
564
560
|
def once(event, callback)
|
@@ -571,6 +567,12 @@ module Playwright
|
|
571
567
|
event_emitter_proxy.on(event, callback)
|
572
568
|
end
|
573
569
|
|
570
|
+
# -- inherited from EventEmitter --
|
571
|
+
# @nodoc
|
572
|
+
def off(event, callback)
|
573
|
+
event_emitter_proxy.off(event, callback)
|
574
|
+
end
|
575
|
+
|
574
576
|
private def event_emitter_proxy
|
575
577
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
576
578
|
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`.
|
@@ -415,28 +415,28 @@ module Playwright
|
|
415
415
|
wrap_impl(@impl.detached?)
|
416
416
|
end
|
417
417
|
|
418
|
-
# Returns whether the element is disabled, the opposite of [enabled](
|
418
|
+
# Returns whether the element is disabled, the opposite of [enabled](../actionability.md#enabled).
|
419
419
|
def disabled?(selector, strict: nil, timeout: nil)
|
420
420
|
wrap_impl(@impl.disabled?(unwrap_impl(selector), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
|
421
421
|
end
|
422
422
|
|
423
|
-
# Returns whether the element is [editable](
|
423
|
+
# Returns whether the element is [editable](../actionability.md#editable).
|
424
424
|
def editable?(selector, strict: nil, timeout: nil)
|
425
425
|
wrap_impl(@impl.editable?(unwrap_impl(selector), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
|
426
426
|
end
|
427
427
|
|
428
|
-
# Returns whether the element is [enabled](
|
428
|
+
# Returns whether the element is [enabled](../actionability.md#enabled).
|
429
429
|
def enabled?(selector, strict: nil, timeout: nil)
|
430
430
|
wrap_impl(@impl.enabled?(unwrap_impl(selector), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
|
431
431
|
end
|
432
432
|
|
433
|
-
# Returns whether the element is hidden, the opposite of [visible](
|
433
|
+
# Returns whether the element is hidden, the opposite of [visible](../actionability.md#visible). `selector` that does not
|
434
434
|
# match any elements is considered hidden.
|
435
435
|
def hidden?(selector, strict: nil, timeout: nil)
|
436
436
|
wrap_impl(@impl.hidden?(unwrap_impl(selector), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
|
437
437
|
end
|
438
438
|
|
439
|
-
# Returns whether the element is [visible](
|
439
|
+
# Returns whether the element is [visible](../actionability.md#visible). `selector` that does not match any elements is
|
440
440
|
# considered not visible.
|
441
441
|
def visible?(selector, strict: nil, timeout: nil)
|
442
442
|
wrap_impl(@impl.visible?(unwrap_impl(selector), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
|
@@ -499,7 +499,7 @@ module Playwright
|
|
499
499
|
# > NOTE: The use of `ElementHandle` is discouraged, use `Locator` objects and web-first assertions instead.
|
500
500
|
#
|
501
501
|
# The method finds an element matching the specified selector within the frame. See
|
502
|
-
# [Working with selectors](
|
502
|
+
# [Working with selectors](../selectors.md) for more details. If no elements match the selector, returns `null`.
|
503
503
|
def query_selector(selector, strict: nil)
|
504
504
|
wrap_impl(@impl.query_selector(unwrap_impl(selector), strict: unwrap_impl(strict)))
|
505
505
|
end
|
@@ -509,12 +509,12 @@ module Playwright
|
|
509
509
|
# > NOTE: The use of `ElementHandle` is discouraged, use `Locator` objects instead.
|
510
510
|
#
|
511
511
|
# The method finds all elements matching the specified selector within the frame. See
|
512
|
-
# [Working with selectors](
|
512
|
+
# [Working with selectors](../selectors.md) for more details. If no elements match the selector, returns empty array.
|
513
513
|
def query_selector_all(selector)
|
514
514
|
wrap_impl(@impl.query_selector_all(unwrap_impl(selector)))
|
515
515
|
end
|
516
516
|
|
517
|
-
# This method waits for an element matching `selector`, waits for [actionability](
|
517
|
+
# This method waits for an element matching `selector`, waits for [actionability](../actionability.md) checks, waits until
|
518
518
|
# all specified options are present in the `<select>` element and selects these options.
|
519
519
|
#
|
520
520
|
# If the target element is not a `<select>` element, this method throws an error. However, if the element is inside the
|
@@ -550,7 +550,7 @@ module Playwright
|
|
550
550
|
# 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
|
551
551
|
# 1. Ensure that matched element is a checkbox or a radio input. If not, this method throws.
|
552
552
|
# 1. If the element already has the right checked state, this method returns immediately.
|
553
|
-
# 1. Wait for [actionability](
|
553
|
+
# 1. Wait for [actionability](../actionability.md) checks on the matched element, unless `force` option is set. If the
|
554
554
|
# element is detached during the checks, the whole action is retried.
|
555
555
|
# 1. Scroll the element into view if needed.
|
556
556
|
# 1. Use [`property: Page.mouse`] to click in the center of the element.
|
@@ -592,7 +592,7 @@ module Playwright
|
|
592
592
|
|
593
593
|
# This method taps an element matching `selector` by performing the following steps:
|
594
594
|
# 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](
|
595
|
+
# 1. Wait for [actionability](../actionability.md) checks on the matched element, unless `force` option is set. If the
|
596
596
|
# element is detached during the checks, the whole action is retried.
|
597
597
|
# 1. Scroll the element into view if needed.
|
598
598
|
# 1. Use [`property: Page.touchscreen`] to tap the center of the element, or the specified `position`.
|
@@ -647,7 +647,7 @@ module Playwright
|
|
647
647
|
# 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
|
648
648
|
# 1. Ensure that matched element is a checkbox or a radio input. If not, this method throws. If the element is already
|
649
649
|
# unchecked, this method returns immediately.
|
650
|
-
# 1. Wait for [actionability](
|
650
|
+
# 1. Wait for [actionability](../actionability.md) checks on the matched element, unless `force` option is set. If the
|
651
651
|
# element is detached during the checks, the whole action is retried.
|
652
652
|
# 1. Scroll the element into view if needed.
|
653
653
|
# 1. Use [`property: Page.mouse`] to click in the center of the element.
|
@@ -793,12 +793,6 @@ module Playwright
|
|
793
793
|
wrap_impl(@impl.highlight(unwrap_impl(selector)))
|
794
794
|
end
|
795
795
|
|
796
|
-
# -- inherited from EventEmitter --
|
797
|
-
# @nodoc
|
798
|
-
def off(event, callback)
|
799
|
-
event_emitter_proxy.off(event, callback)
|
800
|
-
end
|
801
|
-
|
802
796
|
# -- inherited from EventEmitter --
|
803
797
|
# @nodoc
|
804
798
|
def once(event, callback)
|
@@ -811,6 +805,12 @@ module Playwright
|
|
811
805
|
event_emitter_proxy.on(event, callback)
|
812
806
|
end
|
813
807
|
|
808
|
+
# -- inherited from EventEmitter --
|
809
|
+
# @nodoc
|
810
|
+
def off(event, callback)
|
811
|
+
event_emitter_proxy.off(event, callback)
|
812
|
+
end
|
813
|
+
|
814
814
|
private def event_emitter_proxy
|
815
815
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
816
816
|
end
|
@@ -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
|
@@ -88,12 +88,6 @@ module Playwright
|
|
88
88
|
wrap_impl(@impl.to_s)
|
89
89
|
end
|
90
90
|
|
91
|
-
# -- inherited from EventEmitter --
|
92
|
-
# @nodoc
|
93
|
-
def off(event, callback)
|
94
|
-
event_emitter_proxy.off(event, callback)
|
95
|
-
end
|
96
|
-
|
97
91
|
# -- inherited from EventEmitter --
|
98
92
|
# @nodoc
|
99
93
|
def once(event, callback)
|
@@ -106,6 +100,12 @@ module Playwright
|
|
106
100
|
event_emitter_proxy.on(event, callback)
|
107
101
|
end
|
108
102
|
|
103
|
+
# -- inherited from EventEmitter --
|
104
|
+
# @nodoc
|
105
|
+
def off(event, callback)
|
106
|
+
event_emitter_proxy.off(event, callback)
|
107
|
+
end
|
108
|
+
|
109
109
|
private def event_emitter_proxy
|
110
110
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
111
111
|
end
|
@@ -2,7 +2,7 @@ module Playwright
|
|
2
2
|
# Locators are the central piece of Playwright's auto-waiting and retry-ability. In a nutshell, locators represent a way
|
3
3
|
# to find element(s) on the page at any moment. Locator can be created with the [`method: Page.locator`] method.
|
4
4
|
#
|
5
|
-
# [Learn more about locators](
|
5
|
+
# [Learn more about locators](../locators.md).
|
6
6
|
class Locator < PlaywrightApi
|
7
7
|
|
8
8
|
# Returns an array of `node.innerText` values for all matching nodes.
|
@@ -39,7 +39,7 @@ module Playwright
|
|
39
39
|
# This method checks the element by performing the following steps:
|
40
40
|
# 1. Ensure that element is a checkbox or a radio input. If not, this method throws. If the element is already checked,
|
41
41
|
# this method returns immediately.
|
42
|
-
# 1. Wait for [actionability](
|
42
|
+
# 1. Wait for [actionability](../actionability.md) checks on the element, unless `force` option is set.
|
43
43
|
# 1. Scroll the element into view if needed.
|
44
44
|
# 1. Use [`property: Page.mouse`] to click in the center of the element.
|
45
45
|
# 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
|
@@ -59,7 +59,7 @@ module Playwright
|
|
59
59
|
end
|
60
60
|
|
61
61
|
# This method clicks the element by performing the following steps:
|
62
|
-
# 1. Wait for [actionability](
|
62
|
+
# 1. Wait for [actionability](../actionability.md) checks on the element, unless `force` option is set.
|
63
63
|
# 1. Scroll the element into view if needed.
|
64
64
|
# 1. Use [`property: Page.mouse`] to click in the center of the element, or the specified `position`.
|
65
65
|
# 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
|
@@ -87,7 +87,7 @@ module Playwright
|
|
87
87
|
end
|
88
88
|
|
89
89
|
# This method double clicks the element by performing the following steps:
|
90
|
-
# 1. Wait for [actionability](
|
90
|
+
# 1. Wait for [actionability](../actionability.md) checks on the element, unless `force` option is set.
|
91
91
|
# 1. Scroll the element into view if needed.
|
92
92
|
# 1. Use [`property: Page.mouse`] to double click in the center of the element, or the specified `position`.
|
93
93
|
# 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set. Note that if the
|
@@ -211,7 +211,7 @@ module Playwright
|
|
211
211
|
wrap_impl(@impl.evaluate_handle(unwrap_impl(expression), arg: unwrap_impl(arg), timeout: unwrap_impl(timeout)))
|
212
212
|
end
|
213
213
|
|
214
|
-
# This method waits for [actionability](
|
214
|
+
# This method waits for [actionability](../actionability.md) checks, focuses the element, fills it and triggers an `input`
|
215
215
|
# event after filling. Note that you can pass an empty string to clear the input field.
|
216
216
|
#
|
217
217
|
# If the target element is not an `<input>`, `<textarea>` or `[contenteditable]` element, this method throws an error.
|
@@ -257,7 +257,7 @@ module Playwright
|
|
257
257
|
end
|
258
258
|
|
259
259
|
# This method hovers over the element by performing the following steps:
|
260
|
-
# 1. Wait for [actionability](
|
260
|
+
# 1. Wait for [actionability](../actionability.md) checks on the element, unless `force` option is set.
|
261
261
|
# 1. Scroll the element into view if needed.
|
262
262
|
# 1. Use [`property: Page.mouse`] to hover over the center of the element, or the specified `position`.
|
263
263
|
# 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
|
@@ -295,27 +295,27 @@ module Playwright
|
|
295
295
|
wrap_impl(@impl.checked?(timeout: unwrap_impl(timeout)))
|
296
296
|
end
|
297
297
|
|
298
|
-
# Returns whether the element is disabled, the opposite of [enabled](
|
298
|
+
# Returns whether the element is disabled, the opposite of [enabled](../actionability.md#enabled).
|
299
299
|
def disabled?(timeout: nil)
|
300
300
|
wrap_impl(@impl.disabled?(timeout: unwrap_impl(timeout)))
|
301
301
|
end
|
302
302
|
|
303
|
-
# Returns whether the element is [editable](
|
303
|
+
# Returns whether the element is [editable](../actionability.md#editable).
|
304
304
|
def editable?(timeout: nil)
|
305
305
|
wrap_impl(@impl.editable?(timeout: unwrap_impl(timeout)))
|
306
306
|
end
|
307
307
|
|
308
|
-
# Returns whether the element is [enabled](
|
308
|
+
# Returns whether the element is [enabled](../actionability.md#enabled).
|
309
309
|
def enabled?(timeout: nil)
|
310
310
|
wrap_impl(@impl.enabled?(timeout: unwrap_impl(timeout)))
|
311
311
|
end
|
312
312
|
|
313
|
-
# Returns whether the element is hidden, the opposite of [visible](
|
313
|
+
# Returns whether the element is hidden, the opposite of [visible](../actionability.md#visible).
|
314
314
|
def hidden?(timeout: nil)
|
315
315
|
wrap_impl(@impl.hidden?(timeout: unwrap_impl(timeout)))
|
316
316
|
end
|
317
317
|
|
318
|
-
# Returns whether the element is [visible](
|
318
|
+
# Returns whether the element is [visible](../actionability.md#visible).
|
319
319
|
def visible?(timeout: nil)
|
320
320
|
wrap_impl(@impl.visible?(timeout: unwrap_impl(timeout)))
|
321
321
|
end
|
@@ -330,7 +330,7 @@ module Playwright
|
|
330
330
|
wrap_impl(@impl.locator(unwrap_impl(selector), has: unwrap_impl(has), hasText: unwrap_impl(hasText)))
|
331
331
|
end
|
332
332
|
|
333
|
-
# Returns locator to the n-th matching element.
|
333
|
+
# Returns locator to the n-th matching element. It's zero based, `nth(0)` selects the first element.
|
334
334
|
def nth(index)
|
335
335
|
wrap_impl(@impl.nth(unwrap_impl(index)))
|
336
336
|
end
|
@@ -364,27 +364,29 @@ module Playwright
|
|
364
364
|
|
365
365
|
# Returns the buffer with the captured screenshot.
|
366
366
|
#
|
367
|
-
# This method waits for the [actionability](
|
367
|
+
# This method waits for the [actionability](../actionability.md) checks, then scrolls element into view before taking a
|
368
368
|
# screenshot. If the element is detached from DOM, the method throws an error.
|
369
369
|
def screenshot(
|
370
370
|
animations: nil,
|
371
|
+
caret: nil,
|
371
372
|
mask: nil,
|
372
373
|
omitBackground: nil,
|
373
374
|
path: nil,
|
374
375
|
quality: nil,
|
376
|
+
scale: nil,
|
375
377
|
timeout: nil,
|
376
378
|
type: nil)
|
377
|
-
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)))
|
379
|
+
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)))
|
378
380
|
end
|
379
381
|
|
380
|
-
# This method waits for [actionability](
|
382
|
+
# This method waits for [actionability](../actionability.md) checks, then tries to scroll element into view, unless it is
|
381
383
|
# completely visible as defined by
|
382
384
|
# [IntersectionObserver](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API)'s `ratio`.
|
383
385
|
def scroll_into_view_if_needed(timeout: nil)
|
384
386
|
wrap_impl(@impl.scroll_into_view_if_needed(timeout: unwrap_impl(timeout)))
|
385
387
|
end
|
386
388
|
|
387
|
-
# This method waits for [actionability](
|
389
|
+
# This method waits for [actionability](../actionability.md) checks, waits until all specified options are present in the
|
388
390
|
# `<select>` element and selects these options.
|
389
391
|
#
|
390
392
|
# If the target element is not a `<select>` element, this method throws an error. However, if the element is inside the
|
@@ -425,7 +427,7 @@ module Playwright
|
|
425
427
|
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)))
|
426
428
|
end
|
427
429
|
|
428
|
-
# This method waits for [actionability](
|
430
|
+
# This method waits for [actionability](../actionability.md) checks, then focuses the element and selects all its text
|
429
431
|
# content.
|
430
432
|
def select_text(force: nil, timeout: nil)
|
431
433
|
wrap_impl(@impl.select_text(force: unwrap_impl(force), timeout: unwrap_impl(timeout)))
|
@@ -434,7 +436,7 @@ module Playwright
|
|
434
436
|
# This method checks or unchecks an element by performing the following steps:
|
435
437
|
# 1. Ensure that matched element is a checkbox or a radio input. If not, this method throws.
|
436
438
|
# 1. If the element already has the right checked state, this method returns immediately.
|
437
|
-
# 1. Wait for [actionability](
|
439
|
+
# 1. Wait for [actionability](../actionability.md) checks on the matched element, unless `force` option is set. If the
|
438
440
|
# element is detached during the checks, the whole action is retried.
|
439
441
|
# 1. Scroll the element into view if needed.
|
440
442
|
# 1. Use [`property: Page.mouse`] to click in the center of the element.
|
@@ -465,7 +467,7 @@ module Playwright
|
|
465
467
|
alias_method :input_files=, :set_input_files
|
466
468
|
|
467
469
|
# This method taps the element by performing the following steps:
|
468
|
-
# 1. Wait for [actionability](
|
470
|
+
# 1. Wait for [actionability](../actionability.md) checks on the element, unless `force` option is set.
|
469
471
|
# 1. Scroll the element into view if needed.
|
470
472
|
# 1. Use [`property: Page.touchscreen`] to tap the center of the element, or the specified `position`.
|
471
473
|
# 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
|
@@ -514,7 +516,7 @@ module Playwright
|
|
514
516
|
# This method checks the element by performing the following steps:
|
515
517
|
# 1. Ensure that element is a checkbox or a radio input. If not, this method throws. If the element is already
|
516
518
|
# unchecked, this method returns immediately.
|
517
|
-
# 1. Wait for [actionability](
|
519
|
+
# 1. Wait for [actionability](../actionability.md) checks on the element, unless `force` option is set.
|
518
520
|
# 1. Scroll the element into view if needed.
|
519
521
|
# 1. Use [`property: Page.mouse`] to click in the center of the element.
|
520
522
|
# 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
|