playwright-ruby-client 0.6.1 → 0.6.6
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 +4 -1
- data/documentation/docs/api/browser_context.md +3 -4
- data/documentation/docs/api/browser_type.md +54 -1
- data/documentation/docs/api/dialog.md +15 -18
- data/documentation/docs/api/element_handle.md +28 -50
- data/documentation/docs/api/experimental/android.md +3 -2
- data/documentation/docs/api/experimental/android_device.md +1 -0
- data/documentation/docs/api/file_chooser.md +4 -5
- data/documentation/docs/api/frame.md +3 -4
- data/documentation/docs/api/js_handle.md +11 -14
- data/documentation/docs/api/page.md +163 -230
- data/documentation/docs/api/route.md +20 -21
- data/documentation/docs/api/tracing.md +8 -15
- data/documentation/docs/api/web_socket.md +1 -1
- data/documentation/docs/api/worker.md +18 -1
- data/documentation/docs/article/guides/rails_integration.md +156 -2
- data/documentation/docs/article/guides/recording_video.md +79 -0
- data/documentation/docs/include/api_coverage.md +5 -4
- data/documentation/package.json +1 -1
- data/documentation/yarn.lock +478 -498
- data/lib/playwright/channel_owners/binding_call.rb +1 -1
- 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 +8 -7
- data/lib/playwright/channel_owners/web_socket.rb +4 -0
- data/lib/playwright/channel_owners/worker.rb +4 -0
- data/lib/playwright/playwright_api.rb +16 -1
- 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 +8 -7
- data/lib/playwright_api/browser.rb +12 -9
- data/lib/playwright_api/browser_context.rb +13 -14
- data/lib/playwright_api/browser_type.rb +13 -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 +38 -24
- data/lib/playwright_api/playwright.rb +6 -6
- data/lib/playwright_api/request.rb +6 -6
- data/lib/playwright_api/response.rb +8 -8
- 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 +22 -0
- data/lib/playwright_api/worker.rb +22 -0
- metadata +5 -2
@@ -30,7 +30,7 @@ module Playwright
|
|
30
30
|
end
|
31
31
|
|
32
32
|
begin
|
33
|
-
result = callback.call(source, *args)
|
33
|
+
result = PlaywrightApi.unwrap(callback.call(source, *args))
|
34
34
|
@channel.send_message_to_server('resolve', result: JavaScript::ValueSerializer.new(result).serialize)
|
35
35
|
rescue => err
|
36
36
|
@channel.send_message_to_server('reject', error: { error: { message: err.message, name: 'Error' }})
|
@@ -7,7 +7,7 @@ module Playwright
|
|
7
7
|
private def after_initialize
|
8
8
|
@connected = true
|
9
9
|
@closed_or_closing = false
|
10
|
-
@remote =
|
10
|
+
@remote = false
|
11
11
|
|
12
12
|
@contexts = Set.new
|
13
13
|
@channel.on('close', method(:on_close))
|
@@ -30,36 +30,32 @@ 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
|
54
58
|
return if @closed_or_closing
|
55
|
-
if @remote
|
56
|
-
@contexts.each do |context|
|
57
|
-
context.pages.each do |page|
|
58
|
-
page.send(:on_close)
|
59
|
-
end
|
60
|
-
context.send(:on_close)
|
61
|
-
end
|
62
|
-
end
|
63
59
|
@closed_or_closing = true
|
64
60
|
@channel.send_message_to_server('close')
|
65
61
|
nil
|
@@ -89,14 +85,6 @@ module Playwright
|
|
89
85
|
|
90
86
|
private def on_close(_ = {})
|
91
87
|
@connected = false
|
92
|
-
if @remote
|
93
|
-
@contexts.each do |context|
|
94
|
-
context.pages.each do |page|
|
95
|
-
page.send(:on_close)
|
96
|
-
end
|
97
|
-
context.send(:on_close)
|
98
|
-
end
|
99
|
-
end
|
100
88
|
emit(Events::Browser::Disconnected, self)
|
101
89
|
@closed_or_closing = true
|
102
90
|
end
|
@@ -46,6 +46,8 @@ module Playwright
|
|
46
46
|
ChannelOwners::Request.from_nullable(params['page']),
|
47
47
|
)
|
48
48
|
})
|
49
|
+
|
50
|
+
@closed_promise = Concurrent::Promises.resolvable_future
|
49
51
|
end
|
50
52
|
|
51
53
|
private def on_page(page)
|
@@ -111,10 +113,17 @@ module Playwright
|
|
111
113
|
end
|
112
114
|
|
113
115
|
# @returns [Playwright::Page]
|
114
|
-
def new_page
|
116
|
+
def new_page(&block)
|
115
117
|
raise 'Please use browser.new_context' if @owner_page
|
116
118
|
resp = @channel.send_message_to_server('newPage')
|
117
|
-
ChannelOwners::Page.from(resp)
|
119
|
+
page = ChannelOwners::Page.from(resp)
|
120
|
+
return page unless block
|
121
|
+
|
122
|
+
begin
|
123
|
+
block.call(page)
|
124
|
+
ensure
|
125
|
+
page.close
|
126
|
+
end
|
118
127
|
end
|
119
128
|
|
120
129
|
def cookies(urls: nil)
|
@@ -223,15 +232,14 @@ module Playwright
|
|
223
232
|
end
|
224
233
|
|
225
234
|
private def on_close
|
226
|
-
@closed_or_closing = true
|
227
235
|
@browser&.send(:remove_context, self)
|
228
236
|
emit(Events::BrowserContext::Close)
|
237
|
+
@closed_promise.fulfill(true)
|
229
238
|
end
|
230
239
|
|
231
240
|
def close
|
232
|
-
return if @closed_or_closing
|
233
|
-
@closed_or_closing = true
|
234
241
|
@channel.send_message_to_server('close')
|
242
|
+
@closed_promise.value!
|
235
243
|
nil
|
236
244
|
rescue => err
|
237
245
|
raise unless safe_close_error?(err)
|
@@ -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
|
|
@@ -65,7 +65,8 @@ module Playwright
|
|
65
65
|
emit(Events::Page::WebSocket, ChannelOwners::WebSocket.from(params['webSocket']))
|
66
66
|
})
|
67
67
|
@channel.on('worker', ->(params) {
|
68
|
-
|
68
|
+
worker = ChannelOwners::Worker.from(params['worker'])
|
69
|
+
# on_worker(worker)
|
69
70
|
})
|
70
71
|
end
|
71
72
|
|
@@ -339,10 +340,11 @@ module Playwright
|
|
339
340
|
ChannelOwners::Response.from_nullable(resp)
|
340
341
|
end
|
341
342
|
|
342
|
-
def emulate_media(colorScheme: nil, media: nil)
|
343
|
+
def emulate_media(colorScheme: nil, media: nil, reducedMotion: nil)
|
343
344
|
params = {
|
344
345
|
colorScheme: colorScheme,
|
345
346
|
media: media,
|
347
|
+
reducedMotion: reducedMotion,
|
346
348
|
}.compact
|
347
349
|
@channel.send_message_to_server('emulateMedia', params)
|
348
350
|
|
@@ -713,7 +715,6 @@ module Playwright
|
|
713
715
|
end
|
714
716
|
|
715
717
|
wait_helper.wait_for_event(self, event, predicate: predicate)
|
716
|
-
|
717
718
|
block&.call
|
718
719
|
|
719
720
|
wait_helper.promise.value!
|
@@ -743,7 +744,7 @@ module Playwright
|
|
743
744
|
expect_event(Events::Page::Popup, predicate: predicate, timeout: timeout, &block)
|
744
745
|
end
|
745
746
|
|
746
|
-
def expect_request(urlOrPredicate, timeout: nil)
|
747
|
+
def expect_request(urlOrPredicate, timeout: nil, &block)
|
747
748
|
predicate =
|
748
749
|
case urlOrPredicate
|
749
750
|
when String, Regexp
|
@@ -755,10 +756,10 @@ module Playwright
|
|
755
756
|
-> (_) { true }
|
756
757
|
end
|
757
758
|
|
758
|
-
expect_event(Events::Page::Request, predicate: predicate, timeout: timeout)
|
759
|
+
expect_event(Events::Page::Request, predicate: predicate, timeout: timeout, &block)
|
759
760
|
end
|
760
761
|
|
761
|
-
def expect_response(urlOrPredicate, timeout: nil)
|
762
|
+
def expect_response(urlOrPredicate, timeout: nil, &block)
|
762
763
|
predicate =
|
763
764
|
case urlOrPredicate
|
764
765
|
when String, Regexp
|
@@ -770,7 +771,7 @@ module Playwright
|
|
770
771
|
-> (_) { true }
|
771
772
|
end
|
772
773
|
|
773
|
-
expect_event(Events::Page::Response, predicate: predicate, timeout: timeout)
|
774
|
+
expect_event(Events::Page::Response, predicate: predicate, timeout: timeout, &block)
|
774
775
|
end
|
775
776
|
|
776
777
|
# called from Frame with send(:timeout_settings)
|
@@ -18,6 +18,17 @@ module Playwright
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
+
# Unwrap ChannelOwner / ApiImplementation.
|
22
|
+
# @note Intended for internal use only.
|
23
|
+
def self.unwrap(api)
|
24
|
+
case api
|
25
|
+
when PlaywrightApi
|
26
|
+
api.instance_variable_get(:@impl)
|
27
|
+
else
|
28
|
+
api
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
21
32
|
class ChannelOwnerWrapper
|
22
33
|
def initialize(impl)
|
23
34
|
impl_class_name = impl.class.name
|
@@ -114,6 +125,8 @@ module Playwright
|
|
114
125
|
private def wrap_impl(object)
|
115
126
|
if object.is_a?(Array)
|
116
127
|
object.map { |obj| wrap_impl(obj) }
|
128
|
+
elsif object.is_a?(Hash)
|
129
|
+
object.map { |key, obj| [key, wrap_impl(obj)] }.to_h
|
117
130
|
else
|
118
131
|
::Playwright::PlaywrightApi.wrap(object)
|
119
132
|
end
|
@@ -122,8 +135,10 @@ module Playwright
|
|
122
135
|
private def unwrap_impl(object)
|
123
136
|
if object.is_a?(Array)
|
124
137
|
object.map { |obj| unwrap_impl(obj) }
|
138
|
+
elsif object.is_a?(Hash)
|
139
|
+
object.map { |key, obj| [key, unwrap_impl(obj)] }.to_h
|
125
140
|
elsif object.is_a?(PlaywrightApi)
|
126
|
-
|
141
|
+
::Playwright::PlaywrightApi.unwrap(object)
|
127
142
|
else
|
128
143
|
object
|
129
144
|
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
|
@@ -24,20 +25,20 @@ module Playwright
|
|
24
25
|
|
25
26
|
# -- inherited from EventEmitter --
|
26
27
|
# @nodoc
|
27
|
-
def
|
28
|
-
event_emitter_proxy.
|
28
|
+
def once(event, callback)
|
29
|
+
event_emitter_proxy.once(event, callback)
|
29
30
|
end
|
30
31
|
|
31
32
|
# -- inherited from EventEmitter --
|
32
33
|
# @nodoc
|
33
|
-
def
|
34
|
-
event_emitter_proxy.
|
34
|
+
def on(event, callback)
|
35
|
+
event_emitter_proxy.on(event, callback)
|
35
36
|
end
|
36
37
|
|
37
38
|
# -- inherited from EventEmitter --
|
38
39
|
# @nodoc
|
39
|
-
def
|
40
|
-
event_emitter_proxy.
|
40
|
+
def off(event, callback)
|
41
|
+
event_emitter_proxy.off(event, callback)
|
41
42
|
end
|
42
43
|
|
43
44
|
private def event_emitter_proxy
|
@@ -59,12 +59,13 @@ module Playwright
|
|
59
59
|
record_har_path: nil,
|
60
60
|
record_video_dir: nil,
|
61
61
|
record_video_size: nil,
|
62
|
+
reducedMotion: nil,
|
62
63
|
screen: nil,
|
63
64
|
timezoneId: nil,
|
64
65
|
userAgent: nil,
|
65
66
|
viewport: nil,
|
66
67
|
&block)
|
67
|
-
wrap_impl(@impl.launch_browser(acceptDownloads: unwrap_impl(acceptDownloads), bypassCSP: unwrap_impl(bypassCSP), colorScheme: unwrap_impl(colorScheme), command: unwrap_impl(command), 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), 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), screen: unwrap_impl(screen), timezoneId: unwrap_impl(timezoneId), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
|
68
|
+
wrap_impl(@impl.launch_browser(acceptDownloads: unwrap_impl(acceptDownloads), bypassCSP: unwrap_impl(bypassCSP), colorScheme: unwrap_impl(colorScheme), command: unwrap_impl(command), 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), 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), timezoneId: unwrap_impl(timezoneId), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
|
68
69
|
end
|
69
70
|
|
70
71
|
# Performs a long tap on the widget defined by `selector`.
|
@@ -172,20 +173,20 @@ module Playwright
|
|
172
173
|
|
173
174
|
# -- inherited from EventEmitter --
|
174
175
|
# @nodoc
|
175
|
-
def
|
176
|
-
event_emitter_proxy.
|
176
|
+
def once(event, callback)
|
177
|
+
event_emitter_proxy.once(event, callback)
|
177
178
|
end
|
178
179
|
|
179
180
|
# -- inherited from EventEmitter --
|
180
181
|
# @nodoc
|
181
|
-
def
|
182
|
-
event_emitter_proxy.
|
182
|
+
def on(event, callback)
|
183
|
+
event_emitter_proxy.on(event, callback)
|
183
184
|
end
|
184
185
|
|
185
186
|
# -- inherited from EventEmitter --
|
186
187
|
# @nodoc
|
187
|
-
def
|
188
|
-
event_emitter_proxy.
|
188
|
+
def off(event, callback)
|
189
|
+
event_emitter_proxy.off(event, callback)
|
189
190
|
end
|
190
191
|
|
191
192
|
private def event_emitter_proxy
|
@@ -84,13 +84,14 @@ module Playwright
|
|
84
84
|
record_har_path: nil,
|
85
85
|
record_video_dir: nil,
|
86
86
|
record_video_size: nil,
|
87
|
+
reducedMotion: nil,
|
87
88
|
screen: nil,
|
88
89
|
storageState: nil,
|
89
90
|
timezoneId: nil,
|
90
91
|
userAgent: nil,
|
91
92
|
viewport: nil,
|
92
93
|
&block)
|
93
|
-
wrap_impl(@impl.new_context(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), screen: unwrap_impl(screen), storageState: unwrap_impl(storageState), timezoneId: unwrap_impl(timezoneId), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
|
94
|
+
wrap_impl(@impl.new_context(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)))
|
94
95
|
end
|
95
96
|
|
96
97
|
# Creates a new page in a new browser context. Closing this page will close the context as well.
|
@@ -119,12 +120,14 @@ module Playwright
|
|
119
120
|
record_har_path: nil,
|
120
121
|
record_video_dir: nil,
|
121
122
|
record_video_size: nil,
|
123
|
+
reducedMotion: nil,
|
122
124
|
screen: nil,
|
123
125
|
storageState: nil,
|
124
126
|
timezoneId: nil,
|
125
127
|
userAgent: nil,
|
126
|
-
viewport: nil
|
127
|
-
|
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)))
|
128
131
|
end
|
129
132
|
|
130
133
|
# > NOTE: Tracing is only supported on Chromium-based browsers.
|
@@ -155,20 +158,20 @@ module Playwright
|
|
155
158
|
|
156
159
|
# -- inherited from EventEmitter --
|
157
160
|
# @nodoc
|
158
|
-
def
|
159
|
-
event_emitter_proxy.
|
161
|
+
def once(event, callback)
|
162
|
+
event_emitter_proxy.once(event, callback)
|
160
163
|
end
|
161
164
|
|
162
165
|
# -- inherited from EventEmitter --
|
163
166
|
# @nodoc
|
164
|
-
def
|
165
|
-
event_emitter_proxy.
|
167
|
+
def on(event, callback)
|
168
|
+
event_emitter_proxy.on(event, callback)
|
166
169
|
end
|
167
170
|
|
168
171
|
# -- inherited from EventEmitter --
|
169
172
|
# @nodoc
|
170
|
-
def
|
171
|
-
event_emitter_proxy.
|
173
|
+
def off(event, callback)
|
174
|
+
event_emitter_proxy.off(event, callback)
|
172
175
|
end
|
173
176
|
|
174
177
|
private def event_emitter_proxy
|