playwright-ruby-client 0.6.3 → 0.7.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/documentation/docs/api/browser.md +12 -1
- data/documentation/docs/api/browser_context.md +11 -1
- data/documentation/docs/api/browser_type.md +54 -1
- data/documentation/docs/api/cdp_session.md +41 -1
- data/documentation/docs/api/experimental/android.md +3 -2
- data/documentation/docs/api/page.md +18 -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 +45 -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 +13 -14
- data/documentation/package.json +1 -1
- data/documentation/yarn.lock +478 -498
- data/lib/playwright/channel_owners/browser.rb +19 -10
- data/lib/playwright/channel_owners/browser_context.rb +14 -2
- data/lib/playwright/channel_owners/browser_type.rb +23 -8
- data/lib/playwright/channel_owners/cdp_session.rb +19 -0
- data/lib/playwright/channel_owners/page.rb +8 -0
- data/lib/playwright/channel_owners/response.rb +1 -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 +3 -2
- data/lib/playwright_api/browser.rb +4 -3
- data/lib/playwright_api/browser_context.rb +3 -3
- data/lib/playwright_api/browser_type.rb +6 -5
- data/lib/playwright_api/cdp_session.rb +24 -2
- data/lib/playwright_api/page.rb +9 -9
- data/lib/playwright_api/response.rb +0 -5
- data/lib/playwright_api/tracing.rb +6 -12
- data/lib/playwright_api/web_socket.rb +28 -6
- data/playwright.gemspec +2 -1
- metadata +34 -16
@@ -30,24 +30,28 @@ module Playwright
|
|
30
30
|
@contexts << context
|
31
31
|
context.browser = self
|
32
32
|
context.options = params
|
33
|
+
return context unless block
|
33
34
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
context.close
|
39
|
-
end
|
40
|
-
else
|
41
|
-
context
|
35
|
+
begin
|
36
|
+
block.call(context)
|
37
|
+
ensure
|
38
|
+
context.close
|
42
39
|
end
|
43
40
|
end
|
44
41
|
|
45
|
-
def new_page(**options)
|
42
|
+
def new_page(**options, &block)
|
46
43
|
context = new_context(**options)
|
47
44
|
page = context.new_page
|
48
45
|
page.owned_context = context
|
49
46
|
context.owner_page = page
|
50
|
-
|
47
|
+
|
48
|
+
return page unless block
|
49
|
+
|
50
|
+
begin
|
51
|
+
block.call(page)
|
52
|
+
ensure
|
53
|
+
page.close
|
54
|
+
end
|
51
55
|
end
|
52
56
|
|
53
57
|
def close
|
@@ -63,6 +67,11 @@ module Playwright
|
|
63
67
|
@initializer['version']
|
64
68
|
end
|
65
69
|
|
70
|
+
def new_browser_cdp_session
|
71
|
+
resp = @channel.send_message_to_server('newBrowserCDPSession')
|
72
|
+
ChannelOwners::CDPSession.from(resp)
|
73
|
+
end
|
74
|
+
|
66
75
|
def start_tracing(page: nil, categories: nil, path: nil, screenshots: nil)
|
67
76
|
params = {
|
68
77
|
page: page&.channel,
|
@@ -98,6 +98,11 @@ module Playwright
|
|
98
98
|
page&.emit(Events::Page::Response, response)
|
99
99
|
end
|
100
100
|
|
101
|
+
def new_cdp_session(page)
|
102
|
+
resp = @channel.send_message_to_server('newCDPSession', page: page.channel)
|
103
|
+
ChannelOwners::CDPSession.from(resp)
|
104
|
+
end
|
105
|
+
|
101
106
|
def set_default_navigation_timeout(timeout)
|
102
107
|
@timeout_settings.default_navigation_timeout = timeout
|
103
108
|
@channel.send_message_to_server('setDefaultNavigationTimeoutNoReply', timeout: timeout)
|
@@ -113,10 +118,17 @@ module Playwright
|
|
113
118
|
end
|
114
119
|
|
115
120
|
# @returns [Playwright::Page]
|
116
|
-
def new_page
|
121
|
+
def new_page(&block)
|
117
122
|
raise 'Please use browser.new_context' if @owner_page
|
118
123
|
resp = @channel.send_message_to_server('newPage')
|
119
|
-
ChannelOwners::Page.from(resp)
|
124
|
+
page = ChannelOwners::Page.from(resp)
|
125
|
+
return page unless block
|
126
|
+
|
127
|
+
begin
|
128
|
+
block.call(page)
|
129
|
+
ensure
|
130
|
+
page.close
|
131
|
+
end
|
120
132
|
end
|
121
133
|
|
122
134
|
def cookies(urls: nil)
|
@@ -1,5 +1,7 @@
|
|
1
1
|
module Playwright
|
2
2
|
define_channel_owner :BrowserType do
|
3
|
+
include Utils::PrepareBrowserContextOptions
|
4
|
+
|
3
5
|
def name
|
4
6
|
@initializer['name']
|
5
7
|
end
|
@@ -11,15 +13,28 @@ module Playwright
|
|
11
13
|
def launch(options, &block)
|
12
14
|
resp = @channel.send_message_to_server('launch', options.compact)
|
13
15
|
browser = ChannelOwners::Browser.from(resp)
|
16
|
+
return browser unless block
|
14
17
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
begin
|
19
|
+
block.call(browser)
|
20
|
+
ensure
|
21
|
+
browser.close
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def launch_persistent_context(userDataDir, **options, &block)
|
26
|
+
params = options.dup
|
27
|
+
prepare_browser_context_options(params)
|
28
|
+
params['userDataDir'] = userDataDir
|
29
|
+
|
30
|
+
resp = @channel.send_message_to_server('launchPersistentContext', params.compact)
|
31
|
+
context = ChannelOwners::Browser.from(resp)
|
32
|
+
return context unless block
|
33
|
+
|
34
|
+
begin
|
35
|
+
block.call(context)
|
36
|
+
ensure
|
37
|
+
context.close
|
23
38
|
end
|
24
39
|
end
|
25
40
|
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Playwright
|
2
|
+
define_channel_owner :CDPSession do
|
3
|
+
private def after_initialize
|
4
|
+
@channel.on('event', method(:on_event))
|
5
|
+
end
|
6
|
+
|
7
|
+
private def on_event(params)
|
8
|
+
emit(params['method'], params['params'])
|
9
|
+
end
|
10
|
+
|
11
|
+
def send_message(method, params: {})
|
12
|
+
@channel.send_message_to_server('send', method: method, params: params)
|
13
|
+
end
|
14
|
+
|
15
|
+
def detach
|
16
|
+
@channel.send_message_to_server('detach')
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -759,6 +759,10 @@ module Playwright
|
|
759
759
|
expect_event(Events::Page::Request, predicate: predicate, timeout: timeout, &block)
|
760
760
|
end
|
761
761
|
|
762
|
+
def expect_request_finished(predicate: nil, timeout: nil, &block)
|
763
|
+
expect_event(Events::Page::RequestFinished, predicate: predicate, timeout: timeout, &block)
|
764
|
+
end
|
765
|
+
|
762
766
|
def expect_response(urlOrPredicate, timeout: nil, &block)
|
763
767
|
predicate =
|
764
768
|
case urlOrPredicate
|
@@ -774,6 +778,10 @@ module Playwright
|
|
774
778
|
expect_event(Events::Page::Response, predicate: predicate, timeout: timeout, &block)
|
775
779
|
end
|
776
780
|
|
781
|
+
def expect_websocket(predicate: nil, timeout: nil, &block)
|
782
|
+
expect_event(Events::Page::WebSocket, predicate: predicate, timeout: timeout, &block)
|
783
|
+
end
|
784
|
+
|
777
785
|
# called from Frame with send(:timeout_settings)
|
778
786
|
private def timeout_settings
|
779
787
|
@timeout_settings
|
@@ -4,7 +4,7 @@ require 'json'
|
|
4
4
|
module Playwright
|
5
5
|
# @ref https://github.com/microsoft/playwright-python/blob/master/playwright/_impl/_network.py
|
6
6
|
define_channel_owner :Response do
|
7
|
-
def after_initialize
|
7
|
+
private def after_initialize
|
8
8
|
@request = ChannelOwners::Request.from(@initializer['request'])
|
9
9
|
timing = @initializer['timing']
|
10
10
|
@request.send(:update_timings,
|
@@ -0,0 +1,87 @@
|
|
1
|
+
require 'base64'
|
2
|
+
|
3
|
+
module Playwright
|
4
|
+
define_channel_owner :WebSocket do
|
5
|
+
private def after_initialize
|
6
|
+
@closed = false
|
7
|
+
|
8
|
+
@channel.on('frameSent', -> (params) {
|
9
|
+
on_frame_sent(params['opcode'], params['data'])
|
10
|
+
})
|
11
|
+
@channel.on('frameReceived', -> (params) {
|
12
|
+
on_frame_received(params['opcode'], params['data'])
|
13
|
+
})
|
14
|
+
@channel.on('socketError', -> (params) {
|
15
|
+
emit(Events::WebSocket::Error, params['error'])
|
16
|
+
})
|
17
|
+
@channel.on('close', -> (_) { on_close })
|
18
|
+
end
|
19
|
+
|
20
|
+
def url
|
21
|
+
@initializer['url']
|
22
|
+
end
|
23
|
+
|
24
|
+
class SocketClosedError < StandardError
|
25
|
+
def initialize
|
26
|
+
super('Socket closed')
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
class SocketError < StandardError
|
31
|
+
def initialize
|
32
|
+
super('Socket error')
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
class PageClosedError < StandardError
|
37
|
+
def initialize
|
38
|
+
super('Page closed')
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def expect_event(event, predicate: nil, timeout: nil, &block)
|
43
|
+
wait_helper = WaitHelper.new
|
44
|
+
wait_helper.reject_on_timeout(timeout || @parent.send(:timeout_settings).timeout, "Timeout while waiting for event \"#{event}\"")
|
45
|
+
|
46
|
+
unless event == Events::WebSocket::Close
|
47
|
+
wait_helper.reject_on_event(self, Events::WebSocket::Close, SocketClosedError.new)
|
48
|
+
end
|
49
|
+
|
50
|
+
unless event == Events::WebSocket::Error
|
51
|
+
wait_helper.reject_on_event(self, Events::WebSocket::Error, SocketError.new)
|
52
|
+
end
|
53
|
+
|
54
|
+
wait_helper.reject_on_event(@parent, 'close', PageClosedError.new)
|
55
|
+
wait_helper.wait_for_event(self, event, predicate: predicate)
|
56
|
+
block&.call
|
57
|
+
|
58
|
+
wait_helper.promise.value!
|
59
|
+
end
|
60
|
+
alias_method :wait_for_event, :expect_event
|
61
|
+
|
62
|
+
private def on_frame_sent(opcode, data)
|
63
|
+
if opcode == 2
|
64
|
+
emit(Events::WebSocket::FrameSent, Base64.strict_decode64(data))
|
65
|
+
else
|
66
|
+
emit(Events::WebSocket::FrameSent, data)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
private def on_frame_received(opcode, data)
|
71
|
+
if opcode == 2
|
72
|
+
emit(Events::WebSocket::FrameReceived, Base64.strict_decode64(data))
|
73
|
+
else
|
74
|
+
emit(Events::WebSocket::FrameReceived, data)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def closed?
|
79
|
+
@closed
|
80
|
+
end
|
81
|
+
|
82
|
+
private def on_close
|
83
|
+
@closed = true
|
84
|
+
emit(Events::WebSocket::Close)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -15,17 +15,17 @@ module Playwright
|
|
15
15
|
end
|
16
16
|
|
17
17
|
# Stop tracing.
|
18
|
-
def stop
|
18
|
+
def stop(path: nil)
|
19
19
|
@channel.send_message_to_server('tracingStop')
|
20
|
-
end
|
21
20
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
21
|
+
if path
|
22
|
+
resp = @channel.send_message_to_server('tracingExport')
|
23
|
+
artifact = ChannelOwners::Artifact.from(resp)
|
24
|
+
# if self._context._browser:
|
25
|
+
# artifact._is_remote = self._context._browser._is_remote
|
26
|
+
artifact.save_as(path)
|
27
|
+
artifact.delete
|
28
|
+
end
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
data/lib/playwright/version.rb
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
module Playwright
|
2
|
-
# Playwright has **experimental** support for Android automation.
|
2
|
+
# Playwright has **experimental** support for Android automation. See [here](./mobile.md) for more information. You can
|
3
|
+
# access android namespace via:
|
3
4
|
#
|
4
5
|
# An example of the Android automation script would be:
|
5
6
|
#
|
6
7
|
# Note that since you don't need Playwright to install web browsers when testing Android, you can omit browser download
|
7
8
|
# via setting the following environment variable when installing Playwright:
|
8
9
|
#
|
9
|
-
# ```
|
10
|
+
# ```bash js
|
10
11
|
# PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm i -D playwright
|
11
12
|
# ```
|
12
13
|
class Android < PlaywrightApi
|
@@ -50,7 +50,7 @@ module Playwright
|
|
50
50
|
#
|
51
51
|
# Returns the newly created browser session.
|
52
52
|
def new_browser_cdp_session
|
53
|
-
|
53
|
+
wrap_impl(@impl.new_browser_cdp_session)
|
54
54
|
end
|
55
55
|
|
56
56
|
# Creates a new browser context. It won't share cookies/cache with other browser contexts.
|
@@ -125,8 +125,9 @@ module Playwright
|
|
125
125
|
storageState: nil,
|
126
126
|
timezoneId: nil,
|
127
127
|
userAgent: nil,
|
128
|
-
viewport: nil
|
129
|
-
|
128
|
+
viewport: nil,
|
129
|
+
&block)
|
130
|
+
wrap_impl(@impl.new_page(acceptDownloads: unwrap_impl(acceptDownloads), bypassCSP: unwrap_impl(bypassCSP), colorScheme: unwrap_impl(colorScheme), deviceScaleFactor: unwrap_impl(deviceScaleFactor), extraHTTPHeaders: unwrap_impl(extraHTTPHeaders), geolocation: unwrap_impl(geolocation), hasTouch: unwrap_impl(hasTouch), httpCredentials: unwrap_impl(httpCredentials), 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), storageState: unwrap_impl(storageState), timezoneId: unwrap_impl(timezoneId), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
|
130
131
|
end
|
131
132
|
|
132
133
|
# > NOTE: Tracing is only supported on Chromium-based browsers.
|
@@ -204,12 +204,12 @@ 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.
|
211
|
-
def new_page
|
212
|
-
wrap_impl(@impl.new_page)
|
211
|
+
def new_page(&block)
|
212
|
+
wrap_impl(@impl.new_page(&wrap_block_call(block)))
|
213
213
|
end
|
214
214
|
|
215
215
|
# Returns all open pages in the context.
|
@@ -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'`.
|
@@ -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 once(event, callback)
|
39
|
+
event_emitter_proxy.once(event, callback)
|
40
|
+
end
|
41
|
+
|
42
|
+
# -- inherited from EventEmitter --
|
43
|
+
# @nodoc
|
44
|
+
def on(event, callback)
|
45
|
+
event_emitter_proxy.on(event, callback)
|
46
|
+
end
|
47
|
+
|
48
|
+
# -- inherited from EventEmitter --
|
49
|
+
# @nodoc
|
50
|
+
def off(event, callback)
|
51
|
+
event_emitter_proxy.off(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
|
data/lib/playwright_api/page.rb
CHANGED
@@ -1158,8 +1158,8 @@ module Playwright
|
|
1158
1158
|
# Performs action and waits for a `Request` to finish loading. If predicate is provided, it passes `Request` value into
|
1159
1159
|
# the `predicate` function and waits for `predicate(request)` to return a truthy value. Will throw an error if the page is
|
1160
1160
|
# closed before the [`event: Page.requestFinished`] event is fired.
|
1161
|
-
def expect_request_finished(predicate: nil, timeout: nil)
|
1162
|
-
|
1161
|
+
def expect_request_finished(predicate: nil, timeout: nil, &block)
|
1162
|
+
wrap_impl(@impl.expect_request_finished(predicate: unwrap_impl(predicate), timeout: unwrap_impl(timeout), &wrap_block_call(block)))
|
1163
1163
|
end
|
1164
1164
|
|
1165
1165
|
# Returns the matched response. See [waiting for event](./events.md#waiting-for-event) for more details about events.
|
@@ -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`
|
@@ -1277,6 +1277,11 @@ module Playwright
|
|
1277
1277
|
wrap_impl(@impl.start_js_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
|
1278
1278
|
end
|
1279
1279
|
|
1280
|
+
# @nodoc
|
1281
|
+
def stop_js_coverage
|
1282
|
+
wrap_impl(@impl.stop_js_coverage)
|
1283
|
+
end
|
1284
|
+
|
1280
1285
|
# @nodoc
|
1281
1286
|
def start_css_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
|
1282
1287
|
wrap_impl(@impl.start_css_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
|
@@ -1287,11 +1292,6 @@ module Playwright
|
|
1287
1292
|
wrap_impl(@impl.stop_css_coverage)
|
1288
1293
|
end
|
1289
1294
|
|
1290
|
-
# @nodoc
|
1291
|
-
def stop_js_coverage
|
1292
|
-
wrap_impl(@impl.stop_js_coverage)
|
1293
|
-
end
|
1294
|
-
|
1295
1295
|
# @nodoc
|
1296
1296
|
def guid
|
1297
1297
|
wrap_impl(@impl.guid)
|