playwright-ruby-client 0.6.6 → 0.8.1
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/README.md +26 -0
- data/documentation/docs/api/browser.md +18 -2
- data/documentation/docs/api/browser_context.md +10 -0
- data/documentation/docs/api/browser_type.md +1 -0
- data/documentation/docs/api/cdp_session.md +41 -1
- data/documentation/docs/api/element_handle.md +11 -2
- data/documentation/docs/api/experimental/android_device.md +1 -0
- data/documentation/docs/api/frame.md +29 -1
- data/documentation/docs/api/keyboard.md +11 -20
- data/documentation/docs/api/page.md +48 -2
- data/documentation/docs/api/response.md +16 -0
- data/documentation/docs/api/web_socket.md +37 -0
- data/documentation/docs/article/guides/launch_browser.md +2 -0
- data/documentation/docs/article/guides/playwright_on_alpine_linux.md +91 -0
- data/documentation/docs/article/guides/rails_integration.md +1 -1
- data/documentation/docs/article/guides/semi_automation.md +71 -0
- data/documentation/docs/include/api_coverage.md +18 -11
- data/lib/playwright.rb +36 -3
- data/lib/playwright/channel_owners/artifact.rb +4 -0
- data/lib/playwright/channel_owners/browser.rb +5 -0
- data/lib/playwright/channel_owners/browser_context.rb +12 -3
- data/lib/playwright/channel_owners/cdp_session.rb +19 -0
- data/lib/playwright/channel_owners/element_handle.rb +11 -4
- data/lib/playwright/channel_owners/frame.rb +36 -4
- data/lib/playwright/channel_owners/page.rb +45 -16
- data/lib/playwright/channel_owners/response.rb +9 -1
- data/lib/playwright/channel_owners/web_socket.rb +83 -0
- data/lib/playwright/connection.rb +2 -4
- data/lib/playwright/download.rb +4 -0
- data/lib/playwright/route_handler_entry.rb +3 -2
- data/lib/playwright/transport.rb +0 -1
- data/lib/playwright/url_matcher.rb +12 -2
- data/lib/playwright/version.rb +2 -2
- data/lib/playwright/web_socket_client.rb +164 -0
- data/lib/playwright/web_socket_transport.rb +104 -0
- data/lib/playwright_api/android.rb +6 -6
- data/lib/playwright_api/android_device.rb +10 -9
- data/lib/playwright_api/browser.rb +17 -11
- data/lib/playwright_api/browser_context.rb +7 -7
- data/lib/playwright_api/browser_type.rb +8 -7
- data/lib/playwright_api/cdp_session.rb +30 -8
- data/lib/playwright_api/console_message.rb +6 -6
- data/lib/playwright_api/dialog.rb +6 -6
- data/lib/playwright_api/element_handle.rb +17 -11
- data/lib/playwright_api/frame.rb +30 -9
- data/lib/playwright_api/js_handle.rb +6 -6
- data/lib/playwright_api/page.rb +39 -18
- data/lib/playwright_api/playwright.rb +6 -6
- data/lib/playwright_api/request.rb +6 -6
- data/lib/playwright_api/response.rb +15 -10
- data/lib/playwright_api/route.rb +6 -6
- data/lib/playwright_api/selectors.rb +6 -6
- data/lib/playwright_api/web_socket.rb +12 -12
- data/lib/playwright_api/worker.rb +6 -6
- data/playwright.gemspec +2 -1
- metadata +37 -18
@@ -204,7 +204,7 @@ module Playwright
|
|
204
204
|
#
|
205
205
|
# Returns the newly created session.
|
206
206
|
def new_cdp_session(page)
|
207
|
-
|
207
|
+
wrap_impl(@impl.new_cdp_session(unwrap_impl(page)))
|
208
208
|
end
|
209
209
|
|
210
210
|
# Creates a new page in the browser context.
|
@@ -384,20 +384,20 @@ module Playwright
|
|
384
384
|
|
385
385
|
# -- inherited from EventEmitter --
|
386
386
|
# @nodoc
|
387
|
-
def
|
388
|
-
event_emitter_proxy.
|
387
|
+
def off(event, callback)
|
388
|
+
event_emitter_proxy.off(event, callback)
|
389
389
|
end
|
390
390
|
|
391
391
|
# -- inherited from EventEmitter --
|
392
392
|
# @nodoc
|
393
|
-
def
|
394
|
-
event_emitter_proxy.
|
393
|
+
def once(event, callback)
|
394
|
+
event_emitter_proxy.once(event, callback)
|
395
395
|
end
|
396
396
|
|
397
397
|
# -- inherited from EventEmitter --
|
398
398
|
# @nodoc
|
399
|
-
def
|
400
|
-
event_emitter_proxy.
|
399
|
+
def on(event, callback)
|
400
|
+
event_emitter_proxy.on(event, callback)
|
401
401
|
end
|
402
402
|
|
403
403
|
private def event_emitter_proxy
|
@@ -96,6 +96,7 @@ module Playwright
|
|
96
96
|
userDataDir,
|
97
97
|
acceptDownloads: nil,
|
98
98
|
args: nil,
|
99
|
+
baseURL: nil,
|
99
100
|
bypassCSP: nil,
|
100
101
|
channel: nil,
|
101
102
|
chromiumSandbox: nil,
|
@@ -135,7 +136,7 @@ module Playwright
|
|
135
136
|
userAgent: nil,
|
136
137
|
viewport: nil,
|
137
138
|
&block)
|
138
|
-
wrap_impl(@impl.launch_persistent_context(unwrap_impl(userDataDir), acceptDownloads: unwrap_impl(acceptDownloads), args: unwrap_impl(args), bypassCSP: unwrap_impl(bypassCSP), channel: unwrap_impl(channel), chromiumSandbox: unwrap_impl(chromiumSandbox), colorScheme: unwrap_impl(colorScheme), deviceScaleFactor: unwrap_impl(deviceScaleFactor), devtools: unwrap_impl(devtools), downloadsPath: unwrap_impl(downloadsPath), env: unwrap_impl(env), executablePath: unwrap_impl(executablePath), extraHTTPHeaders: unwrap_impl(extraHTTPHeaders), geolocation: unwrap_impl(geolocation), handleSIGHUP: unwrap_impl(handleSIGHUP), handleSIGINT: unwrap_impl(handleSIGINT), handleSIGTERM: unwrap_impl(handleSIGTERM), hasTouch: unwrap_impl(hasTouch), headless: unwrap_impl(headless), httpCredentials: unwrap_impl(httpCredentials), ignoreDefaultArgs: unwrap_impl(ignoreDefaultArgs), ignoreHTTPSErrors: unwrap_impl(ignoreHTTPSErrors), isMobile: unwrap_impl(isMobile), javaScriptEnabled: unwrap_impl(javaScriptEnabled), locale: unwrap_impl(locale), noViewport: unwrap_impl(noViewport), offline: unwrap_impl(offline), permissions: unwrap_impl(permissions), proxy: unwrap_impl(proxy), record_har_omit_content: unwrap_impl(record_har_omit_content), record_har_path: unwrap_impl(record_har_path), record_video_dir: unwrap_impl(record_video_dir), record_video_size: unwrap_impl(record_video_size), reducedMotion: unwrap_impl(reducedMotion), screen: unwrap_impl(screen), slowMo: unwrap_impl(slowMo), timeout: unwrap_impl(timeout), timezoneId: unwrap_impl(timezoneId), tracesDir: unwrap_impl(tracesDir), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
|
139
|
+
wrap_impl(@impl.launch_persistent_context(unwrap_impl(userDataDir), acceptDownloads: unwrap_impl(acceptDownloads), args: unwrap_impl(args), baseURL: unwrap_impl(baseURL), bypassCSP: unwrap_impl(bypassCSP), channel: unwrap_impl(channel), chromiumSandbox: unwrap_impl(chromiumSandbox), colorScheme: unwrap_impl(colorScheme), deviceScaleFactor: unwrap_impl(deviceScaleFactor), devtools: unwrap_impl(devtools), downloadsPath: unwrap_impl(downloadsPath), env: unwrap_impl(env), executablePath: unwrap_impl(executablePath), extraHTTPHeaders: unwrap_impl(extraHTTPHeaders), geolocation: unwrap_impl(geolocation), handleSIGHUP: unwrap_impl(handleSIGHUP), handleSIGINT: unwrap_impl(handleSIGINT), handleSIGTERM: unwrap_impl(handleSIGTERM), hasTouch: unwrap_impl(hasTouch), headless: unwrap_impl(headless), httpCredentials: unwrap_impl(httpCredentials), ignoreDefaultArgs: unwrap_impl(ignoreDefaultArgs), ignoreHTTPSErrors: unwrap_impl(ignoreHTTPSErrors), isMobile: unwrap_impl(isMobile), javaScriptEnabled: unwrap_impl(javaScriptEnabled), locale: unwrap_impl(locale), noViewport: unwrap_impl(noViewport), offline: unwrap_impl(offline), permissions: unwrap_impl(permissions), proxy: unwrap_impl(proxy), record_har_omit_content: unwrap_impl(record_har_omit_content), record_har_path: unwrap_impl(record_har_path), record_video_dir: unwrap_impl(record_video_dir), record_video_size: unwrap_impl(record_video_size), reducedMotion: unwrap_impl(reducedMotion), screen: unwrap_impl(screen), slowMo: unwrap_impl(slowMo), timeout: unwrap_impl(timeout), timezoneId: unwrap_impl(timezoneId), tracesDir: unwrap_impl(tracesDir), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
|
139
140
|
end
|
140
141
|
|
141
142
|
# Returns browser name. For example: `'chromium'`, `'webkit'` or `'firefox'`.
|
@@ -145,20 +146,20 @@ module Playwright
|
|
145
146
|
|
146
147
|
# -- inherited from EventEmitter --
|
147
148
|
# @nodoc
|
148
|
-
def
|
149
|
-
event_emitter_proxy.
|
149
|
+
def off(event, callback)
|
150
|
+
event_emitter_proxy.off(event, callback)
|
150
151
|
end
|
151
152
|
|
152
153
|
# -- inherited from EventEmitter --
|
153
154
|
# @nodoc
|
154
|
-
def
|
155
|
-
event_emitter_proxy.
|
155
|
+
def once(event, callback)
|
156
|
+
event_emitter_proxy.once(event, callback)
|
156
157
|
end
|
157
158
|
|
158
159
|
# -- inherited from EventEmitter --
|
159
160
|
# @nodoc
|
160
|
-
def
|
161
|
-
event_emitter_proxy.
|
161
|
+
def on(event, callback)
|
162
|
+
event_emitter_proxy.on(event, callback)
|
162
163
|
end
|
163
164
|
|
164
165
|
private def event_emitter_proxy
|
@@ -13,12 +13,12 @@ module Playwright
|
|
13
13
|
#
|
14
14
|
# ```python sync
|
15
15
|
# client = page.context().new_cdp_session(page)
|
16
|
-
# client.send("
|
17
|
-
# client.on("
|
18
|
-
# response = client.send("
|
19
|
-
# print("playback rate is " + response["
|
20
|
-
# client.send("
|
21
|
-
#
|
16
|
+
# client.send("Animation.enable")
|
17
|
+
# client.on("Animation.animationCreated", lambda: print("animation created!"))
|
18
|
+
# response = client.send("Animation.getPlaybackRate")
|
19
|
+
# print("playback rate is " + str(response["playbackRate"]))
|
20
|
+
# client.send("Animation.setPlaybackRate", {
|
21
|
+
# playbackRate: response["playbackRate"] / 2
|
22
22
|
# })
|
23
23
|
# ```
|
24
24
|
class CDPSession < PlaywrightApi
|
@@ -26,11 +26,33 @@ module Playwright
|
|
26
26
|
# Detaches the CDPSession from the target. Once detached, the CDPSession object won't emit any events and can't be used to
|
27
27
|
# send messages.
|
28
28
|
def detach
|
29
|
-
|
29
|
+
wrap_impl(@impl.detach)
|
30
30
|
end
|
31
31
|
|
32
32
|
def send_message(method, params: nil)
|
33
|
-
|
33
|
+
wrap_impl(@impl.send_message(unwrap_impl(method), params: unwrap_impl(params)))
|
34
|
+
end
|
35
|
+
|
36
|
+
# -- inherited from EventEmitter --
|
37
|
+
# @nodoc
|
38
|
+
def off(event, callback)
|
39
|
+
event_emitter_proxy.off(event, callback)
|
40
|
+
end
|
41
|
+
|
42
|
+
# -- inherited from EventEmitter --
|
43
|
+
# @nodoc
|
44
|
+
def once(event, callback)
|
45
|
+
event_emitter_proxy.once(event, callback)
|
46
|
+
end
|
47
|
+
|
48
|
+
# -- inherited from EventEmitter --
|
49
|
+
# @nodoc
|
50
|
+
def on(event, callback)
|
51
|
+
event_emitter_proxy.on(event, callback)
|
52
|
+
end
|
53
|
+
|
54
|
+
private def event_emitter_proxy
|
55
|
+
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
34
56
|
end
|
35
57
|
end
|
36
58
|
end
|
@@ -25,20 +25,20 @@ module Playwright
|
|
25
25
|
|
26
26
|
# -- inherited from EventEmitter --
|
27
27
|
# @nodoc
|
28
|
-
def
|
29
|
-
event_emitter_proxy.
|
28
|
+
def off(event, callback)
|
29
|
+
event_emitter_proxy.off(event, callback)
|
30
30
|
end
|
31
31
|
|
32
32
|
# -- inherited from EventEmitter --
|
33
33
|
# @nodoc
|
34
|
-
def
|
35
|
-
event_emitter_proxy.
|
34
|
+
def once(event, callback)
|
35
|
+
event_emitter_proxy.once(event, callback)
|
36
36
|
end
|
37
37
|
|
38
38
|
# -- inherited from EventEmitter --
|
39
39
|
# @nodoc
|
40
|
-
def
|
41
|
-
event_emitter_proxy.
|
40
|
+
def on(event, callback)
|
41
|
+
event_emitter_proxy.on(event, callback)
|
42
42
|
end
|
43
43
|
|
44
44
|
private def event_emitter_proxy
|
@@ -60,20 +60,20 @@ module Playwright
|
|
60
60
|
|
61
61
|
# -- inherited from EventEmitter --
|
62
62
|
# @nodoc
|
63
|
-
def
|
64
|
-
event_emitter_proxy.
|
63
|
+
def off(event, callback)
|
64
|
+
event_emitter_proxy.off(event, callback)
|
65
65
|
end
|
66
66
|
|
67
67
|
# -- inherited from EventEmitter --
|
68
68
|
# @nodoc
|
69
|
-
def
|
70
|
-
event_emitter_proxy.
|
69
|
+
def once(event, callback)
|
70
|
+
event_emitter_proxy.once(event, callback)
|
71
71
|
end
|
72
72
|
|
73
73
|
# -- inherited from EventEmitter --
|
74
74
|
# @nodoc
|
75
|
-
def
|
76
|
-
event_emitter_proxy.
|
75
|
+
def on(event, callback)
|
76
|
+
event_emitter_proxy.on(event, callback)
|
77
77
|
end
|
78
78
|
|
79
79
|
private def event_emitter_proxy
|
@@ -210,8 +210,8 @@ module Playwright
|
|
210
210
|
# instead.
|
211
211
|
#
|
212
212
|
# To send fine-grained keyboard events, use [`method: ElementHandle.type`].
|
213
|
-
def fill(value, noWaitAfter: nil, timeout: nil)
|
214
|
-
wrap_impl(@impl.fill(unwrap_impl(value), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout)))
|
213
|
+
def fill(value, force: nil, noWaitAfter: nil, timeout: nil)
|
214
|
+
wrap_impl(@impl.fill(unwrap_impl(value), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout)))
|
215
215
|
end
|
216
216
|
|
217
217
|
# Calls [focus](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus) on the element.
|
@@ -254,6 +254,11 @@ module Playwright
|
|
254
254
|
wrap_impl(@impl.inner_text)
|
255
255
|
end
|
256
256
|
|
257
|
+
# Returns `input.value` for `<input>` or `<textarea>` element. Throws for non-input elements.
|
258
|
+
def input_value(timeout: nil)
|
259
|
+
wrap_impl(@impl.input_value(timeout: unwrap_impl(timeout)))
|
260
|
+
end
|
261
|
+
|
257
262
|
# Returns whether the element is checked. Throws if the element is not a checkbox or radio input.
|
258
263
|
def checked?
|
259
264
|
wrap_impl(@impl.checked?)
|
@@ -381,15 +386,16 @@ module Playwright
|
|
381
386
|
index: nil,
|
382
387
|
value: nil,
|
383
388
|
label: nil,
|
389
|
+
force: nil,
|
384
390
|
noWaitAfter: nil,
|
385
391
|
timeout: nil)
|
386
|
-
wrap_impl(@impl.select_option(element: unwrap_impl(element), index: unwrap_impl(index), value: unwrap_impl(value), label: unwrap_impl(label), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout)))
|
392
|
+
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)))
|
387
393
|
end
|
388
394
|
|
389
395
|
# This method waits for [actionability](./actionability.md) checks, then focuses the element and selects all its text
|
390
396
|
# content.
|
391
|
-
def select_text(timeout: nil)
|
392
|
-
wrap_impl(@impl.select_text(timeout: unwrap_impl(timeout)))
|
397
|
+
def select_text(force: nil, timeout: nil)
|
398
|
+
wrap_impl(@impl.select_text(force: unwrap_impl(force), timeout: unwrap_impl(timeout)))
|
393
399
|
end
|
394
400
|
|
395
401
|
# This method expects `elementHandle` to point to an
|
@@ -511,20 +517,20 @@ module Playwright
|
|
511
517
|
|
512
518
|
# -- inherited from EventEmitter --
|
513
519
|
# @nodoc
|
514
|
-
def
|
515
|
-
event_emitter_proxy.
|
520
|
+
def off(event, callback)
|
521
|
+
event_emitter_proxy.off(event, callback)
|
516
522
|
end
|
517
523
|
|
518
524
|
# -- inherited from EventEmitter --
|
519
525
|
# @nodoc
|
520
|
-
def
|
521
|
-
event_emitter_proxy.
|
526
|
+
def once(event, callback)
|
527
|
+
event_emitter_proxy.once(event, callback)
|
522
528
|
end
|
523
529
|
|
524
530
|
# -- inherited from EventEmitter --
|
525
531
|
# @nodoc
|
526
|
-
def
|
527
|
-
event_emitter_proxy.
|
532
|
+
def on(event, callback)
|
533
|
+
event_emitter_proxy.on(event, callback)
|
528
534
|
end
|
529
535
|
|
530
536
|
private def event_emitter_proxy
|
data/lib/playwright_api/frame.rb
CHANGED
@@ -160,6 +160,16 @@ module Playwright
|
|
160
160
|
wrap_impl(@impl.dispatch_event(unwrap_impl(selector), unwrap_impl(type), eventInit: unwrap_impl(eventInit), timeout: unwrap_impl(timeout)))
|
161
161
|
end
|
162
162
|
|
163
|
+
def drag_and_drop(
|
164
|
+
source,
|
165
|
+
target,
|
166
|
+
force: nil,
|
167
|
+
noWaitAfter: nil,
|
168
|
+
timeout: nil,
|
169
|
+
trial: nil)
|
170
|
+
wrap_impl(@impl.drag_and_drop(unwrap_impl(source), unwrap_impl(target), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
|
171
|
+
end
|
172
|
+
|
163
173
|
# Returns the return value of `expression`.
|
164
174
|
#
|
165
175
|
# The method finds an element matching the specified selector within the frame and passes it as a first argument to
|
@@ -271,8 +281,13 @@ module Playwright
|
|
271
281
|
# instead.
|
272
282
|
#
|
273
283
|
# To send fine-grained keyboard events, use [`method: Frame.type`].
|
274
|
-
def fill(
|
275
|
-
|
284
|
+
def fill(
|
285
|
+
selector,
|
286
|
+
value,
|
287
|
+
force: nil,
|
288
|
+
noWaitAfter: nil,
|
289
|
+
timeout: nil)
|
290
|
+
wrap_impl(@impl.fill(unwrap_impl(selector), unwrap_impl(value), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout)))
|
276
291
|
end
|
277
292
|
|
278
293
|
# This method fetches an element with `selector` and focuses it. If there's no element matching `selector`, the method
|
@@ -354,6 +369,11 @@ module Playwright
|
|
354
369
|
wrap_impl(@impl.inner_text(unwrap_impl(selector), timeout: unwrap_impl(timeout)))
|
355
370
|
end
|
356
371
|
|
372
|
+
# Returns `input.value` for the selected `<input>` or `<textarea>` element. Throws for non-input elements.
|
373
|
+
def input_value(selector, timeout: nil)
|
374
|
+
wrap_impl(@impl.input_value(unwrap_impl(selector), timeout: unwrap_impl(timeout)))
|
375
|
+
end
|
376
|
+
|
357
377
|
# Returns whether the element is checked. Throws if the element is not a checkbox or radio input.
|
358
378
|
def checked?(selector, timeout: nil)
|
359
379
|
wrap_impl(@impl.checked?(unwrap_impl(selector), timeout: unwrap_impl(timeout)))
|
@@ -476,9 +496,10 @@ module Playwright
|
|
476
496
|
index: nil,
|
477
497
|
value: nil,
|
478
498
|
label: nil,
|
499
|
+
force: nil,
|
479
500
|
noWaitAfter: nil,
|
480
501
|
timeout: nil)
|
481
|
-
wrap_impl(@impl.select_option(unwrap_impl(selector), element: unwrap_impl(element), index: unwrap_impl(index), value: unwrap_impl(value), label: unwrap_impl(label), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout)))
|
502
|
+
wrap_impl(@impl.select_option(unwrap_impl(selector), 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)))
|
482
503
|
end
|
483
504
|
|
484
505
|
def set_content(html, timeout: nil, waitUntil: nil)
|
@@ -689,20 +710,20 @@ module Playwright
|
|
689
710
|
|
690
711
|
# -- inherited from EventEmitter --
|
691
712
|
# @nodoc
|
692
|
-
def
|
693
|
-
event_emitter_proxy.
|
713
|
+
def off(event, callback)
|
714
|
+
event_emitter_proxy.off(event, callback)
|
694
715
|
end
|
695
716
|
|
696
717
|
# -- inherited from EventEmitter --
|
697
718
|
# @nodoc
|
698
|
-
def
|
699
|
-
event_emitter_proxy.
|
719
|
+
def once(event, callback)
|
720
|
+
event_emitter_proxy.once(event, callback)
|
700
721
|
end
|
701
722
|
|
702
723
|
# -- inherited from EventEmitter --
|
703
724
|
# @nodoc
|
704
|
-
def
|
705
|
-
event_emitter_proxy.
|
725
|
+
def on(event, callback)
|
726
|
+
event_emitter_proxy.on(event, callback)
|
706
727
|
end
|
707
728
|
|
708
729
|
private def event_emitter_proxy
|
@@ -90,20 +90,20 @@ module Playwright
|
|
90
90
|
|
91
91
|
# -- inherited from EventEmitter --
|
92
92
|
# @nodoc
|
93
|
-
def
|
94
|
-
event_emitter_proxy.
|
93
|
+
def off(event, callback)
|
94
|
+
event_emitter_proxy.off(event, callback)
|
95
95
|
end
|
96
96
|
|
97
97
|
# -- inherited from EventEmitter --
|
98
98
|
# @nodoc
|
99
|
-
def
|
100
|
-
event_emitter_proxy.
|
99
|
+
def once(event, callback)
|
100
|
+
event_emitter_proxy.once(event, callback)
|
101
101
|
end
|
102
102
|
|
103
103
|
# -- inherited from EventEmitter --
|
104
104
|
# @nodoc
|
105
|
-
def
|
106
|
-
event_emitter_proxy.
|
105
|
+
def on(event, callback)
|
106
|
+
event_emitter_proxy.on(event, callback)
|
107
107
|
end
|
108
108
|
|
109
109
|
private def event_emitter_proxy
|
data/lib/playwright_api/page.rb
CHANGED
@@ -233,6 +233,16 @@ module Playwright
|
|
233
233
|
wrap_impl(@impl.dispatch_event(unwrap_impl(selector), unwrap_impl(type), eventInit: unwrap_impl(eventInit), timeout: unwrap_impl(timeout)))
|
234
234
|
end
|
235
235
|
|
236
|
+
def drag_and_drop(
|
237
|
+
source,
|
238
|
+
target,
|
239
|
+
force: nil,
|
240
|
+
noWaitAfter: nil,
|
241
|
+
timeout: nil,
|
242
|
+
trial: nil)
|
243
|
+
wrap_impl(@impl.drag_and_drop(unwrap_impl(source), unwrap_impl(target), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
|
244
|
+
end
|
245
|
+
|
236
246
|
# This method changes the `CSS media type` through the `media` argument, and/or the `'prefers-colors-scheme'` media
|
237
247
|
# feature, using the `colorScheme` argument.
|
238
248
|
#
|
@@ -481,8 +491,13 @@ module Playwright
|
|
481
491
|
# To send fine-grained keyboard events, use [`method: Page.type`].
|
482
492
|
#
|
483
493
|
# Shortcut for main frame's [`method: Frame.fill`].
|
484
|
-
def fill(
|
485
|
-
|
494
|
+
def fill(
|
495
|
+
selector,
|
496
|
+
value,
|
497
|
+
force: nil,
|
498
|
+
noWaitAfter: nil,
|
499
|
+
timeout: nil)
|
500
|
+
wrap_impl(@impl.fill(unwrap_impl(selector), unwrap_impl(value), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout)))
|
486
501
|
end
|
487
502
|
|
488
503
|
# This method fetches an element with `selector` and focuses it. If there's no element matching `selector`, the method
|
@@ -588,6 +603,11 @@ module Playwright
|
|
588
603
|
wrap_impl(@impl.inner_text(unwrap_impl(selector), timeout: unwrap_impl(timeout)))
|
589
604
|
end
|
590
605
|
|
606
|
+
# Returns `input.value` for the selected `<input>` or `<textarea>` element. Throws for non-input elements.
|
607
|
+
def input_value(selector, timeout: nil)
|
608
|
+
wrap_impl(@impl.input_value(unwrap_impl(selector), timeout: unwrap_impl(timeout)))
|
609
|
+
end
|
610
|
+
|
591
611
|
# Returns whether the element is checked. Throws if the element is not a checkbox or radio input.
|
592
612
|
def checked?(selector, timeout: nil)
|
593
613
|
wrap_impl(@impl.checked?(unwrap_impl(selector), timeout: unwrap_impl(timeout)))
|
@@ -855,9 +875,10 @@ module Playwright
|
|
855
875
|
index: nil,
|
856
876
|
value: nil,
|
857
877
|
label: nil,
|
878
|
+
force: nil,
|
858
879
|
noWaitAfter: nil,
|
859
880
|
timeout: nil)
|
860
|
-
wrap_impl(@impl.select_option(unwrap_impl(selector), element: unwrap_impl(element), index: unwrap_impl(index), value: unwrap_impl(value), label: unwrap_impl(label), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout)))
|
881
|
+
wrap_impl(@impl.select_option(unwrap_impl(selector), 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)))
|
861
882
|
end
|
862
883
|
|
863
884
|
def set_content(html, timeout: nil, waitUntil: nil)
|
@@ -1138,7 +1159,7 @@ module Playwright
|
|
1138
1159
|
wrap_impl(@impl.expect_popup(predicate: unwrap_impl(predicate), timeout: unwrap_impl(timeout), &wrap_block_call(block)))
|
1139
1160
|
end
|
1140
1161
|
|
1141
|
-
# Waits for the matching request and returns it.
|
1162
|
+
# Waits for the matching request and returns it. See [waiting for event](./events.md#waiting-for-event) for more details
|
1142
1163
|
# about events.
|
1143
1164
|
#
|
1144
1165
|
# ```python sync
|
@@ -1158,8 +1179,8 @@ module Playwright
|
|
1158
1179
|
# Performs action and waits for a `Request` to finish loading. If predicate is provided, it passes `Request` value into
|
1159
1180
|
# the `predicate` function and waits for `predicate(request)` to return a truthy value. Will throw an error if the page is
|
1160
1181
|
# closed before the [`event: Page.requestFinished`] event is fired.
|
1161
|
-
def expect_request_finished(predicate: nil, timeout: nil)
|
1162
|
-
|
1182
|
+
def expect_request_finished(predicate: nil, timeout: nil, &block)
|
1183
|
+
wrap_impl(@impl.expect_request_finished(predicate: unwrap_impl(predicate), timeout: unwrap_impl(timeout), &wrap_block_call(block)))
|
1163
1184
|
end
|
1164
1185
|
|
1165
1186
|
# Returns the matched response. See [waiting for event](./events.md#waiting-for-event) for more details about events.
|
@@ -1239,8 +1260,8 @@ module Playwright
|
|
1239
1260
|
# Performs action and waits for a new `WebSocket`. If predicate is provided, it passes `WebSocket` value into the
|
1240
1261
|
# `predicate` function and waits for `predicate(webSocket)` to return a truthy value. Will throw an error if the page is
|
1241
1262
|
# closed before the WebSocket event is fired.
|
1242
|
-
def expect_websocket(predicate: nil, timeout: nil)
|
1243
|
-
|
1263
|
+
def expect_websocket(predicate: nil, timeout: nil, &block)
|
1264
|
+
wrap_impl(@impl.expect_websocket(predicate: unwrap_impl(predicate), timeout: unwrap_impl(timeout), &wrap_block_call(block)))
|
1244
1265
|
end
|
1245
1266
|
|
1246
1267
|
# Performs action and waits for a new `Worker`. If predicate is provided, it passes `Worker` value into the `predicate`
|
@@ -1272,6 +1293,11 @@ module Playwright
|
|
1272
1293
|
wrap_impl(@impl.owned_context=(unwrap_impl(req)))
|
1273
1294
|
end
|
1274
1295
|
|
1296
|
+
# @nodoc
|
1297
|
+
def start_js_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
|
1298
|
+
wrap_impl(@impl.start_js_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
|
1299
|
+
end
|
1300
|
+
|
1275
1301
|
# @nodoc
|
1276
1302
|
def stop_js_coverage
|
1277
1303
|
wrap_impl(@impl.stop_js_coverage)
|
@@ -1288,13 +1314,14 @@ module Playwright
|
|
1288
1314
|
end
|
1289
1315
|
|
1290
1316
|
# @nodoc
|
1291
|
-
def
|
1292
|
-
wrap_impl(@impl.
|
1317
|
+
def guid
|
1318
|
+
wrap_impl(@impl.guid)
|
1293
1319
|
end
|
1294
1320
|
|
1321
|
+
# -- inherited from EventEmitter --
|
1295
1322
|
# @nodoc
|
1296
|
-
def
|
1297
|
-
|
1323
|
+
def off(event, callback)
|
1324
|
+
event_emitter_proxy.off(event, callback)
|
1298
1325
|
end
|
1299
1326
|
|
1300
1327
|
# -- inherited from EventEmitter --
|
@@ -1309,12 +1336,6 @@ module Playwright
|
|
1309
1336
|
event_emitter_proxy.on(event, callback)
|
1310
1337
|
end
|
1311
1338
|
|
1312
|
-
# -- inherited from EventEmitter --
|
1313
|
-
# @nodoc
|
1314
|
-
def off(event, callback)
|
1315
|
-
event_emitter_proxy.off(event, callback)
|
1316
|
-
end
|
1317
|
-
|
1318
1339
|
private def event_emitter_proxy
|
1319
1340
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
1320
1341
|
end
|