playwright-ruby-client 1.15.beta1 → 1.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +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/fetch_request.md +10 -0
- data/documentation/docs/api/frame.md +28 -0
- data/documentation/docs/api/locator.md +29 -0
- data/documentation/docs/api/mouse.md +11 -0
- data/documentation/docs/api/page.md +35 -2
- data/documentation/docs/api/request.md +34 -1
- data/documentation/docs/api/response.md +37 -2
- 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 +22 -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/fetch_request.rb +4 -0
- 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 +53 -17
- data/lib/playwright/channel_owners/response.rb +48 -5
- data/lib/playwright/connection.rb +5 -3
- data/lib/playwright/http_headers.rb +0 -6
- data/lib/playwright/locator_impl.rb +8 -0
- data/lib/playwright/mouse_impl.rb +9 -0
- data/lib/playwright/raw_headers.rb +61 -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 +2 -2
- data/lib/playwright/web_socket_transport.rb +2 -0
- data/lib/playwright.rb +2 -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 +7 -7
- 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/fetch_request.rb +74 -0
- 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/mouse.rb +8 -0
- data/lib/playwright_api/page.rb +40 -10
- data/lib/playwright_api/playwright.rb +6 -6
- data/lib/playwright_api/request.rb +30 -4
- data/lib/playwright_api/response.rb +31 -8
- 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 +6 -6
- metadata +12 -6
@@ -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,8 @@ 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/raw_headers'
|
24
|
+
require 'playwright/route_handler'
|
24
25
|
require 'playwright/select_option_values'
|
25
26
|
require 'playwright/timeout_settings'
|
26
27
|
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
|
@@ -12,7 +12,7 @@ module Playwright
|
|
12
12
|
# https://github.com/aslushnikov/getting-started-with-cdp/blob/master/README.md
|
13
13
|
#
|
14
14
|
# ```python sync
|
15
|
-
# client = page.context
|
15
|
+
# client = page.context.new_cdp_session(page)
|
16
16
|
# client.send("Animation.enable")
|
17
17
|
# client.on("Animation.animationCreated", lambda: print("animation created!"))
|
18
18
|
# response = client.send("Animation.getPlaybackRate")
|
@@ -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
|
@@ -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 on(event, callback)
|
29
|
-
event_emitter_proxy.on(event, callback)
|
30
|
-
end
|
31
|
-
|
32
26
|
# -- inherited from EventEmitter --
|
33
27
|
# @nodoc
|
34
28
|
def off(event, callback)
|
@@ -41,6 +35,12 @@ module Playwright
|
|
41
35
|
event_emitter_proxy.once(event, callback)
|
42
36
|
end
|
43
37
|
|
38
|
+
# -- inherited from EventEmitter --
|
39
|
+
# @nodoc
|
40
|
+
def on(event, callback)
|
41
|
+
event_emitter_proxy.on(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 on(event, callback)
|
64
|
-
event_emitter_proxy.on(event, callback)
|
65
|
-
end
|
66
|
-
|
67
61
|
# -- inherited from EventEmitter --
|
68
62
|
# @nodoc
|
69
63
|
def off(event, callback)
|
@@ -76,6 +70,12 @@ module Playwright
|
|
76
70
|
event_emitter_proxy.once(event, callback)
|
77
71
|
end
|
78
72
|
|
73
|
+
# -- inherited from EventEmitter --
|
74
|
+
# @nodoc
|
75
|
+
def on(event, callback)
|
76
|
+
event_emitter_proxy.on(event, callback)
|
77
|
+
end
|
78
|
+
|
79
79
|
private def event_emitter_proxy
|
80
80
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
81
81
|
end
|
@@ -412,6 +412,29 @@ module Playwright
|
|
412
412
|
wrap_impl(@impl.select_text(force: unwrap_impl(force), timeout: unwrap_impl(timeout)))
|
413
413
|
end
|
414
414
|
|
415
|
+
# This method checks or unchecks an element by performing the following steps:
|
416
|
+
# 1. Ensure that element is a checkbox or a radio input. If not, this method throws.
|
417
|
+
# 1. If the element already has the right checked state, this method returns immediately.
|
418
|
+
# 1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the
|
419
|
+
# element is detached during the checks, the whole action is retried.
|
420
|
+
# 1. Scroll the element into view if needed.
|
421
|
+
# 1. Use [`property: Page.mouse`] to click in the center of the element.
|
422
|
+
# 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
|
423
|
+
# 1. Ensure that the element is now checked or unchecked. If not, this method throws.
|
424
|
+
#
|
425
|
+
# When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
|
426
|
+
# zero timeout disables this.
|
427
|
+
def set_checked(
|
428
|
+
checked,
|
429
|
+
force: nil,
|
430
|
+
noWaitAfter: nil,
|
431
|
+
position: nil,
|
432
|
+
timeout: nil,
|
433
|
+
trial: nil)
|
434
|
+
wrap_impl(@impl.set_checked(unwrap_impl(checked), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
|
435
|
+
end
|
436
|
+
alias_method :checked=, :set_checked
|
437
|
+
|
415
438
|
# This method expects `elementHandle` to point to an
|
416
439
|
# [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).
|
417
440
|
#
|
@@ -525,14 +548,8 @@ module Playwright
|
|
525
548
|
# ```
|
526
549
|
#
|
527
550
|
# > NOTE: This method does not work across navigations, use [`method: Page.waitForSelector`] instead.
|
528
|
-
def wait_for_selector(selector, state: nil, timeout: nil)
|
529
|
-
wrap_impl(@impl.wait_for_selector(unwrap_impl(selector), state: unwrap_impl(state), timeout: unwrap_impl(timeout)))
|
530
|
-
end
|
531
|
-
|
532
|
-
# -- inherited from EventEmitter --
|
533
|
-
# @nodoc
|
534
|
-
def on(event, callback)
|
535
|
-
event_emitter_proxy.on(event, callback)
|
551
|
+
def wait_for_selector(selector, state: nil, strict: nil, timeout: nil)
|
552
|
+
wrap_impl(@impl.wait_for_selector(unwrap_impl(selector), state: unwrap_impl(state), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
|
536
553
|
end
|
537
554
|
|
538
555
|
# -- inherited from EventEmitter --
|
@@ -547,6 +564,12 @@ module Playwright
|
|
547
564
|
event_emitter_proxy.once(event, callback)
|
548
565
|
end
|
549
566
|
|
567
|
+
# -- inherited from EventEmitter --
|
568
|
+
# @nodoc
|
569
|
+
def on(event, callback)
|
570
|
+
event_emitter_proxy.on(event, callback)
|
571
|
+
end
|
572
|
+
|
550
573
|
private def event_emitter_proxy
|
551
574
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
552
575
|
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
module Playwright
|
2
|
+
# This API is used for Web API testing. You can use it to trigger API endpoints, configure micro-services, prepare
|
3
|
+
# environment or the service to your e2e test. When used on `Page` or a `BrowserContext`, this API will automatically use
|
4
|
+
# the cookies from the corresponding `BrowserContext`. This means that if you log in using this API, your e2e test will be
|
5
|
+
# logged in and vice versa.
|
6
|
+
class FetchRequest < PlaywrightApi
|
7
|
+
|
8
|
+
# All responses received through [`method: FetchRequest.fetch`], [`method: FetchRequest.get`],
|
9
|
+
# [`method: FetchRequest.post`] and other methods are stored in the memory, so that you can later call
|
10
|
+
# [`method: FetchResponse.body`]. This method discards all stored responses, and makes [`method: FetchResponse.body`]
|
11
|
+
# throw "Response disposed" error.
|
12
|
+
def dispose
|
13
|
+
raise NotImplementedError.new('dispose is not implemented yet.')
|
14
|
+
end
|
15
|
+
|
16
|
+
# Sends HTTP(S) fetch and returns its response. The method will populate fetch cookies from the context and update context
|
17
|
+
# cookies from the response. The method will automatically follow redirects.
|
18
|
+
def fetch(
|
19
|
+
urlOrRequest,
|
20
|
+
data: nil,
|
21
|
+
failOnStatusCode: nil,
|
22
|
+
headers: nil,
|
23
|
+
method: nil,
|
24
|
+
params: nil,
|
25
|
+
timeout: nil)
|
26
|
+
raise NotImplementedError.new('fetch is not implemented yet.')
|
27
|
+
end
|
28
|
+
|
29
|
+
# Sends HTTP(S) GET request and returns its response. The method will populate fetch cookies from the context and update
|
30
|
+
# context cookies from the response. The method will automatically follow redirects.
|
31
|
+
def get(
|
32
|
+
urlOrRequest,
|
33
|
+
failOnStatusCode: nil,
|
34
|
+
headers: nil,
|
35
|
+
params: nil,
|
36
|
+
timeout: nil)
|
37
|
+
raise NotImplementedError.new('get is not implemented yet.')
|
38
|
+
end
|
39
|
+
|
40
|
+
# Sends HTTP(S) fetch and returns its response. The method will populate fetch cookies from the context and update context
|
41
|
+
# cookies from the response. The method will automatically follow redirects.
|
42
|
+
def post(
|
43
|
+
urlOrRequest,
|
44
|
+
data: nil,
|
45
|
+
failOnStatusCode: nil,
|
46
|
+
headers: nil,
|
47
|
+
params: nil,
|
48
|
+
timeout: nil)
|
49
|
+
raise NotImplementedError.new('post is not implemented yet.')
|
50
|
+
end
|
51
|
+
|
52
|
+
# -- inherited from EventEmitter --
|
53
|
+
# @nodoc
|
54
|
+
def off(event, callback)
|
55
|
+
event_emitter_proxy.off(event, callback)
|
56
|
+
end
|
57
|
+
|
58
|
+
# -- inherited from EventEmitter --
|
59
|
+
# @nodoc
|
60
|
+
def once(event, callback)
|
61
|
+
event_emitter_proxy.once(event, callback)
|
62
|
+
end
|
63
|
+
|
64
|
+
# -- inherited from EventEmitter --
|
65
|
+
# @nodoc
|
66
|
+
def on(event, callback)
|
67
|
+
event_emitter_proxy.on(event, callback)
|
68
|
+
end
|
69
|
+
|
70
|
+
private def event_emitter_proxy
|
71
|
+
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
data/lib/playwright_api/frame.rb
CHANGED
@@ -524,6 +524,31 @@ module Playwright
|
|
524
524
|
wrap_impl(@impl.select_option(unwrap_impl(selector), element: unwrap_impl(element), index: unwrap_impl(index), value: unwrap_impl(value), label: unwrap_impl(label), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
|
525
525
|
end
|
526
526
|
|
527
|
+
# This method checks or unchecks an element matching `selector` by performing the following steps:
|
528
|
+
# 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
|
529
|
+
# 1. Ensure that matched element is a checkbox or a radio input. If not, this method throws.
|
530
|
+
# 1. If the element already has the right checked state, this method returns immediately.
|
531
|
+
# 1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the
|
532
|
+
# element is detached during the checks, the whole action is retried.
|
533
|
+
# 1. Scroll the element into view if needed.
|
534
|
+
# 1. Use [`property: Page.mouse`] to click in the center of the element.
|
535
|
+
# 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
|
536
|
+
# 1. Ensure that the element is now checked or unchecked. If not, this method throws.
|
537
|
+
#
|
538
|
+
# When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
|
539
|
+
# zero timeout disables this.
|
540
|
+
def set_checked(
|
541
|
+
selector,
|
542
|
+
checked,
|
543
|
+
force: nil,
|
544
|
+
noWaitAfter: nil,
|
545
|
+
position: nil,
|
546
|
+
strict: nil,
|
547
|
+
timeout: nil,
|
548
|
+
trial: nil)
|
549
|
+
wrap_impl(@impl.set_checked(unwrap_impl(selector), unwrap_impl(checked), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
|
550
|
+
end
|
551
|
+
|
527
552
|
def set_content(html, timeout: nil, waitUntil: nil)
|
528
553
|
wrap_impl(@impl.set_content(unwrap_impl(html), timeout: unwrap_impl(timeout), waitUntil: unwrap_impl(waitUntil)))
|
529
554
|
end
|
@@ -738,12 +763,6 @@ module Playwright
|
|
738
763
|
wrap_impl(@impl.detached=(unwrap_impl(req)))
|
739
764
|
end
|
740
765
|
|
741
|
-
# -- inherited from EventEmitter --
|
742
|
-
# @nodoc
|
743
|
-
def on(event, callback)
|
744
|
-
event_emitter_proxy.on(event, callback)
|
745
|
-
end
|
746
|
-
|
747
766
|
# -- inherited from EventEmitter --
|
748
767
|
# @nodoc
|
749
768
|
def off(event, callback)
|
@@ -756,6 +775,12 @@ module Playwright
|
|
756
775
|
event_emitter_proxy.once(event, callback)
|
757
776
|
end
|
758
777
|
|
778
|
+
# -- inherited from EventEmitter --
|
779
|
+
# @nodoc
|
780
|
+
def on(event, callback)
|
781
|
+
event_emitter_proxy.on(event, callback)
|
782
|
+
end
|
783
|
+
|
759
784
|
private def event_emitter_proxy
|
760
785
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
761
786
|
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 on(event, callback)
|
94
|
-
event_emitter_proxy.on(event, callback)
|
95
|
-
end
|
96
|
-
|
97
91
|
# -- inherited from EventEmitter --
|
98
92
|
# @nodoc
|
99
93
|
def off(event, callback)
|
@@ -106,6 +100,12 @@ module Playwright
|
|
106
100
|
event_emitter_proxy.once(event, callback)
|
107
101
|
end
|
108
102
|
|
103
|
+
# -- inherited from EventEmitter --
|
104
|
+
# @nodoc
|
105
|
+
def on(event, callback)
|
106
|
+
event_emitter_proxy.on(event, callback)
|
107
|
+
end
|
108
|
+
|
109
109
|
private def event_emitter_proxy
|
110
110
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
111
111
|
end
|