playwright-ruby-client 1.15.beta1 → 1.15.beta2
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 +10 -14
- data/documentation/docs/api/browser.md +2 -0
- data/documentation/docs/api/browser_context.md +5 -1
- data/documentation/docs/api/browser_type.md +1 -0
- data/documentation/docs/api/element_handle.md +27 -1
- data/documentation/docs/api/experimental/android_device.md +1 -0
- data/documentation/docs/api/frame.md +28 -0
- data/documentation/docs/api/locator.md +29 -0
- data/documentation/docs/api/page.md +35 -2
- data/documentation/docs/api/request.md +27 -1
- data/documentation/docs/api/response.md +18 -1
- data/documentation/docs/api/tracing.md +42 -8
- data/documentation/docs/article/getting_started.md +10 -1
- data/documentation/docs/article/guides/download_playwright_driver.md +9 -0
- data/documentation/docs/article/guides/inspector.md +1 -1
- data/documentation/docs/article/guides/playwright_on_alpine_linux.md +56 -3
- data/documentation/docs/article/guides/rails_integration.md +4 -2
- data/documentation/docs/article/guides/rails_integration_with_null_driver.md +86 -0
- data/documentation/docs/article/guides/recording_video.md +1 -1
- data/documentation/docs/article/guides/semi_automation.md +1 -1
- data/documentation/docs/article/guides/use_storage_state.md +1 -1
- data/documentation/docs/include/api_coverage.md +11 -0
- data/documentation/docusaurus.config.js +1 -0
- data/documentation/package.json +2 -2
- data/documentation/src/pages/index.js +0 -1
- data/documentation/static/img/playwright-ruby-client.png +0 -0
- data/documentation/yarn.lock +625 -549
- data/lib/playwright/channel.rb +36 -2
- data/lib/playwright/channel_owners/artifact.rb +6 -2
- data/lib/playwright/channel_owners/browser.rb +4 -0
- data/lib/playwright/channel_owners/browser_context.rb +21 -14
- data/lib/playwright/channel_owners/element_handle.rb +10 -2
- data/lib/playwright/channel_owners/frame.rb +8 -0
- data/lib/playwright/channel_owners/page.rb +20 -4
- data/lib/playwright/channel_owners/request.rb +38 -17
- data/lib/playwright/channel_owners/response.rb +41 -5
- data/lib/playwright/connection.rb +5 -3
- data/lib/playwright/http_headers.rb +9 -4
- data/lib/playwright/locator_impl.rb +8 -0
- data/lib/playwright/{route_handler_entry.rb → route_handler.rb} +30 -2
- data/lib/playwright/tracing_impl.rb +18 -7
- data/lib/playwright/transport.rb +2 -0
- data/lib/playwright/utils.rb +8 -0
- data/lib/playwright/version.rb +1 -1
- data/lib/playwright/web_socket_transport.rb +2 -0
- data/lib/playwright.rb +1 -1
- data/lib/playwright_api/android.rb +6 -6
- data/lib/playwright_api/android_device.rb +10 -9
- data/lib/playwright_api/browser.rb +10 -8
- data/lib/playwright_api/browser_context.rb +12 -8
- data/lib/playwright_api/browser_type.rb +8 -7
- data/lib/playwright_api/cdp_session.rb +6 -6
- data/lib/playwright_api/console_message.rb +6 -6
- data/lib/playwright_api/dialog.rb +6 -6
- data/lib/playwright_api/element_handle.rb +31 -8
- data/lib/playwright_api/frame.rb +31 -6
- data/lib/playwright_api/js_handle.rb +6 -6
- data/lib/playwright_api/locator.rb +26 -0
- data/lib/playwright_api/page.rb +40 -10
- data/lib/playwright_api/playwright.rb +6 -6
- data/lib/playwright_api/request.rb +26 -4
- data/lib/playwright_api/response.rb +20 -4
- data/lib/playwright_api/route.rb +6 -6
- data/lib/playwright_api/selectors.rb +6 -6
- data/lib/playwright_api/tracing.rb +33 -4
- data/lib/playwright_api/web_socket.rb +6 -6
- data/lib/playwright_api/worker.rb +8 -8
- metadata +5 -3
@@ -36,7 +36,7 @@ module Playwright
|
|
36
36
|
ChannelOwners::Playwright.from(result['playwright'])
|
37
37
|
end
|
38
38
|
|
39
|
-
def async_send_message_to_server(guid, method, params)
|
39
|
+
def async_send_message_to_server(guid, method, params, metadata: nil)
|
40
40
|
callback = Concurrent::Promises.resolvable_future
|
41
41
|
|
42
42
|
with_generated_id do |id|
|
@@ -49,7 +49,9 @@ module Playwright
|
|
49
49
|
guid: guid,
|
50
50
|
method: method,
|
51
51
|
params: replace_channels_with_guids(params),
|
52
|
+
metadata: metadata || {},
|
52
53
|
}
|
54
|
+
|
53
55
|
begin
|
54
56
|
@transport.send_message(message)
|
55
57
|
rescue => err
|
@@ -62,8 +64,8 @@ module Playwright
|
|
62
64
|
callback
|
63
65
|
end
|
64
66
|
|
65
|
-
def send_message_to_server(guid, method, params)
|
66
|
-
async_send_message_to_server(guid, method, params).value!
|
67
|
+
def send_message_to_server(guid, method, params, metadata: nil)
|
68
|
+
async_send_message_to_server(guid, method, params, metadata: metadata).value!
|
67
69
|
end
|
68
70
|
|
69
71
|
private
|
@@ -11,10 +11,15 @@ module Playwright
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
module Parser
|
15
|
+
def parse_headers_as_array(serialized_headers, downcase)
|
16
|
+
serialized_headers.map do |header|
|
17
|
+
name = downcase ? header['name'].downcase : header['name']
|
18
|
+
value = header['value']
|
19
|
+
|
20
|
+
[name, value]
|
21
|
+
end
|
22
|
+
end
|
18
23
|
end
|
19
24
|
end
|
20
25
|
end
|
@@ -303,6 +303,14 @@ module Playwright
|
|
303
303
|
trial: trial)
|
304
304
|
end
|
305
305
|
|
306
|
+
def set_checked(checked, **options)
|
307
|
+
if checked
|
308
|
+
check(**options)
|
309
|
+
else
|
310
|
+
uncheck(**options)
|
311
|
+
end
|
312
|
+
end
|
313
|
+
|
306
314
|
def all_inner_texts
|
307
315
|
@frame.eval_on_selector_all(@selector, 'ee => ee.map(e => e.innerText)')
|
308
316
|
end
|
@@ -1,15 +1,43 @@
|
|
1
1
|
module Playwright
|
2
|
-
class
|
2
|
+
class RouteHandler
|
3
|
+
class CountDown
|
4
|
+
def initialize(count)
|
5
|
+
@count = count
|
6
|
+
end
|
7
|
+
|
8
|
+
def handle
|
9
|
+
return false if @count <= 0
|
10
|
+
|
11
|
+
@count = @count - 1
|
12
|
+
true
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class StubCounter
|
17
|
+
def handle
|
18
|
+
true
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
3
22
|
# @param url [String]
|
4
23
|
# @param base_url [String|nil]
|
5
24
|
# @param handler [Proc]
|
6
|
-
|
25
|
+
# @param times [Integer|nil]
|
26
|
+
def initialize(url, base_url, handler, times)
|
7
27
|
@url_value = url
|
8
28
|
@url_matcher = UrlMatcher.new(url, base_url: base_url)
|
9
29
|
@handler = handler
|
30
|
+
@counter =
|
31
|
+
if times
|
32
|
+
CountDown.new(times)
|
33
|
+
else
|
34
|
+
StubCounter.new
|
35
|
+
end
|
10
36
|
end
|
11
37
|
|
12
38
|
def handle(route, request)
|
39
|
+
return false unless @counter.handle
|
40
|
+
|
13
41
|
if @url_matcher.match?(request.url)
|
14
42
|
@handler.call(route, request)
|
15
43
|
true
|
@@ -12,19 +12,30 @@ module Playwright
|
|
12
12
|
snapshots: snapshots,
|
13
13
|
}.compact
|
14
14
|
@channel.send_message_to_server('tracingStart', params)
|
15
|
+
@channel.send_message_to_server('tracingStartChunk')
|
16
|
+
end
|
17
|
+
|
18
|
+
def start_chunk
|
19
|
+
@channel.send_message_to_server('tracingStartChunk')
|
20
|
+
end
|
21
|
+
|
22
|
+
def stop_chunk(path: nil)
|
23
|
+
do_stop_chunk(path: path)
|
15
24
|
end
|
16
25
|
|
17
|
-
# Stop tracing.
|
18
26
|
def stop(path: nil)
|
19
|
-
|
27
|
+
do_stop_chunk(path: path)
|
20
28
|
@channel.send_message_to_server('tracingStop')
|
21
29
|
end
|
22
30
|
|
23
|
-
private def
|
24
|
-
resp = @channel.send_message_to_server('
|
25
|
-
artifact = ChannelOwners::Artifact.
|
26
|
-
|
27
|
-
|
31
|
+
private def do_stop_chunk(path:)
|
32
|
+
resp = @channel.send_message_to_server('tracingStopChunk', save: !path.nil?)
|
33
|
+
artifact = ChannelOwners::Artifact.from_nullable(resp)
|
34
|
+
return unless artifact
|
35
|
+
|
36
|
+
if @context.browser.send(:remote?)
|
37
|
+
artifact.update_as_remote
|
38
|
+
end
|
28
39
|
artifact.save_as(path)
|
29
40
|
artifact.delete
|
30
41
|
end
|
data/lib/playwright/transport.rb
CHANGED
data/lib/playwright/utils.rb
CHANGED
@@ -10,6 +10,14 @@ module Playwright
|
|
10
10
|
if params[:extraHTTPHeaders]
|
11
11
|
params[:extraHTTPHeaders] = ::Playwright::HttpHeaders.new(params[:extraHTTPHeaders]).as_serialized
|
12
12
|
end
|
13
|
+
if params[:record_har_path]
|
14
|
+
params[:recordHar] = {
|
15
|
+
path: params.delete(:record_har_path)
|
16
|
+
}
|
17
|
+
if params[:record_har_omit_content]
|
18
|
+
params[:recordHar][:omitContent] = params.delete(:record_har_omit_content)
|
19
|
+
end
|
20
|
+
end
|
13
21
|
if params[:record_video_dir]
|
14
22
|
params[:recordVideo] = {
|
15
23
|
dir: params.delete(:record_video_dir)
|
data/lib/playwright/version.rb
CHANGED
data/lib/playwright.rb
CHANGED
@@ -20,7 +20,7 @@ require 'playwright/channel_owner'
|
|
20
20
|
require 'playwright/http_headers'
|
21
21
|
require 'playwright/input_files'
|
22
22
|
require 'playwright/connection'
|
23
|
-
require 'playwright/
|
23
|
+
require 'playwright/route_handler'
|
24
24
|
require 'playwright/select_option_values'
|
25
25
|
require 'playwright/timeout_settings'
|
26
26
|
require 'playwright/transport'
|
@@ -36,12 +36,6 @@ module Playwright
|
|
36
36
|
end
|
37
37
|
alias_method :default_timeout=, :set_default_timeout
|
38
38
|
|
39
|
-
# -- inherited from EventEmitter --
|
40
|
-
# @nodoc
|
41
|
-
def on(event, callback)
|
42
|
-
event_emitter_proxy.on(event, callback)
|
43
|
-
end
|
44
|
-
|
45
39
|
# -- inherited from EventEmitter --
|
46
40
|
# @nodoc
|
47
41
|
def off(event, callback)
|
@@ -54,6 +48,12 @@ module Playwright
|
|
54
48
|
event_emitter_proxy.once(event, callback)
|
55
49
|
end
|
56
50
|
|
51
|
+
# -- inherited from EventEmitter --
|
52
|
+
# @nodoc
|
53
|
+
def on(event, callback)
|
54
|
+
event_emitter_proxy.on(event, callback)
|
55
|
+
end
|
56
|
+
|
57
57
|
private def event_emitter_proxy
|
58
58
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
59
59
|
end
|
@@ -46,6 +46,7 @@ module Playwright
|
|
46
46
|
command: nil,
|
47
47
|
deviceScaleFactor: nil,
|
48
48
|
extraHTTPHeaders: nil,
|
49
|
+
forcedColors: nil,
|
49
50
|
geolocation: nil,
|
50
51
|
hasTouch: nil,
|
51
52
|
httpCredentials: nil,
|
@@ -67,7 +68,7 @@ module Playwright
|
|
67
68
|
userAgent: nil,
|
68
69
|
viewport: nil,
|
69
70
|
&block)
|
70
|
-
wrap_impl(@impl.launch_browser(acceptDownloads: unwrap_impl(acceptDownloads), baseURL: unwrap_impl(baseURL), 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), strictSelectors: unwrap_impl(strictSelectors), timezoneId: unwrap_impl(timezoneId), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
|
71
|
+
wrap_impl(@impl.launch_browser(acceptDownloads: unwrap_impl(acceptDownloads), baseURL: unwrap_impl(baseURL), bypassCSP: unwrap_impl(bypassCSP), colorScheme: unwrap_impl(colorScheme), command: unwrap_impl(command), deviceScaleFactor: unwrap_impl(deviceScaleFactor), extraHTTPHeaders: unwrap_impl(extraHTTPHeaders), forcedColors: unwrap_impl(forcedColors), 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), strictSelectors: unwrap_impl(strictSelectors), timezoneId: unwrap_impl(timezoneId), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
|
71
72
|
end
|
72
73
|
|
73
74
|
# Performs a long tap on the widget defined by `selector`.
|
@@ -163,20 +164,14 @@ module Playwright
|
|
163
164
|
raise NotImplementedError.new('web_views is not implemented yet.')
|
164
165
|
end
|
165
166
|
|
166
|
-
# @nodoc
|
167
|
-
def tap_on(selector, duration: nil, timeout: nil)
|
168
|
-
wrap_impl(@impl.tap_on(unwrap_impl(selector), duration: unwrap_impl(duration), timeout: unwrap_impl(timeout)))
|
169
|
-
end
|
170
|
-
|
171
167
|
# @nodoc
|
172
168
|
def tree
|
173
169
|
wrap_impl(@impl.tree)
|
174
170
|
end
|
175
171
|
|
176
|
-
# -- inherited from EventEmitter --
|
177
172
|
# @nodoc
|
178
|
-
def
|
179
|
-
|
173
|
+
def tap_on(selector, duration: nil, timeout: nil)
|
174
|
+
wrap_impl(@impl.tap_on(unwrap_impl(selector), duration: unwrap_impl(duration), timeout: unwrap_impl(timeout)))
|
180
175
|
end
|
181
176
|
|
182
177
|
# -- inherited from EventEmitter --
|
@@ -191,6 +186,12 @@ module Playwright
|
|
191
186
|
event_emitter_proxy.once(event, callback)
|
192
187
|
end
|
193
188
|
|
189
|
+
# -- inherited from EventEmitter --
|
190
|
+
# @nodoc
|
191
|
+
def on(event, callback)
|
192
|
+
event_emitter_proxy.on(event, callback)
|
193
|
+
end
|
194
|
+
|
194
195
|
private def event_emitter_proxy
|
195
196
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
196
197
|
end
|
@@ -70,6 +70,7 @@ module Playwright
|
|
70
70
|
colorScheme: nil,
|
71
71
|
deviceScaleFactor: nil,
|
72
72
|
extraHTTPHeaders: nil,
|
73
|
+
forcedColors: nil,
|
73
74
|
geolocation: nil,
|
74
75
|
hasTouch: nil,
|
75
76
|
httpCredentials: nil,
|
@@ -93,7 +94,7 @@ module Playwright
|
|
93
94
|
userAgent: nil,
|
94
95
|
viewport: nil,
|
95
96
|
&block)
|
96
|
-
wrap_impl(@impl.new_context(acceptDownloads: unwrap_impl(acceptDownloads), baseURL: unwrap_impl(baseURL), 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), strictSelectors: unwrap_impl(strictSelectors), timezoneId: unwrap_impl(timezoneId), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
|
97
|
+
wrap_impl(@impl.new_context(acceptDownloads: unwrap_impl(acceptDownloads), baseURL: unwrap_impl(baseURL), bypassCSP: unwrap_impl(bypassCSP), colorScheme: unwrap_impl(colorScheme), deviceScaleFactor: unwrap_impl(deviceScaleFactor), extraHTTPHeaders: unwrap_impl(extraHTTPHeaders), forcedColors: unwrap_impl(forcedColors), 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), strictSelectors: unwrap_impl(strictSelectors), timezoneId: unwrap_impl(timezoneId), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
|
97
98
|
end
|
98
99
|
|
99
100
|
# Creates a new page in a new browser context. Closing this page will close the context as well.
|
@@ -108,6 +109,7 @@ module Playwright
|
|
108
109
|
colorScheme: nil,
|
109
110
|
deviceScaleFactor: nil,
|
110
111
|
extraHTTPHeaders: nil,
|
112
|
+
forcedColors: nil,
|
111
113
|
geolocation: nil,
|
112
114
|
hasTouch: nil,
|
113
115
|
httpCredentials: nil,
|
@@ -131,7 +133,7 @@ module Playwright
|
|
131
133
|
userAgent: nil,
|
132
134
|
viewport: nil,
|
133
135
|
&block)
|
134
|
-
wrap_impl(@impl.new_page(acceptDownloads: unwrap_impl(acceptDownloads), baseURL: unwrap_impl(baseURL), 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), strictSelectors: unwrap_impl(strictSelectors), timezoneId: unwrap_impl(timezoneId), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
|
136
|
+
wrap_impl(@impl.new_page(acceptDownloads: unwrap_impl(acceptDownloads), baseURL: unwrap_impl(baseURL), bypassCSP: unwrap_impl(bypassCSP), colorScheme: unwrap_impl(colorScheme), deviceScaleFactor: unwrap_impl(deviceScaleFactor), extraHTTPHeaders: unwrap_impl(extraHTTPHeaders), forcedColors: unwrap_impl(forcedColors), 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), strictSelectors: unwrap_impl(strictSelectors), timezoneId: unwrap_impl(timezoneId), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
|
135
137
|
end
|
136
138
|
|
137
139
|
# > NOTE: This API controls [Chromium Tracing](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool)
|
@@ -164,12 +166,6 @@ module Playwright
|
|
164
166
|
wrap_impl(@impl.version)
|
165
167
|
end
|
166
168
|
|
167
|
-
# -- inherited from EventEmitter --
|
168
|
-
# @nodoc
|
169
|
-
def on(event, callback)
|
170
|
-
event_emitter_proxy.on(event, callback)
|
171
|
-
end
|
172
|
-
|
173
169
|
# -- inherited from EventEmitter --
|
174
170
|
# @nodoc
|
175
171
|
def off(event, callback)
|
@@ -182,6 +178,12 @@ module Playwright
|
|
182
178
|
event_emitter_proxy.once(event, callback)
|
183
179
|
end
|
184
180
|
|
181
|
+
# -- inherited from EventEmitter --
|
182
|
+
# @nodoc
|
183
|
+
def on(event, callback)
|
184
|
+
event_emitter_proxy.on(event, callback)
|
185
|
+
end
|
186
|
+
|
185
187
|
private def event_emitter_proxy
|
186
188
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
187
189
|
end
|
@@ -220,6 +220,10 @@ module Playwright
|
|
220
220
|
# Routing provides the capability to modify network requests that are made by any page in the browser context. Once route
|
221
221
|
# is enabled, every request matching the url pattern will stall unless it's continued, fulfilled or aborted.
|
222
222
|
#
|
223
|
+
# > NOTE: [`method: Page.route`] will not intercept requests intercepted by Service Worker. See
|
224
|
+
# [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using
|
225
|
+
# request interception. Via `await context.addInitScript(() => delete window.navigator.serviceWorker);`
|
226
|
+
#
|
223
227
|
# An example of a naive handler that aborts all image requests:
|
224
228
|
#
|
225
229
|
# ```python sync
|
@@ -260,8 +264,8 @@ module Playwright
|
|
260
264
|
# To remove a route with its handler you can use [`method: BrowserContext.unroute`].
|
261
265
|
#
|
262
266
|
# > NOTE: Enabling routing disables http cache.
|
263
|
-
def route(url, handler)
|
264
|
-
wrap_impl(@impl.route(unwrap_impl(url), unwrap_impl(handler)))
|
267
|
+
def route(url, handler, times: nil)
|
268
|
+
wrap_impl(@impl.route(unwrap_impl(url), unwrap_impl(handler), times: unwrap_impl(times)))
|
265
269
|
end
|
266
270
|
|
267
271
|
# > NOTE: Service workers are only supported on Chromium-based browsers.
|
@@ -387,12 +391,6 @@ module Playwright
|
|
387
391
|
wrap_impl(@impl.options=(unwrap_impl(req)))
|
388
392
|
end
|
389
393
|
|
390
|
-
# -- inherited from EventEmitter --
|
391
|
-
# @nodoc
|
392
|
-
def on(event, callback)
|
393
|
-
event_emitter_proxy.on(event, callback)
|
394
|
-
end
|
395
|
-
|
396
394
|
# -- inherited from EventEmitter --
|
397
395
|
# @nodoc
|
398
396
|
def off(event, callback)
|
@@ -405,6 +403,12 @@ module Playwright
|
|
405
403
|
event_emitter_proxy.once(event, callback)
|
406
404
|
end
|
407
405
|
|
406
|
+
# -- inherited from EventEmitter --
|
407
|
+
# @nodoc
|
408
|
+
def on(event, callback)
|
409
|
+
event_emitter_proxy.on(event, callback)
|
410
|
+
end
|
411
|
+
|
408
412
|
private def event_emitter_proxy
|
409
413
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
410
414
|
end
|
@@ -107,6 +107,7 @@ module Playwright
|
|
107
107
|
env: nil,
|
108
108
|
executablePath: nil,
|
109
109
|
extraHTTPHeaders: nil,
|
110
|
+
forcedColors: nil,
|
110
111
|
geolocation: nil,
|
111
112
|
handleSIGHUP: nil,
|
112
113
|
handleSIGINT: nil,
|
@@ -137,7 +138,7 @@ module Playwright
|
|
137
138
|
userAgent: nil,
|
138
139
|
viewport: nil,
|
139
140
|
&block)
|
140
|
-
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), strictSelectors: unwrap_impl(strictSelectors), timeout: unwrap_impl(timeout), timezoneId: unwrap_impl(timezoneId), tracesDir: unwrap_impl(tracesDir), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
|
141
|
+
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), forcedColors: unwrap_impl(forcedColors), 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), strictSelectors: unwrap_impl(strictSelectors), timeout: unwrap_impl(timeout), timezoneId: unwrap_impl(timezoneId), tracesDir: unwrap_impl(tracesDir), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
|
141
142
|
end
|
142
143
|
|
143
144
|
# Returns browser name. For example: `'chromium'`, `'webkit'` or `'firefox'`.
|
@@ -145,12 +146,6 @@ module Playwright
|
|
145
146
|
wrap_impl(@impl.name)
|
146
147
|
end
|
147
148
|
|
148
|
-
# -- inherited from EventEmitter --
|
149
|
-
# @nodoc
|
150
|
-
def on(event, callback)
|
151
|
-
event_emitter_proxy.on(event, callback)
|
152
|
-
end
|
153
|
-
|
154
149
|
# -- inherited from EventEmitter --
|
155
150
|
# @nodoc
|
156
151
|
def off(event, callback)
|
@@ -163,6 +158,12 @@ module Playwright
|
|
163
158
|
event_emitter_proxy.once(event, callback)
|
164
159
|
end
|
165
160
|
|
161
|
+
# -- inherited from EventEmitter --
|
162
|
+
# @nodoc
|
163
|
+
def on(event, callback)
|
164
|
+
event_emitter_proxy.on(event, callback)
|
165
|
+
end
|
166
|
+
|
166
167
|
private def event_emitter_proxy
|
167
168
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
168
169
|
end
|
@@ -33,12 +33,6 @@ module Playwright
|
|
33
33
|
wrap_impl(@impl.send_message(unwrap_impl(method), params: unwrap_impl(params)))
|
34
34
|
end
|
35
35
|
|
36
|
-
# -- inherited from EventEmitter --
|
37
|
-
# @nodoc
|
38
|
-
def on(event, callback)
|
39
|
-
event_emitter_proxy.on(event, callback)
|
40
|
-
end
|
41
|
-
|
42
36
|
# -- inherited from EventEmitter --
|
43
37
|
# @nodoc
|
44
38
|
def off(event, callback)
|
@@ -51,6 +45,12 @@ module Playwright
|
|
51
45
|
event_emitter_proxy.once(event, callback)
|
52
46
|
end
|
53
47
|
|
48
|
+
# -- inherited from EventEmitter --
|
49
|
+
# @nodoc
|
50
|
+
def on(event, callback)
|
51
|
+
event_emitter_proxy.on(event, callback)
|
52
|
+
end
|
53
|
+
|
54
54
|
private def event_emitter_proxy
|
55
55
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
56
56
|
end
|