playwright-ruby-client 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/api_coverage.md +102 -49
- data/lib/playwright.rb +1 -0
- data/lib/playwright/channel.rb +10 -10
- data/lib/playwright/channel_owners/binding_call.rb +3 -0
- data/lib/playwright/channel_owners/browser_context.rb +149 -3
- data/lib/playwright/channel_owners/dialog.rb +28 -0
- data/lib/playwright/channel_owners/page.rb +47 -10
- data/lib/playwright/channel_owners/playwright.rb +4 -0
- data/lib/playwright/channel_owners/request.rb +26 -2
- data/lib/playwright/channel_owners/response.rb +60 -0
- data/lib/playwright/channel_owners/route.rb +78 -0
- data/lib/playwright/channel_owners/selectors.rb +19 -1
- data/lib/playwright/route_handler_entry.rb +36 -0
- data/lib/playwright/utils.rb +1 -0
- data/lib/playwright/version.rb +1 -1
- data/lib/playwright_api/android.rb +80 -8
- data/lib/playwright_api/android_device.rb +145 -28
- data/lib/playwright_api/android_input.rb +17 -13
- data/lib/playwright_api/android_socket.rb +16 -0
- data/lib/playwright_api/android_web_view.rb +21 -0
- data/lib/playwright_api/binding_call.rb +11 -6
- data/lib/playwright_api/browser.rb +6 -6
- data/lib/playwright_api/browser_context.rb +33 -28
- data/lib/playwright_api/browser_type.rb +14 -14
- data/lib/playwright_api/chromium_browser_context.rb +6 -6
- data/lib/playwright_api/console_message.rb +6 -6
- data/lib/playwright_api/dialog.rb +32 -5
- data/lib/playwright_api/download.rb +6 -6
- data/lib/playwright_api/element_handle.rb +6 -6
- data/lib/playwright_api/file_chooser.rb +1 -1
- data/lib/playwright_api/frame.rb +13 -11
- data/lib/playwright_api/js_handle.rb +6 -6
- data/lib/playwright_api/page.rb +48 -46
- data/lib/playwright_api/playwright.rb +7 -7
- data/lib/playwright_api/request.rb +8 -8
- data/lib/playwright_api/response.rb +27 -17
- data/lib/playwright_api/route.rb +27 -5
- data/lib/playwright_api/selectors.rb +7 -7
- metadata +7 -2
@@ -77,19 +77,19 @@ module Playwright
|
|
77
77
|
# )
|
78
78
|
# ```
|
79
79
|
#
|
80
|
-
# > **Chromium-only** Playwright can also be used to control the Chrome
|
81
|
-
# Chromium it is bundled with. There is no guarantee it will work with any other version. Use
|
82
|
-
# extreme caution.
|
80
|
+
# > **Chromium-only** Playwright can also be used to control the Google Chrome or Microsoft Edge browsers, but it works
|
81
|
+
# best with the version of Chromium it is bundled with. There is no guarantee it will work with any other version. Use
|
82
|
+
# `executablePath` option with extreme caution.
|
83
83
|
# >
|
84
84
|
# > If Google Chrome (rather than Chromium) is preferred, a
|
85
85
|
# [Chrome Canary](https://www.google.com/chrome/browser/canary.html) or
|
86
86
|
# [Dev Channel](https://www.chromium.org/getting-involved/dev-channel) build is suggested.
|
87
87
|
# >
|
88
|
-
# >
|
89
|
-
#
|
90
|
-
#
|
91
|
-
#
|
92
|
-
# [
|
88
|
+
# > Stock browsers like Google Chrome and Microsoft Edge are suitable for tests that require proprietary media codecs for
|
89
|
+
# video playback. See
|
90
|
+
# [this article](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for other
|
91
|
+
# differences between Chromium and Chrome.
|
92
|
+
# [This article](https://chromium.googlesource.com/chromium/src/+/lkgr/docs/chromium_browser_vs_google_chrome.md)
|
93
93
|
# describes some differences for Linux users.
|
94
94
|
def launch(
|
95
95
|
args: nil,
|
@@ -163,20 +163,20 @@ module Playwright
|
|
163
163
|
|
164
164
|
# -- inherited from EventEmitter --
|
165
165
|
# @nodoc
|
166
|
-
def
|
167
|
-
event_emitter_proxy.
|
166
|
+
def off(event, callback)
|
167
|
+
event_emitter_proxy.off(event, callback)
|
168
168
|
end
|
169
169
|
|
170
170
|
# -- inherited from EventEmitter --
|
171
171
|
# @nodoc
|
172
|
-
def
|
173
|
-
event_emitter_proxy.
|
172
|
+
def once(event, callback)
|
173
|
+
event_emitter_proxy.once(event, callback)
|
174
174
|
end
|
175
175
|
|
176
176
|
# -- inherited from EventEmitter --
|
177
177
|
# @nodoc
|
178
|
-
def
|
179
|
-
event_emitter_proxy.
|
178
|
+
def on(event, callback)
|
179
|
+
event_emitter_proxy.on(event, callback)
|
180
180
|
end
|
181
181
|
|
182
182
|
private def event_emitter_proxy
|
@@ -36,20 +36,20 @@ module Playwright
|
|
36
36
|
|
37
37
|
# -- inherited from EventEmitter --
|
38
38
|
# @nodoc
|
39
|
-
def
|
40
|
-
event_emitter_proxy.
|
39
|
+
def off(event, callback)
|
40
|
+
event_emitter_proxy.off(event, callback)
|
41
41
|
end
|
42
42
|
|
43
43
|
# -- inherited from EventEmitter --
|
44
44
|
# @nodoc
|
45
|
-
def
|
46
|
-
event_emitter_proxy.
|
45
|
+
def once(event, callback)
|
46
|
+
event_emitter_proxy.once(event, callback)
|
47
47
|
end
|
48
48
|
|
49
49
|
# -- inherited from EventEmitter --
|
50
50
|
# @nodoc
|
51
|
-
def
|
52
|
-
event_emitter_proxy.
|
51
|
+
def on(event, callback)
|
52
|
+
event_emitter_proxy.on(event, callback)
|
53
53
|
end
|
54
54
|
|
55
55
|
private def event_emitter_proxy
|
@@ -23,20 +23,20 @@ module Playwright
|
|
23
23
|
|
24
24
|
# -- inherited from EventEmitter --
|
25
25
|
# @nodoc
|
26
|
-
def
|
27
|
-
event_emitter_proxy.
|
26
|
+
def off(event, callback)
|
27
|
+
event_emitter_proxy.off(event, callback)
|
28
28
|
end
|
29
29
|
|
30
30
|
# -- inherited from EventEmitter --
|
31
31
|
# @nodoc
|
32
|
-
def
|
33
|
-
event_emitter_proxy.
|
32
|
+
def once(event, callback)
|
33
|
+
event_emitter_proxy.once(event, callback)
|
34
34
|
end
|
35
35
|
|
36
36
|
# -- inherited from EventEmitter --
|
37
37
|
# @nodoc
|
38
|
-
def
|
39
|
-
event_emitter_proxy.
|
38
|
+
def on(event, callback)
|
39
|
+
event_emitter_proxy.on(event, callback)
|
40
40
|
end
|
41
41
|
|
42
42
|
private def event_emitter_proxy
|
@@ -68,27 +68,54 @@ module Playwright
|
|
68
68
|
|
69
69
|
# Returns when the dialog has been accepted.
|
70
70
|
def accept(promptText: nil)
|
71
|
-
|
71
|
+
wrap_impl(@impl.accept(promptText: unwrap_impl(promptText)))
|
72
72
|
end
|
73
73
|
|
74
74
|
# If dialog is prompt, returns default prompt value. Otherwise, returns empty string.
|
75
75
|
def default_value
|
76
|
-
|
76
|
+
wrap_impl(@impl.default_value)
|
77
77
|
end
|
78
78
|
|
79
79
|
# Returns when the dialog has been dismissed.
|
80
80
|
def dismiss
|
81
|
-
|
81
|
+
wrap_impl(@impl.dismiss)
|
82
82
|
end
|
83
83
|
|
84
84
|
# A message displayed in the dialog.
|
85
85
|
def message
|
86
|
-
|
86
|
+
wrap_impl(@impl.message)
|
87
87
|
end
|
88
88
|
|
89
89
|
# Returns dialog's type, can be one of `alert`, `beforeunload`, `confirm` or `prompt`.
|
90
90
|
def type
|
91
|
-
|
91
|
+
wrap_impl(@impl.type)
|
92
|
+
end
|
93
|
+
|
94
|
+
# @nodoc
|
95
|
+
def accept_async(promptText: nil)
|
96
|
+
wrap_impl(@impl.accept_async(promptText: unwrap_impl(promptText)))
|
97
|
+
end
|
98
|
+
|
99
|
+
# -- inherited from EventEmitter --
|
100
|
+
# @nodoc
|
101
|
+
def off(event, callback)
|
102
|
+
event_emitter_proxy.off(event, callback)
|
103
|
+
end
|
104
|
+
|
105
|
+
# -- inherited from EventEmitter --
|
106
|
+
# @nodoc
|
107
|
+
def once(event, callback)
|
108
|
+
event_emitter_proxy.once(event, callback)
|
109
|
+
end
|
110
|
+
|
111
|
+
# -- inherited from EventEmitter --
|
112
|
+
# @nodoc
|
113
|
+
def on(event, callback)
|
114
|
+
event_emitter_proxy.on(event, callback)
|
115
|
+
end
|
116
|
+
|
117
|
+
private def event_emitter_proxy
|
118
|
+
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
92
119
|
end
|
93
120
|
end
|
94
121
|
end
|
@@ -72,20 +72,20 @@ module Playwright
|
|
72
72
|
|
73
73
|
# -- inherited from EventEmitter --
|
74
74
|
# @nodoc
|
75
|
-
def
|
76
|
-
event_emitter_proxy.
|
75
|
+
def off(event, callback)
|
76
|
+
event_emitter_proxy.off(event, callback)
|
77
77
|
end
|
78
78
|
|
79
79
|
# -- inherited from EventEmitter --
|
80
80
|
# @nodoc
|
81
|
-
def
|
82
|
-
event_emitter_proxy.
|
81
|
+
def once(event, callback)
|
82
|
+
event_emitter_proxy.once(event, callback)
|
83
83
|
end
|
84
84
|
|
85
85
|
# -- inherited from EventEmitter --
|
86
86
|
# @nodoc
|
87
|
-
def
|
88
|
-
event_emitter_proxy.
|
87
|
+
def on(event, callback)
|
88
|
+
event_emitter_proxy.on(event, callback)
|
89
89
|
end
|
90
90
|
|
91
91
|
private def event_emitter_proxy
|
@@ -635,20 +635,20 @@ module Playwright
|
|
635
635
|
|
636
636
|
# -- inherited from EventEmitter --
|
637
637
|
# @nodoc
|
638
|
-
def
|
639
|
-
event_emitter_proxy.
|
638
|
+
def off(event, callback)
|
639
|
+
event_emitter_proxy.off(event, callback)
|
640
640
|
end
|
641
641
|
|
642
642
|
# -- inherited from EventEmitter --
|
643
643
|
# @nodoc
|
644
|
-
def
|
645
|
-
event_emitter_proxy.
|
644
|
+
def once(event, callback)
|
645
|
+
event_emitter_proxy.once(event, callback)
|
646
646
|
end
|
647
647
|
|
648
648
|
# -- inherited from EventEmitter --
|
649
649
|
# @nodoc
|
650
|
-
def
|
651
|
-
event_emitter_proxy.
|
650
|
+
def on(event, callback)
|
651
|
+
event_emitter_proxy.on(event, callback)
|
652
652
|
end
|
653
653
|
|
654
654
|
private def event_emitter_proxy
|
data/lib/playwright_api/frame.rb
CHANGED
@@ -3,10 +3,10 @@ module Playwright
|
|
3
3
|
# [`method: Frame.childFrames`] methods.
|
4
4
|
#
|
5
5
|
# `Frame` object's lifecycle is controlled by three events, dispatched on the page object:
|
6
|
-
# - [`event: Page.
|
6
|
+
# - [`event: Page.frameAttached`] - fired when the frame gets attached to the page. A Frame can be attached to the page
|
7
7
|
# only once.
|
8
|
-
# - [`event: Page.
|
9
|
-
# - [`event: Page.
|
8
|
+
# - [`event: Page.frameNavigated`] - fired when the frame commits navigation to a different URL.
|
9
|
+
# - [`event: Page.frameDetached`] - fired when the frame gets detached from the page. A Frame can be detached from the
|
10
10
|
# page only once.
|
11
11
|
#
|
12
12
|
# An example of dumping frame tree:
|
@@ -539,12 +539,14 @@ module Playwright
|
|
539
539
|
wrap_impl(@impl.enabled?(unwrap_impl(selector), timeout: unwrap_impl(timeout)))
|
540
540
|
end
|
541
541
|
|
542
|
-
# Returns whether the element is hidden, the opposite of [visible](./actionability.md#visible).
|
542
|
+
# Returns whether the element is hidden, the opposite of [visible](./actionability.md#visible). `selector` that does not
|
543
|
+
# match any elements is considered hidden.
|
543
544
|
def hidden?(selector, timeout: nil)
|
544
545
|
wrap_impl(@impl.hidden?(unwrap_impl(selector), timeout: unwrap_impl(timeout)))
|
545
546
|
end
|
546
547
|
|
547
|
-
# Returns whether the element is [visible](./actionability.md#visible).
|
548
|
+
# Returns whether the element is [visible](./actionability.md#visible). `selector` that does not match any elements is
|
549
|
+
# considered not visible.
|
548
550
|
def visible?(selector, timeout: nil)
|
549
551
|
wrap_impl(@impl.visible?(unwrap_impl(selector), timeout: unwrap_impl(timeout)))
|
550
552
|
end
|
@@ -962,20 +964,20 @@ module Playwright
|
|
962
964
|
|
963
965
|
# -- inherited from EventEmitter --
|
964
966
|
# @nodoc
|
965
|
-
def
|
966
|
-
event_emitter_proxy.
|
967
|
+
def off(event, callback)
|
968
|
+
event_emitter_proxy.off(event, callback)
|
967
969
|
end
|
968
970
|
|
969
971
|
# -- inherited from EventEmitter --
|
970
972
|
# @nodoc
|
971
|
-
def
|
972
|
-
event_emitter_proxy.
|
973
|
+
def once(event, callback)
|
974
|
+
event_emitter_proxy.once(event, callback)
|
973
975
|
end
|
974
976
|
|
975
977
|
# -- inherited from EventEmitter --
|
976
978
|
# @nodoc
|
977
|
-
def
|
978
|
-
event_emitter_proxy.
|
979
|
+
def on(event, callback)
|
980
|
+
event_emitter_proxy.on(event, callback)
|
979
981
|
end
|
980
982
|
|
981
983
|
private def event_emitter_proxy
|
@@ -124,20 +124,20 @@ module Playwright
|
|
124
124
|
|
125
125
|
# -- inherited from EventEmitter --
|
126
126
|
# @nodoc
|
127
|
-
def
|
128
|
-
event_emitter_proxy.
|
127
|
+
def off(event, callback)
|
128
|
+
event_emitter_proxy.off(event, callback)
|
129
129
|
end
|
130
130
|
|
131
131
|
# -- inherited from EventEmitter --
|
132
132
|
# @nodoc
|
133
|
-
def
|
134
|
-
event_emitter_proxy.
|
133
|
+
def once(event, callback)
|
134
|
+
event_emitter_proxy.once(event, callback)
|
135
135
|
end
|
136
136
|
|
137
137
|
# -- inherited from EventEmitter --
|
138
138
|
# @nodoc
|
139
|
-
def
|
140
|
-
event_emitter_proxy.
|
139
|
+
def on(event, callback)
|
140
|
+
event_emitter_proxy.on(event, callback)
|
141
141
|
end
|
142
142
|
|
143
143
|
private def event_emitter_proxy
|
data/lib/playwright_api/page.rb
CHANGED
@@ -984,12 +984,14 @@ module Playwright
|
|
984
984
|
wrap_impl(@impl.enabled?(unwrap_impl(selector), timeout: unwrap_impl(timeout)))
|
985
985
|
end
|
986
986
|
|
987
|
-
# Returns whether the element is hidden, the opposite of [visible](./actionability.md#visible).
|
987
|
+
# Returns whether the element is hidden, the opposite of [visible](./actionability.md#visible). `selector` that does not
|
988
|
+
# match any elements is considered hidden.
|
988
989
|
def hidden?(selector, timeout: nil)
|
989
990
|
wrap_impl(@impl.hidden?(unwrap_impl(selector), timeout: unwrap_impl(timeout)))
|
990
991
|
end
|
991
992
|
|
992
|
-
# Returns whether the element is [visible](./actionability.md#visible).
|
993
|
+
# Returns whether the element is [visible](./actionability.md#visible). `selector` that does not match any elements is
|
994
|
+
# considered not visible.
|
993
995
|
def visible?(selector, timeout: nil)
|
994
996
|
wrap_impl(@impl.visible?(unwrap_impl(selector), timeout: unwrap_impl(timeout)))
|
995
997
|
end
|
@@ -1010,7 +1012,7 @@ module Playwright
|
|
1010
1012
|
# User can inspect selectors or perform manual steps while paused. Resume will continue running the original script from
|
1011
1013
|
# the place it was paused.
|
1012
1014
|
#
|
1013
|
-
# > NOTE: This method requires Playwright to be started in a headed mode, with a falsy
|
1015
|
+
# > NOTE: This method requires Playwright to be started in a headed mode, with a falsy `headless` value in the
|
1014
1016
|
# [`method: BrowserType.launch`].
|
1015
1017
|
def pause
|
1016
1018
|
raise NotImplementedError.new('pause is not implemented yet.')
|
@@ -1236,7 +1238,7 @@ module Playwright
|
|
1236
1238
|
#
|
1237
1239
|
# > NOTE: Enabling routing disables http cache.
|
1238
1240
|
def route(url, handler)
|
1239
|
-
|
1241
|
+
wrap_impl(@impl.route(unwrap_impl(url), unwrap_impl(handler)))
|
1240
1242
|
end
|
1241
1243
|
|
1242
1244
|
# Returns the buffer with the captured screenshot.
|
@@ -1467,7 +1469,7 @@ module Playwright
|
|
1467
1469
|
|
1468
1470
|
# Removes a route created with [`method: Page.route`]. When `handler` is not specified, removes all routes for the `url`.
|
1469
1471
|
def unroute(url, handler: nil)
|
1470
|
-
|
1472
|
+
wrap_impl(@impl.unroute(unwrap_impl(url), handler: unwrap_impl(handler)))
|
1471
1473
|
end
|
1472
1474
|
|
1473
1475
|
# Shortcut for main frame's [`method: Frame.url`].
|
@@ -1484,6 +1486,20 @@ module Playwright
|
|
1484
1486
|
wrap_impl(@impl.viewport_size)
|
1485
1487
|
end
|
1486
1488
|
|
1489
|
+
# Performs action and waits for a [ConoleMessage] to be logged by in the page. If predicate is provided, it passes
|
1490
|
+
# `ConsoleMessage` value into the `predicate` function and waits for `predicate(message)` to return a truthy value. Will
|
1491
|
+
# throw an error if the page is closed before the console event is fired.
|
1492
|
+
def expect_console_message(predicate: nil, timeout: nil, &block)
|
1493
|
+
wrap_impl(@impl.expect_console_message(predicate: unwrap_impl(predicate), timeout: unwrap_impl(timeout), &wrap_block_call(block)))
|
1494
|
+
end
|
1495
|
+
|
1496
|
+
# Performs action and waits for a new `Download`. If predicate is provided, it passes `Download` value into the
|
1497
|
+
# `predicate` function and waits for `predicate(download)` to return a truthy value. Will throw an error if the page is
|
1498
|
+
# closed before the download event is fired.
|
1499
|
+
def expect_download(predicate: nil, timeout: nil, &block)
|
1500
|
+
wrap_impl(@impl.expect_download(predicate: unwrap_impl(predicate), timeout: unwrap_impl(timeout), &wrap_block_call(block)))
|
1501
|
+
end
|
1502
|
+
|
1487
1503
|
# Waits for event to fire and passes its value into the predicate function. Returns when the predicate returns truthy
|
1488
1504
|
# value. Will throw an error if the page is closed before the event is fired. Returns the event data value.
|
1489
1505
|
#
|
@@ -1510,6 +1526,13 @@ module Playwright
|
|
1510
1526
|
wrap_impl(@impl.expect_event(unwrap_impl(event), predicate: unwrap_impl(predicate), timeout: unwrap_impl(timeout), &wrap_block_call(block)))
|
1511
1527
|
end
|
1512
1528
|
|
1529
|
+
# Performs action and waits for a new `FileChooser` to be created. If predicate is provided, it passes `FileChooser` value
|
1530
|
+
# into the `predicate` function and waits for `predicate(fileChooser)` to return a truthy value. Will throw an error if
|
1531
|
+
# the page is closed before the file chooser is opened.
|
1532
|
+
def expect_file_chooser(predicate: nil, timeout: nil, &block)
|
1533
|
+
wrap_impl(@impl.expect_file_chooser(predicate: unwrap_impl(predicate), timeout: unwrap_impl(timeout), &wrap_block_call(block)))
|
1534
|
+
end
|
1535
|
+
|
1513
1536
|
# Returns when the `expression` returns a truthy value. It resolves to a JSHandle of the truthy value.
|
1514
1537
|
#
|
1515
1538
|
# The [`method: Page.waitForFunction`] can be used to observe viewport size change:
|
@@ -1674,6 +1697,13 @@ module Playwright
|
|
1674
1697
|
wrap_impl(@impl.expect_navigation(timeout: unwrap_impl(timeout), url: unwrap_impl(url), waitUntil: unwrap_impl(waitUntil), &wrap_block_call(block)))
|
1675
1698
|
end
|
1676
1699
|
|
1700
|
+
# Performs action and waits for a popup `Page`. If predicate is provided, it passes [Popup] value into the `predicate`
|
1701
|
+
# function and waits for `predicate(page)` to return a truthy value. Will throw an error if the page is closed before the
|
1702
|
+
# popup event is fired.
|
1703
|
+
def expect_popup(predicate: nil, timeout: nil, &block)
|
1704
|
+
wrap_impl(@impl.expect_popup(predicate: unwrap_impl(predicate), timeout: unwrap_impl(timeout), &wrap_block_call(block)))
|
1705
|
+
end
|
1706
|
+
|
1677
1707
|
# Waits for the matching request and returns it.
|
1678
1708
|
#
|
1679
1709
|
#
|
@@ -1826,6 +1856,13 @@ module Playwright
|
|
1826
1856
|
raise NotImplementedError.new('wait_for_timeout is not implemented yet.')
|
1827
1857
|
end
|
1828
1858
|
|
1859
|
+
# Performs action and waits for a new `Worker`. If predicate is provided, it passes `Worker` value into the `predicate`
|
1860
|
+
# function and waits for `predicate(worker)` to return a truthy value. Will throw an error if the page is closed before
|
1861
|
+
# the worker event is fired.
|
1862
|
+
def expect_worker(predicate: nil, timeout: nil)
|
1863
|
+
raise NotImplementedError.new('expect_worker is not implemented yet.')
|
1864
|
+
end
|
1865
|
+
|
1829
1866
|
# This method returns all of the dedicated [WebWorkers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API)
|
1830
1867
|
# associated with the page.
|
1831
1868
|
#
|
@@ -1834,41 +1871,6 @@ module Playwright
|
|
1834
1871
|
raise NotImplementedError.new('workers is not implemented yet.')
|
1835
1872
|
end
|
1836
1873
|
|
1837
|
-
# Performs action and waits for `download` event to fire. If predicate is provided, it passes `Download` value into the
|
1838
|
-
# `predicate` function and waits for `predicate(event)` to return a truthy value. Will throw an error if the page is
|
1839
|
-
# closed before the download event is fired.
|
1840
|
-
def expect_download(predicate: nil, timeout: nil, &block)
|
1841
|
-
wrap_impl(@impl.expect_download(predicate: unwrap_impl(predicate), timeout: unwrap_impl(timeout), &wrap_block_call(block)))
|
1842
|
-
end
|
1843
|
-
|
1844
|
-
# Performs action and waits for `popup` event to fire. If predicate is provided, it passes [Popup] value into the
|
1845
|
-
# `predicate` function and waits for `predicate(event)` to return a truthy value. Will throw an error if the page is
|
1846
|
-
# closed before the popup event is fired.
|
1847
|
-
def expect_popup(predicate: nil, timeout: nil, &block)
|
1848
|
-
wrap_impl(@impl.expect_popup(predicate: unwrap_impl(predicate), timeout: unwrap_impl(timeout), &wrap_block_call(block)))
|
1849
|
-
end
|
1850
|
-
|
1851
|
-
# Performs action and waits for `worker` event to fire. If predicate is provided, it passes `Worker` value into the
|
1852
|
-
# `predicate` function and waits for `predicate(event)` to return a truthy value. Will throw an error if the page is
|
1853
|
-
# closed before the worker event is fired.
|
1854
|
-
def expect_worker(predicate: nil, timeout: nil)
|
1855
|
-
raise NotImplementedError.new('expect_worker is not implemented yet.')
|
1856
|
-
end
|
1857
|
-
|
1858
|
-
# Performs action and waits for `console` event to fire. If predicate is provided, it passes `ConsoleMessage` value into
|
1859
|
-
# the `predicate` function and waits for `predicate(event)` to return a truthy value. Will throw an error if the page is
|
1860
|
-
# closed before the worker event is fired.
|
1861
|
-
def expect_console_message(predicate: nil, timeout: nil, &block)
|
1862
|
-
wrap_impl(@impl.expect_console_message(predicate: unwrap_impl(predicate), timeout: unwrap_impl(timeout), &wrap_block_call(block)))
|
1863
|
-
end
|
1864
|
-
|
1865
|
-
# Performs action and waits for `filechooser` event to fire. If predicate is provided, it passes `FileChooser` value into
|
1866
|
-
# the `predicate` function and waits for `predicate(event)` to return a truthy value. Will throw an error if the page is
|
1867
|
-
# closed before the worker event is fired.
|
1868
|
-
def expect_file_chooser(predicate: nil, timeout: nil, &block)
|
1869
|
-
wrap_impl(@impl.expect_file_chooser(predicate: unwrap_impl(predicate), timeout: unwrap_impl(timeout), &wrap_block_call(block)))
|
1870
|
-
end
|
1871
|
-
|
1872
1874
|
# > NOTE: In most cases, you should use [`method: Page.waitForEvent`].
|
1873
1875
|
#
|
1874
1876
|
# Waits for given `event` to fire. If predicate is provided, it passes event's value into the `predicate` function and
|
@@ -1885,20 +1887,20 @@ module Playwright
|
|
1885
1887
|
|
1886
1888
|
# -- inherited from EventEmitter --
|
1887
1889
|
# @nodoc
|
1888
|
-
def
|
1889
|
-
event_emitter_proxy.
|
1890
|
+
def off(event, callback)
|
1891
|
+
event_emitter_proxy.off(event, callback)
|
1890
1892
|
end
|
1891
1893
|
|
1892
1894
|
# -- inherited from EventEmitter --
|
1893
1895
|
# @nodoc
|
1894
|
-
def
|
1895
|
-
event_emitter_proxy.
|
1896
|
+
def once(event, callback)
|
1897
|
+
event_emitter_proxy.once(event, callback)
|
1896
1898
|
end
|
1897
1899
|
|
1898
1900
|
# -- inherited from EventEmitter --
|
1899
1901
|
# @nodoc
|
1900
|
-
def
|
1901
|
-
event_emitter_proxy.
|
1902
|
+
def on(event, callback)
|
1903
|
+
event_emitter_proxy.on(event, callback)
|
1902
1904
|
end
|
1903
1905
|
|
1904
1906
|
private def event_emitter_proxy
|