playwright-ruby-client 0.6.2 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/documentation/docs/api/browser.md +2 -1
- data/documentation/docs/api/browser_context.md +1 -1
- data/documentation/docs/api/browser_type.md +54 -1
- data/documentation/docs/api/experimental/android.md +3 -2
- data/documentation/docs/api/page.md +8 -0
- data/documentation/docs/api/route.md +20 -21
- data/documentation/docs/api/tracing.md +8 -15
- data/documentation/docs/api/web_socket.md +38 -1
- data/documentation/docs/article/guides/launch_browser.md +2 -0
- data/documentation/docs/article/guides/rails_integration.md +156 -2
- data/documentation/docs/article/guides/recording_video.md +79 -0
- data/documentation/docs/article/guides/semi_automation.md +67 -0
- data/documentation/docs/include/api_coverage.md +7 -8
- data/documentation/package.json +1 -1
- data/documentation/yarn.lock +478 -498
- data/lib/playwright/channel_owners/browser.rb +15 -27
- data/lib/playwright/channel_owners/browser_context.rb +13 -5
- data/lib/playwright/channel_owners/browser_type.rb +23 -8
- data/lib/playwright/channel_owners/page.rb +6 -1
- data/lib/playwright/channel_owners/web_socket.rb +87 -0
- data/lib/playwright/tracing_impl.rb +9 -9
- data/lib/playwright/version.rb +1 -1
- data/lib/playwright_api/android.rb +9 -8
- data/lib/playwright_api/android_device.rb +6 -6
- data/lib/playwright_api/browser.rb +9 -8
- data/lib/playwright_api/browser_context.rb +8 -8
- data/lib/playwright_api/browser_type.rb +12 -11
- data/lib/playwright_api/console_message.rb +6 -6
- data/lib/playwright_api/dialog.rb +6 -6
- data/lib/playwright_api/element_handle.rb +6 -6
- data/lib/playwright_api/frame.rb +6 -6
- data/lib/playwright_api/js_handle.rb +6 -6
- data/lib/playwright_api/page.rb +14 -14
- data/lib/playwright_api/playwright.rb +6 -6
- 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 +6 -6
- data/lib/playwright_api/tracing.rb +6 -12
- data/lib/playwright_api/web_socket.rb +28 -6
- data/lib/playwright_api/worker.rb +6 -6
- data/playwright.gemspec +2 -1
- metadata +33 -16
@@ -83,9 +83,9 @@ module Playwright
|
|
83
83
|
proxy: nil,
|
84
84
|
slowMo: nil,
|
85
85
|
timeout: nil,
|
86
|
-
|
86
|
+
tracesDir: nil,
|
87
87
|
&block)
|
88
|
-
wrap_impl(@impl.launch(args: unwrap_impl(args), channel: unwrap_impl(channel), chromiumSandbox: unwrap_impl(chromiumSandbox), devtools: unwrap_impl(devtools), downloadsPath: unwrap_impl(downloadsPath), env: unwrap_impl(env), executablePath: unwrap_impl(executablePath), firefoxUserPrefs: unwrap_impl(firefoxUserPrefs), handleSIGHUP: unwrap_impl(handleSIGHUP), handleSIGINT: unwrap_impl(handleSIGINT), handleSIGTERM: unwrap_impl(handleSIGTERM), headless: unwrap_impl(headless), ignoreDefaultArgs: unwrap_impl(ignoreDefaultArgs), proxy: unwrap_impl(proxy), slowMo: unwrap_impl(slowMo), timeout: unwrap_impl(timeout),
|
88
|
+
wrap_impl(@impl.launch(args: unwrap_impl(args), channel: unwrap_impl(channel), chromiumSandbox: unwrap_impl(chromiumSandbox), devtools: unwrap_impl(devtools), downloadsPath: unwrap_impl(downloadsPath), env: unwrap_impl(env), executablePath: unwrap_impl(executablePath), firefoxUserPrefs: unwrap_impl(firefoxUserPrefs), handleSIGHUP: unwrap_impl(handleSIGHUP), handleSIGINT: unwrap_impl(handleSIGINT), handleSIGTERM: unwrap_impl(handleSIGTERM), headless: unwrap_impl(headless), ignoreDefaultArgs: unwrap_impl(ignoreDefaultArgs), proxy: unwrap_impl(proxy), slowMo: unwrap_impl(slowMo), timeout: unwrap_impl(timeout), tracesDir: unwrap_impl(tracesDir), &wrap_block_call(block)))
|
89
89
|
end
|
90
90
|
|
91
91
|
# Returns the persistent browser context instance.
|
@@ -131,10 +131,11 @@ module Playwright
|
|
131
131
|
slowMo: nil,
|
132
132
|
timeout: nil,
|
133
133
|
timezoneId: nil,
|
134
|
-
|
134
|
+
tracesDir: nil,
|
135
135
|
userAgent: nil,
|
136
|
-
viewport: nil
|
137
|
-
|
136
|
+
viewport: nil,
|
137
|
+
&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)))
|
138
139
|
end
|
139
140
|
|
140
141
|
# Returns browser name. For example: `'chromium'`, `'webkit'` or `'firefox'`.
|
@@ -142,12 +143,6 @@ module Playwright
|
|
142
143
|
wrap_impl(@impl.name)
|
143
144
|
end
|
144
145
|
|
145
|
-
# -- inherited from EventEmitter --
|
146
|
-
# @nodoc
|
147
|
-
def once(event, callback)
|
148
|
-
event_emitter_proxy.once(event, callback)
|
149
|
-
end
|
150
|
-
|
151
146
|
# -- inherited from EventEmitter --
|
152
147
|
# @nodoc
|
153
148
|
def on(event, callback)
|
@@ -160,6 +155,12 @@ module Playwright
|
|
160
155
|
event_emitter_proxy.off(event, callback)
|
161
156
|
end
|
162
157
|
|
158
|
+
# -- inherited from EventEmitter --
|
159
|
+
# @nodoc
|
160
|
+
def once(event, callback)
|
161
|
+
event_emitter_proxy.once(event, callback)
|
162
|
+
end
|
163
|
+
|
163
164
|
private def event_emitter_proxy
|
164
165
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
165
166
|
end
|
@@ -23,12 +23,6 @@ module Playwright
|
|
23
23
|
wrap_impl(@impl.type)
|
24
24
|
end
|
25
25
|
|
26
|
-
# -- inherited from EventEmitter --
|
27
|
-
# @nodoc
|
28
|
-
def once(event, callback)
|
29
|
-
event_emitter_proxy.once(event, callback)
|
30
|
-
end
|
31
|
-
|
32
26
|
# -- inherited from EventEmitter --
|
33
27
|
# @nodoc
|
34
28
|
def on(event, callback)
|
@@ -41,6 +35,12 @@ module Playwright
|
|
41
35
|
event_emitter_proxy.off(event, callback)
|
42
36
|
end
|
43
37
|
|
38
|
+
# -- inherited from EventEmitter --
|
39
|
+
# @nodoc
|
40
|
+
def once(event, callback)
|
41
|
+
event_emitter_proxy.once(event, callback)
|
42
|
+
end
|
43
|
+
|
44
44
|
private def event_emitter_proxy
|
45
45
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
46
46
|
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 once(event, callback)
|
64
|
-
event_emitter_proxy.once(event, callback)
|
65
|
-
end
|
66
|
-
|
67
61
|
# -- inherited from EventEmitter --
|
68
62
|
# @nodoc
|
69
63
|
def on(event, callback)
|
@@ -76,6 +70,12 @@ module Playwright
|
|
76
70
|
event_emitter_proxy.off(event, callback)
|
77
71
|
end
|
78
72
|
|
73
|
+
# -- inherited from EventEmitter --
|
74
|
+
# @nodoc
|
75
|
+
def once(event, callback)
|
76
|
+
event_emitter_proxy.once(event, callback)
|
77
|
+
end
|
78
|
+
|
79
79
|
private def event_emitter_proxy
|
80
80
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
81
81
|
end
|
@@ -509,12 +509,6 @@ module Playwright
|
|
509
509
|
wrap_impl(@impl.wait_for_selector(unwrap_impl(selector), state: unwrap_impl(state), timeout: unwrap_impl(timeout)))
|
510
510
|
end
|
511
511
|
|
512
|
-
# -- inherited from EventEmitter --
|
513
|
-
# @nodoc
|
514
|
-
def once(event, callback)
|
515
|
-
event_emitter_proxy.once(event, callback)
|
516
|
-
end
|
517
|
-
|
518
512
|
# -- inherited from EventEmitter --
|
519
513
|
# @nodoc
|
520
514
|
def on(event, callback)
|
@@ -527,6 +521,12 @@ module Playwright
|
|
527
521
|
event_emitter_proxy.off(event, callback)
|
528
522
|
end
|
529
523
|
|
524
|
+
# -- inherited from EventEmitter --
|
525
|
+
# @nodoc
|
526
|
+
def once(event, callback)
|
527
|
+
event_emitter_proxy.once(event, callback)
|
528
|
+
end
|
529
|
+
|
530
530
|
private def event_emitter_proxy
|
531
531
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
532
532
|
end
|
data/lib/playwright_api/frame.rb
CHANGED
@@ -687,12 +687,6 @@ module Playwright
|
|
687
687
|
wrap_impl(@impl.detached=(unwrap_impl(req)))
|
688
688
|
end
|
689
689
|
|
690
|
-
# -- inherited from EventEmitter --
|
691
|
-
# @nodoc
|
692
|
-
def once(event, callback)
|
693
|
-
event_emitter_proxy.once(event, callback)
|
694
|
-
end
|
695
|
-
|
696
690
|
# -- inherited from EventEmitter --
|
697
691
|
# @nodoc
|
698
692
|
def on(event, callback)
|
@@ -705,6 +699,12 @@ module Playwright
|
|
705
699
|
event_emitter_proxy.off(event, callback)
|
706
700
|
end
|
707
701
|
|
702
|
+
# -- inherited from EventEmitter --
|
703
|
+
# @nodoc
|
704
|
+
def once(event, callback)
|
705
|
+
event_emitter_proxy.once(event, callback)
|
706
|
+
end
|
707
|
+
|
708
708
|
private def event_emitter_proxy
|
709
709
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
710
710
|
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 once(event, callback)
|
94
|
-
event_emitter_proxy.once(event, callback)
|
95
|
-
end
|
96
|
-
|
97
91
|
# -- inherited from EventEmitter --
|
98
92
|
# @nodoc
|
99
93
|
def on(event, callback)
|
@@ -106,6 +100,12 @@ module Playwright
|
|
106
100
|
event_emitter_proxy.off(event, callback)
|
107
101
|
end
|
108
102
|
|
103
|
+
# -- inherited from EventEmitter --
|
104
|
+
# @nodoc
|
105
|
+
def once(event, callback)
|
106
|
+
event_emitter_proxy.once(event, callback)
|
107
|
+
end
|
108
|
+
|
109
109
|
private def event_emitter_proxy
|
110
110
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
111
111
|
end
|
data/lib/playwright_api/page.rb
CHANGED
@@ -1239,8 +1239,8 @@ module Playwright
|
|
1239
1239
|
# Performs action and waits for a new `WebSocket`. If predicate is provided, it passes `WebSocket` value into the
|
1240
1240
|
# `predicate` function and waits for `predicate(webSocket)` to return a truthy value. Will throw an error if the page is
|
1241
1241
|
# closed before the WebSocket event is fired.
|
1242
|
-
def expect_websocket(predicate: nil, timeout: nil)
|
1243
|
-
|
1242
|
+
def expect_websocket(predicate: nil, timeout: nil, &block)
|
1243
|
+
wrap_impl(@impl.expect_websocket(predicate: unwrap_impl(predicate), timeout: unwrap_impl(timeout), &wrap_block_call(block)))
|
1244
1244
|
end
|
1245
1245
|
|
1246
1246
|
# Performs action and waits for a new `Worker`. If predicate is provided, it passes `Worker` value into the `predicate`
|
@@ -1273,13 +1273,13 @@ module Playwright
|
|
1273
1273
|
end
|
1274
1274
|
|
1275
1275
|
# @nodoc
|
1276
|
-
def
|
1277
|
-
wrap_impl(@impl.
|
1276
|
+
def stop_js_coverage
|
1277
|
+
wrap_impl(@impl.stop_js_coverage)
|
1278
1278
|
end
|
1279
1279
|
|
1280
1280
|
# @nodoc
|
1281
|
-
def
|
1282
|
-
wrap_impl(@impl.
|
1281
|
+
def start_css_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
|
1282
|
+
wrap_impl(@impl.start_css_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
|
1283
1283
|
end
|
1284
1284
|
|
1285
1285
|
# @nodoc
|
@@ -1288,8 +1288,8 @@ module Playwright
|
|
1288
1288
|
end
|
1289
1289
|
|
1290
1290
|
# @nodoc
|
1291
|
-
def
|
1292
|
-
wrap_impl(@impl.
|
1291
|
+
def start_js_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
|
1292
|
+
wrap_impl(@impl.start_js_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
|
1293
1293
|
end
|
1294
1294
|
|
1295
1295
|
# @nodoc
|
@@ -1297,12 +1297,6 @@ module Playwright
|
|
1297
1297
|
wrap_impl(@impl.guid)
|
1298
1298
|
end
|
1299
1299
|
|
1300
|
-
# -- inherited from EventEmitter --
|
1301
|
-
# @nodoc
|
1302
|
-
def once(event, callback)
|
1303
|
-
event_emitter_proxy.once(event, callback)
|
1304
|
-
end
|
1305
|
-
|
1306
1300
|
# -- inherited from EventEmitter --
|
1307
1301
|
# @nodoc
|
1308
1302
|
def on(event, callback)
|
@@ -1315,6 +1309,12 @@ module Playwright
|
|
1315
1309
|
event_emitter_proxy.off(event, callback)
|
1316
1310
|
end
|
1317
1311
|
|
1312
|
+
# -- inherited from EventEmitter --
|
1313
|
+
# @nodoc
|
1314
|
+
def once(event, callback)
|
1315
|
+
event_emitter_proxy.once(event, callback)
|
1316
|
+
end
|
1317
|
+
|
1318
1318
|
private def event_emitter_proxy
|
1319
1319
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
1320
1320
|
end
|
@@ -91,12 +91,6 @@ module Playwright
|
|
91
91
|
wrap_impl(@impl.electron)
|
92
92
|
end
|
93
93
|
|
94
|
-
# -- inherited from EventEmitter --
|
95
|
-
# @nodoc
|
96
|
-
def once(event, callback)
|
97
|
-
event_emitter_proxy.once(event, callback)
|
98
|
-
end
|
99
|
-
|
100
94
|
# -- inherited from EventEmitter --
|
101
95
|
# @nodoc
|
102
96
|
def on(event, callback)
|
@@ -109,6 +103,12 @@ module Playwright
|
|
109
103
|
event_emitter_proxy.off(event, callback)
|
110
104
|
end
|
111
105
|
|
106
|
+
# -- inherited from EventEmitter --
|
107
|
+
# @nodoc
|
108
|
+
def once(event, callback)
|
109
|
+
event_emitter_proxy.once(event, callback)
|
110
|
+
end
|
111
|
+
|
112
112
|
private def event_emitter_proxy
|
113
113
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
114
114
|
end
|
@@ -128,12 +128,6 @@ module Playwright
|
|
128
128
|
wrap_impl(@impl.url)
|
129
129
|
end
|
130
130
|
|
131
|
-
# -- inherited from EventEmitter --
|
132
|
-
# @nodoc
|
133
|
-
def once(event, callback)
|
134
|
-
event_emitter_proxy.once(event, callback)
|
135
|
-
end
|
136
|
-
|
137
131
|
# -- inherited from EventEmitter --
|
138
132
|
# @nodoc
|
139
133
|
def on(event, callback)
|
@@ -146,6 +140,12 @@ module Playwright
|
|
146
140
|
event_emitter_proxy.off(event, callback)
|
147
141
|
end
|
148
142
|
|
143
|
+
# -- inherited from EventEmitter --
|
144
|
+
# @nodoc
|
145
|
+
def once(event, callback)
|
146
|
+
event_emitter_proxy.once(event, callback)
|
147
|
+
end
|
148
|
+
|
149
149
|
private def event_emitter_proxy
|
150
150
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
151
151
|
end
|
@@ -69,12 +69,6 @@ module Playwright
|
|
69
69
|
wrap_impl(@impl.ok?)
|
70
70
|
end
|
71
71
|
|
72
|
-
# -- inherited from EventEmitter --
|
73
|
-
# @nodoc
|
74
|
-
def once(event, callback)
|
75
|
-
event_emitter_proxy.once(event, callback)
|
76
|
-
end
|
77
|
-
|
78
72
|
# -- inherited from EventEmitter --
|
79
73
|
# @nodoc
|
80
74
|
def on(event, callback)
|
@@ -87,6 +81,12 @@ module Playwright
|
|
87
81
|
event_emitter_proxy.off(event, callback)
|
88
82
|
end
|
89
83
|
|
84
|
+
# -- inherited from EventEmitter --
|
85
|
+
# @nodoc
|
86
|
+
def once(event, callback)
|
87
|
+
event_emitter_proxy.once(event, callback)
|
88
|
+
end
|
89
|
+
|
90
90
|
private def event_emitter_proxy
|
91
91
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
92
92
|
end
|
data/lib/playwright_api/route.rb
CHANGED
@@ -56,12 +56,6 @@ module Playwright
|
|
56
56
|
wrap_impl(@impl.request)
|
57
57
|
end
|
58
58
|
|
59
|
-
# -- inherited from EventEmitter --
|
60
|
-
# @nodoc
|
61
|
-
def once(event, callback)
|
62
|
-
event_emitter_proxy.once(event, callback)
|
63
|
-
end
|
64
|
-
|
65
59
|
# -- inherited from EventEmitter --
|
66
60
|
# @nodoc
|
67
61
|
def on(event, callback)
|
@@ -74,6 +68,12 @@ module Playwright
|
|
74
68
|
event_emitter_proxy.off(event, callback)
|
75
69
|
end
|
76
70
|
|
71
|
+
# -- inherited from EventEmitter --
|
72
|
+
# @nodoc
|
73
|
+
def once(event, callback)
|
74
|
+
event_emitter_proxy.once(event, callback)
|
75
|
+
end
|
76
|
+
|
77
77
|
private def event_emitter_proxy
|
78
78
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
79
79
|
end
|
@@ -12,12 +12,6 @@ module Playwright
|
|
12
12
|
wrap_impl(@impl.register(unwrap_impl(name), contentScript: unwrap_impl(contentScript), path: unwrap_impl(path), script: unwrap_impl(script)))
|
13
13
|
end
|
14
14
|
|
15
|
-
# -- inherited from EventEmitter --
|
16
|
-
# @nodoc
|
17
|
-
def once(event, callback)
|
18
|
-
event_emitter_proxy.once(event, callback)
|
19
|
-
end
|
20
|
-
|
21
15
|
# -- inherited from EventEmitter --
|
22
16
|
# @nodoc
|
23
17
|
def on(event, callback)
|
@@ -30,6 +24,12 @@ module Playwright
|
|
30
24
|
event_emitter_proxy.off(event, callback)
|
31
25
|
end
|
32
26
|
|
27
|
+
# -- inherited from EventEmitter --
|
28
|
+
# @nodoc
|
29
|
+
def once(event, callback)
|
30
|
+
event_emitter_proxy.once(event, callback)
|
31
|
+
end
|
32
|
+
|
33
33
|
private def event_emitter_proxy
|
34
34
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
35
35
|
end
|
@@ -5,35 +5,29 @@ module Playwright
|
|
5
5
|
# Start with specifying the folder traces will be stored in:
|
6
6
|
#
|
7
7
|
# ```python sync
|
8
|
-
# browser = chromium.launch(
|
8
|
+
# browser = chromium.launch()
|
9
9
|
# context = browser.new_context()
|
10
|
-
# context.tracing.start(
|
10
|
+
# context.tracing.start(screenshots=True, snapshots=True)
|
11
11
|
# page.goto("https://playwright.dev")
|
12
|
-
# context.tracing.stop()
|
13
|
-
# context.tracing.export("trace.zip")
|
12
|
+
# context.tracing.stop(path = "trace.zip")
|
14
13
|
# ```
|
15
14
|
class Tracing < PlaywrightApi
|
16
15
|
|
17
|
-
# Export trace into the file with the given name. Should be called after the tracing has stopped.
|
18
|
-
def export(path)
|
19
|
-
wrap_impl(@impl.export(unwrap_impl(path)))
|
20
|
-
end
|
21
|
-
|
22
16
|
# Start tracing.
|
23
17
|
#
|
24
18
|
# ```python sync
|
25
19
|
# context.tracing.start(name="trace", screenshots=True, snapshots=True)
|
26
20
|
# page.goto("https://playwright.dev")
|
27
21
|
# context.tracing.stop()
|
28
|
-
# context.tracing.
|
22
|
+
# context.tracing.stop(path = "trace.zip")
|
29
23
|
# ```
|
30
24
|
def start(name: nil, screenshots: nil, snapshots: nil)
|
31
25
|
wrap_impl(@impl.start(name: unwrap_impl(name), screenshots: unwrap_impl(screenshots), snapshots: unwrap_impl(snapshots)))
|
32
26
|
end
|
33
27
|
|
34
28
|
# Stop tracing.
|
35
|
-
def stop
|
36
|
-
wrap_impl(@impl.stop)
|
29
|
+
def stop(path: nil)
|
30
|
+
wrap_impl(@impl.stop(path: unwrap_impl(path)))
|
37
31
|
end
|
38
32
|
end
|
39
33
|
end
|
@@ -4,18 +4,18 @@ module Playwright
|
|
4
4
|
|
5
5
|
# Indicates that the web socket has been closed.
|
6
6
|
def closed?
|
7
|
-
|
7
|
+
wrap_impl(@impl.closed?)
|
8
8
|
end
|
9
9
|
|
10
10
|
# Contains the URL of the WebSocket.
|
11
11
|
def url
|
12
|
-
|
12
|
+
wrap_impl(@impl.url)
|
13
13
|
end
|
14
14
|
|
15
15
|
# Waits for event to fire and passes its value into the predicate function. Returns when the predicate returns truthy
|
16
16
|
# value. Will throw an error if the webSocket is closed before the event is fired. Returns the event data value.
|
17
|
-
def expect_event(event, predicate: nil, timeout: nil)
|
18
|
-
|
17
|
+
def expect_event(event, predicate: nil, timeout: nil, &block)
|
18
|
+
wrap_impl(@impl.expect_event(unwrap_impl(event), predicate: unwrap_impl(predicate), timeout: unwrap_impl(timeout), &wrap_block_call(block)))
|
19
19
|
end
|
20
20
|
|
21
21
|
# > NOTE: In most cases, you should use [`method: WebSocket.waitForEvent`].
|
@@ -23,8 +23,30 @@ module Playwright
|
|
23
23
|
# Waits for given `event` to fire. If predicate is provided, it passes event's value into the `predicate` function and
|
24
24
|
# waits for `predicate(event)` to return a truthy value. Will throw an error if the socket is closed before the `event` is
|
25
25
|
# fired.
|
26
|
-
def wait_for_event(event, predicate: nil, timeout: nil)
|
27
|
-
|
26
|
+
def wait_for_event(event, predicate: nil, timeout: nil, &block)
|
27
|
+
wrap_impl(@impl.wait_for_event(unwrap_impl(event), predicate: unwrap_impl(predicate), timeout: unwrap_impl(timeout), &wrap_block_call(block)))
|
28
|
+
end
|
29
|
+
|
30
|
+
# -- inherited from EventEmitter --
|
31
|
+
# @nodoc
|
32
|
+
def on(event, callback)
|
33
|
+
event_emitter_proxy.on(event, callback)
|
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
|
+
private def event_emitter_proxy
|
49
|
+
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
28
50
|
end
|
29
51
|
end
|
30
52
|
end
|