playwright-ruby-client 1.20.0 → 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/android.rb +2 -1
- data/lib/playwright/channel_owners/android_device.rb +0 -4
- data/lib/playwright/channel_owners/browser_context.rb +11 -2
- 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 +12 -8
- data/lib/playwright/channel_owners/writable_stream.rb +14 -0
- data/lib/playwright/input_files.rb +60 -8
- data/lib/playwright/javascript/value_parser.rb +13 -15
- data/lib/playwright/locator_impl.rb +5 -0
- data/lib/playwright/route_handler.rb +5 -3
- data/lib/playwright/transport.rb +12 -3
- 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 -11
- 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
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
module Playwright
|
|
2
|
-
# `ConsoleMessage` objects are dispatched by page via the [`event: Page.console`] event.
|
|
2
|
+
# `ConsoleMessage` objects are dispatched by page via the [`event: Page.console`] event. For each console messages logged
|
|
3
|
+
# in the page there will be corresponding event in the Playwright context.
|
|
4
|
+
#
|
|
5
|
+
# ```python sync
|
|
6
|
+
# # Listen for all console logs
|
|
7
|
+
# page.on("console", lambda msg: print(msg.text))
|
|
8
|
+
#
|
|
9
|
+
# # Listen for all console events and handle errors
|
|
10
|
+
# page.on("console", lambda msg: print(f"error: {msg.text}") if msg.type == "error" else None)
|
|
11
|
+
#
|
|
12
|
+
# # Get the next console log
|
|
13
|
+
# with page.expect_console_message() as msg_info:
|
|
14
|
+
# # Issue console.log inside the page
|
|
15
|
+
# page.evaluate("console.log('hello', 42, { foo: 'bar' })")
|
|
16
|
+
# msg = msg_info.value
|
|
17
|
+
#
|
|
18
|
+
# # Deconstruct print arguments
|
|
19
|
+
# msg.args[0].json_value() # hello
|
|
20
|
+
# msg.args[1].json_value() # 42
|
|
21
|
+
# ```
|
|
3
22
|
class ConsoleMessage < PlaywrightApi
|
|
4
23
|
|
|
5
24
|
# List of arguments passed to a `console` function call. See also [`event: Page.console`].
|
|
@@ -23,12 +42,6 @@ module Playwright
|
|
|
23
42
|
wrap_impl(@impl.type)
|
|
24
43
|
end
|
|
25
44
|
|
|
26
|
-
# -- inherited from EventEmitter --
|
|
27
|
-
# @nodoc
|
|
28
|
-
def off(event, callback)
|
|
29
|
-
event_emitter_proxy.off(event, callback)
|
|
30
|
-
end
|
|
31
|
-
|
|
32
45
|
# -- inherited from EventEmitter --
|
|
33
46
|
# @nodoc
|
|
34
47
|
def once(event, callback)
|
|
@@ -41,6 +54,12 @@ module Playwright
|
|
|
41
54
|
event_emitter_proxy.on(event, callback)
|
|
42
55
|
end
|
|
43
56
|
|
|
57
|
+
# -- inherited from EventEmitter --
|
|
58
|
+
# @nodoc
|
|
59
|
+
def off(event, callback)
|
|
60
|
+
event_emitter_proxy.off(event, callback)
|
|
61
|
+
end
|
|
62
|
+
|
|
44
63
|
private def event_emitter_proxy
|
|
45
64
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
|
46
65
|
end
|
|
@@ -58,12 +58,6 @@ module Playwright
|
|
|
58
58
|
wrap_impl(@impl.accept_async(promptText: unwrap_impl(promptText)))
|
|
59
59
|
end
|
|
60
60
|
|
|
61
|
-
# -- inherited from EventEmitter --
|
|
62
|
-
# @nodoc
|
|
63
|
-
def off(event, callback)
|
|
64
|
-
event_emitter_proxy.off(event, callback)
|
|
65
|
-
end
|
|
66
|
-
|
|
67
61
|
# -- inherited from EventEmitter --
|
|
68
62
|
# @nodoc
|
|
69
63
|
def once(event, callback)
|
|
@@ -76,6 +70,12 @@ module Playwright
|
|
|
76
70
|
event_emitter_proxy.on(event, callback)
|
|
77
71
|
end
|
|
78
72
|
|
|
73
|
+
# -- inherited from EventEmitter --
|
|
74
|
+
# @nodoc
|
|
75
|
+
def off(event, callback)
|
|
76
|
+
event_emitter_proxy.off(event, callback)
|
|
77
|
+
end
|
|
78
|
+
|
|
79
79
|
private def event_emitter_proxy
|
|
80
80
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
|
81
81
|
end
|
|
@@ -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
|