playwright-ruby-client 1.15.beta1 → 1.16.beta1
Sign up to get free protection for your applications and to get access to all the features.
- 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 +47 -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 +23 -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 +1810 -1790
- 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 +11 -1
- 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 +12 -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 +77 -0
- data/lib/playwright_api/frame.rb +31 -6
- data/lib/playwright_api/js_handle.rb +6 -6
- data/lib/playwright_api/locator.rb +39 -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 +8 -8
- metadata +10 -4
@@ -40,6 +40,9 @@ module Playwright
|
|
40
40
|
#
|
41
41
|
# # Works because we explicitly tell locator to pick the first element:
|
42
42
|
# page.locator('button').first.click()
|
43
|
+
#
|
44
|
+
# # Works because count knows what to do with multiple matches:
|
45
|
+
# page.locator('button').count()
|
43
46
|
# ```
|
44
47
|
class Locator < PlaywrightApi
|
45
48
|
|
@@ -435,6 +438,29 @@ module Playwright
|
|
435
438
|
wrap_impl(@impl.select_text(force: unwrap_impl(force), timeout: unwrap_impl(timeout)))
|
436
439
|
end
|
437
440
|
|
441
|
+
# This method checks or unchecks an element by performing the following steps:
|
442
|
+
# 1. Ensure that matched element is a checkbox or a radio input. If not, this method throws.
|
443
|
+
# 1. If the element already has the right checked state, this method returns immediately.
|
444
|
+
# 1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the
|
445
|
+
# element is detached during the checks, the whole action is retried.
|
446
|
+
# 1. Scroll the element into view if needed.
|
447
|
+
# 1. Use [`property: Page.mouse`] to click in the center of the element.
|
448
|
+
# 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
|
449
|
+
# 1. Ensure that the element is now checked or unchecked. If not, this method throws.
|
450
|
+
#
|
451
|
+
# When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
|
452
|
+
# zero timeout disables this.
|
453
|
+
def set_checked(
|
454
|
+
checked,
|
455
|
+
force: nil,
|
456
|
+
noWaitAfter: nil,
|
457
|
+
position: nil,
|
458
|
+
timeout: nil,
|
459
|
+
trial: nil)
|
460
|
+
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)))
|
461
|
+
end
|
462
|
+
alias_method :checked=, :set_checked
|
463
|
+
|
438
464
|
# This method expects `element` to point to an
|
439
465
|
# [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).
|
440
466
|
#
|
@@ -514,6 +540,19 @@ module Playwright
|
|
514
540
|
wrap_impl(@impl.uncheck(force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
|
515
541
|
end
|
516
542
|
|
543
|
+
# Returns when element specified by locator satisfies the `state` option.
|
544
|
+
#
|
545
|
+
# If target element already satisfies the condition, the method returns immediately. Otherwise, waits for up to `timeout`
|
546
|
+
# milliseconds until the condition is met.
|
547
|
+
#
|
548
|
+
# ```python sync
|
549
|
+
# order_sent = page.locator("#order-sent")
|
550
|
+
# order_sent.wait_for()
|
551
|
+
# ```
|
552
|
+
def wait_for(state: nil, timeout: nil)
|
553
|
+
wrap_impl(@impl.wait_for(state: unwrap_impl(state), timeout: unwrap_impl(timeout)))
|
554
|
+
end
|
555
|
+
|
517
556
|
# @nodoc
|
518
557
|
def to_s
|
519
558
|
wrap_impl(@impl.to_s)
|
data/lib/playwright_api/mouse.rb
CHANGED
@@ -45,5 +45,13 @@ module Playwright
|
|
45
45
|
def up(button: nil, clickCount: nil)
|
46
46
|
wrap_impl(@impl.up(button: unwrap_impl(button), clickCount: unwrap_impl(clickCount)))
|
47
47
|
end
|
48
|
+
|
49
|
+
# Dispatches a `wheel` event.
|
50
|
+
#
|
51
|
+
# > NOTE: Wheel events may cause scrolling if they are not handled, and this method does not wait for the scrolling to
|
52
|
+
# finish before returning.
|
53
|
+
def wheel(deltaX, deltaY)
|
54
|
+
wrap_impl(@impl.wheel(unwrap_impl(deltaX), unwrap_impl(deltaY)))
|
55
|
+
end
|
48
56
|
end
|
49
57
|
end
|
data/lib/playwright_api/page.rb
CHANGED
@@ -284,8 +284,8 @@ module Playwright
|
|
284
284
|
# # → False
|
285
285
|
# page.evaluate("matchMedia('(prefers-color-scheme: no-preference)').matches")
|
286
286
|
# ```
|
287
|
-
def emulate_media(colorScheme: nil, media: nil, reducedMotion: nil)
|
288
|
-
wrap_impl(@impl.emulate_media(colorScheme: unwrap_impl(colorScheme), media: unwrap_impl(media), reducedMotion: unwrap_impl(reducedMotion)))
|
287
|
+
def emulate_media(colorScheme: nil, forcedColors: nil, media: nil, reducedMotion: nil)
|
288
|
+
wrap_impl(@impl.emulate_media(colorScheme: unwrap_impl(colorScheme), forcedColors: unwrap_impl(forcedColors), media: unwrap_impl(media), reducedMotion: unwrap_impl(reducedMotion)))
|
289
289
|
end
|
290
290
|
|
291
291
|
# The method finds an element matching the specified selector within the page and passes it as a first argument to
|
@@ -818,6 +818,9 @@ module Playwright
|
|
818
818
|
# Once routing is enabled, every request matching the url pattern will stall unless it's continued, fulfilled or aborted.
|
819
819
|
#
|
820
820
|
# > NOTE: The handler will only be called for the first url if the response is a redirect.
|
821
|
+
# > NOTE: [`method: Page.route`] will not intercept requests intercepted by Service Worker. See
|
822
|
+
# [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using
|
823
|
+
# request interception. Via `await context.addInitScript(() => delete window.navigator.serviceWorker);`
|
821
824
|
#
|
822
825
|
# An example of a naive handler that aborts all image requests:
|
823
826
|
#
|
@@ -855,8 +858,8 @@ module Playwright
|
|
855
858
|
# To remove a route with its handler you can use [`method: Page.unroute`].
|
856
859
|
#
|
857
860
|
# > NOTE: Enabling routing disables http cache.
|
858
|
-
def route(url, handler)
|
859
|
-
wrap_impl(@impl.route(unwrap_impl(url), unwrap_impl(handler)))
|
861
|
+
def route(url, handler, times: nil)
|
862
|
+
wrap_impl(@impl.route(unwrap_impl(url), unwrap_impl(handler), times: unwrap_impl(times)))
|
860
863
|
end
|
861
864
|
|
862
865
|
# Returns the buffer with the captured screenshot.
|
@@ -905,6 +908,33 @@ module Playwright
|
|
905
908
|
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)))
|
906
909
|
end
|
907
910
|
|
911
|
+
# This method checks or unchecks an element matching `selector` by performing the following steps:
|
912
|
+
# 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
|
913
|
+
# 1. Ensure that matched element is a checkbox or a radio input. If not, this method throws.
|
914
|
+
# 1. If the element already has the right checked state, this method returns immediately.
|
915
|
+
# 1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the
|
916
|
+
# element is detached during the checks, the whole action is retried.
|
917
|
+
# 1. Scroll the element into view if needed.
|
918
|
+
# 1. Use [`property: Page.mouse`] to click in the center of the element.
|
919
|
+
# 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
|
920
|
+
# 1. Ensure that the element is now checked or unchecked. If not, this method throws.
|
921
|
+
#
|
922
|
+
# When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
|
923
|
+
# zero timeout disables this.
|
924
|
+
#
|
925
|
+
# Shortcut for main frame's [`method: Frame.setChecked`].
|
926
|
+
def set_checked(
|
927
|
+
selector,
|
928
|
+
checked,
|
929
|
+
force: nil,
|
930
|
+
noWaitAfter: nil,
|
931
|
+
position: nil,
|
932
|
+
strict: nil,
|
933
|
+
timeout: nil,
|
934
|
+
trial: nil)
|
935
|
+
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)))
|
936
|
+
end
|
937
|
+
|
908
938
|
def set_content(html, timeout: nil, waitUntil: nil)
|
909
939
|
wrap_impl(@impl.set_content(unwrap_impl(html), timeout: unwrap_impl(timeout), waitUntil: unwrap_impl(waitUntil)))
|
910
940
|
end
|
@@ -1350,12 +1380,6 @@ module Playwright
|
|
1350
1380
|
wrap_impl(@impl.guid)
|
1351
1381
|
end
|
1352
1382
|
|
1353
|
-
# -- inherited from EventEmitter --
|
1354
|
-
# @nodoc
|
1355
|
-
def on(event, callback)
|
1356
|
-
event_emitter_proxy.on(event, callback)
|
1357
|
-
end
|
1358
|
-
|
1359
1383
|
# -- inherited from EventEmitter --
|
1360
1384
|
# @nodoc
|
1361
1385
|
def off(event, callback)
|
@@ -1368,6 +1392,12 @@ module Playwright
|
|
1368
1392
|
event_emitter_proxy.once(event, callback)
|
1369
1393
|
end
|
1370
1394
|
|
1395
|
+
# -- inherited from EventEmitter --
|
1396
|
+
# @nodoc
|
1397
|
+
def on(event, callback)
|
1398
|
+
event_emitter_proxy.on(event, callback)
|
1399
|
+
end
|
1400
|
+
|
1371
1401
|
private def event_emitter_proxy
|
1372
1402
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
1373
1403
|
end
|
@@ -91,12 +91,6 @@ module Playwright
|
|
91
91
|
wrap_impl(@impl.electron)
|
92
92
|
end
|
93
93
|
|
94
|
-
# -- inherited from EventEmitter --
|
95
|
-
# @nodoc
|
96
|
-
def on(event, callback)
|
97
|
-
event_emitter_proxy.on(event, callback)
|
98
|
-
end
|
99
|
-
|
100
94
|
# -- inherited from EventEmitter --
|
101
95
|
# @nodoc
|
102
96
|
def off(event, callback)
|
@@ -109,6 +103,12 @@ module Playwright
|
|
109
103
|
event_emitter_proxy.once(event, callback)
|
110
104
|
end
|
111
105
|
|
106
|
+
# -- inherited from EventEmitter --
|
107
|
+
# @nodoc
|
108
|
+
def on(event, callback)
|
109
|
+
event_emitter_proxy.on(event, callback)
|
110
|
+
end
|
111
|
+
|
112
112
|
private def event_emitter_proxy
|
113
113
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
114
114
|
end
|
@@ -14,6 +14,11 @@ module Playwright
|
|
14
14
|
# request is issued to a redirected url.
|
15
15
|
class Request < PlaywrightApi
|
16
16
|
|
17
|
+
# An object with all the request HTTP headers associated with this request. The header names are lower-cased.
|
18
|
+
def all_headers
|
19
|
+
wrap_impl(@impl.all_headers)
|
20
|
+
end
|
21
|
+
|
17
22
|
# The method returns `null` unless this request has failed, as reported by `requestfailed` event.
|
18
23
|
#
|
19
24
|
# Example of logging of all the failed requests:
|
@@ -30,11 +35,22 @@ module Playwright
|
|
30
35
|
wrap_impl(@impl.frame)
|
31
36
|
end
|
32
37
|
|
33
|
-
#
|
38
|
+
# **DEPRECATED** Incomplete list of headers as seen by the rendering engine. Use [`method: Request.allHeaders`] instead.
|
34
39
|
def headers
|
35
40
|
wrap_impl(@impl.headers)
|
36
41
|
end
|
37
42
|
|
43
|
+
# An array with all the request HTTP headers associated with this request. Unlike [`method: Request.allHeaders`], header
|
44
|
+
# names are NOT lower-cased. Headers with multiple entries, such as `Set-Cookie`, appear in the array multiple times.
|
45
|
+
def headers_array
|
46
|
+
wrap_impl(@impl.headers_array)
|
47
|
+
end
|
48
|
+
|
49
|
+
# Returns the value of the header matching the name. The name is case insensitive.
|
50
|
+
def header_value(name)
|
51
|
+
wrap_impl(@impl.header_value(unwrap_impl(name)))
|
52
|
+
end
|
53
|
+
|
38
54
|
# Whether this request is driving frame's navigation.
|
39
55
|
def navigation_request?
|
40
56
|
wrap_impl(@impl.navigation_request?)
|
@@ -109,6 +125,11 @@ module Playwright
|
|
109
125
|
wrap_impl(@impl.response)
|
110
126
|
end
|
111
127
|
|
128
|
+
# Returns resource size information for given request.
|
129
|
+
def sizes
|
130
|
+
wrap_impl(@impl.sizes)
|
131
|
+
end
|
132
|
+
|
112
133
|
# Returns resource timing information for given request. Most of the timing values become available upon the response,
|
113
134
|
# `responseEnd` becomes available when request finishes. Find more information at
|
114
135
|
# [Resource Timing API](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming).
|
@@ -128,10 +149,9 @@ module Playwright
|
|
128
149
|
wrap_impl(@impl.url)
|
129
150
|
end
|
130
151
|
|
131
|
-
# -- inherited from EventEmitter --
|
132
152
|
# @nodoc
|
133
|
-
def
|
134
|
-
|
153
|
+
def header_values(name)
|
154
|
+
wrap_impl(@impl.header_values(unwrap_impl(name)))
|
135
155
|
end
|
136
156
|
|
137
157
|
# -- inherited from EventEmitter --
|
@@ -146,6 +166,12 @@ module Playwright
|
|
146
166
|
event_emitter_proxy.once(event, callback)
|
147
167
|
end
|
148
168
|
|
169
|
+
# -- inherited from EventEmitter --
|
170
|
+
# @nodoc
|
171
|
+
def on(event, callback)
|
172
|
+
event_emitter_proxy.on(event, callback)
|
173
|
+
end
|
174
|
+
|
149
175
|
private def event_emitter_proxy
|
150
176
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
151
177
|
end
|
@@ -2,12 +2,17 @@ module Playwright
|
|
2
2
|
# `Response` class represents responses which are received by page.
|
3
3
|
class Response < PlaywrightApi
|
4
4
|
|
5
|
+
# An object with all the response HTTP headers associated with this response.
|
6
|
+
def all_headers
|
7
|
+
wrap_impl(@impl.all_headers)
|
8
|
+
end
|
9
|
+
|
5
10
|
# Returns the buffer with response body.
|
6
11
|
def body
|
7
12
|
wrap_impl(@impl.body)
|
8
13
|
end
|
9
14
|
|
10
|
-
# Waits for this response to finish, returns
|
15
|
+
# Waits for this response to finish, returns always `null`.
|
11
16
|
def finished
|
12
17
|
wrap_impl(@impl.finished)
|
13
18
|
end
|
@@ -17,11 +22,29 @@ module Playwright
|
|
17
22
|
wrap_impl(@impl.frame)
|
18
23
|
end
|
19
24
|
|
20
|
-
#
|
25
|
+
# **DEPRECATED** Incomplete list of headers as seen by the rendering engine. Use [`method: Response.allHeaders`] instead.
|
21
26
|
def headers
|
22
27
|
wrap_impl(@impl.headers)
|
23
28
|
end
|
24
29
|
|
30
|
+
# An array with all the request HTTP headers associated with this response. Unlike [`method: Response.allHeaders`], header
|
31
|
+
# names are NOT lower-cased. Headers with multiple entries, such as `Set-Cookie`, appear in the array multiple times.
|
32
|
+
def headers_array
|
33
|
+
wrap_impl(@impl.headers_array)
|
34
|
+
end
|
35
|
+
|
36
|
+
# Returns the value of the header matching the name. The name is case insensitive. If multiple headers have the same name
|
37
|
+
# (except `set-cookie`), they are returned as a list separated by `, `. For `set-cookie`, the `\n` separator is used. If
|
38
|
+
# no headers are found, `null` is returned.
|
39
|
+
def header_value(name)
|
40
|
+
wrap_impl(@impl.header_value(unwrap_impl(name)))
|
41
|
+
end
|
42
|
+
|
43
|
+
# Returns all values of the headers matching the name, for example `set-cookie`. The name is case insensitive.
|
44
|
+
def header_values(name)
|
45
|
+
wrap_impl(@impl.header_values(unwrap_impl(name)))
|
46
|
+
end
|
47
|
+
|
25
48
|
# Returns the JSON representation of response body.
|
26
49
|
#
|
27
50
|
# This method will throw if the response body is not parsable via `JSON.parse`.
|
@@ -74,12 +97,6 @@ module Playwright
|
|
74
97
|
wrap_impl(@impl.ok?)
|
75
98
|
end
|
76
99
|
|
77
|
-
# -- inherited from EventEmitter --
|
78
|
-
# @nodoc
|
79
|
-
def on(event, callback)
|
80
|
-
event_emitter_proxy.on(event, callback)
|
81
|
-
end
|
82
|
-
|
83
100
|
# -- inherited from EventEmitter --
|
84
101
|
# @nodoc
|
85
102
|
def off(event, callback)
|
@@ -92,6 +109,12 @@ module Playwright
|
|
92
109
|
event_emitter_proxy.once(event, callback)
|
93
110
|
end
|
94
111
|
|
112
|
+
# -- inherited from EventEmitter --
|
113
|
+
# @nodoc
|
114
|
+
def on(event, callback)
|
115
|
+
event_emitter_proxy.on(event, callback)
|
116
|
+
end
|
117
|
+
|
95
118
|
private def event_emitter_proxy
|
96
119
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
97
120
|
end
|
data/lib/playwright_api/route.rb
CHANGED
@@ -56,12 +56,6 @@ module Playwright
|
|
56
56
|
wrap_impl(@impl.request)
|
57
57
|
end
|
58
58
|
|
59
|
-
# -- inherited from EventEmitter --
|
60
|
-
# @nodoc
|
61
|
-
def on(event, callback)
|
62
|
-
event_emitter_proxy.on(event, callback)
|
63
|
-
end
|
64
|
-
|
65
59
|
# -- inherited from EventEmitter --
|
66
60
|
# @nodoc
|
67
61
|
def off(event, callback)
|
@@ -74,6 +68,12 @@ module Playwright
|
|
74
68
|
event_emitter_proxy.once(event, callback)
|
75
69
|
end
|
76
70
|
|
71
|
+
# -- inherited from EventEmitter --
|
72
|
+
# @nodoc
|
73
|
+
def on(event, callback)
|
74
|
+
event_emitter_proxy.on(event, callback)
|
75
|
+
end
|
76
|
+
|
77
77
|
private def event_emitter_proxy
|
78
78
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
79
79
|
end
|
@@ -43,12 +43,6 @@ module Playwright
|
|
43
43
|
wrap_impl(@impl.register(unwrap_impl(name), contentScript: unwrap_impl(contentScript), path: unwrap_impl(path), script: unwrap_impl(script)))
|
44
44
|
end
|
45
45
|
|
46
|
-
# -- inherited from EventEmitter --
|
47
|
-
# @nodoc
|
48
|
-
def on(event, callback)
|
49
|
-
event_emitter_proxy.on(event, callback)
|
50
|
-
end
|
51
|
-
|
52
46
|
# -- inherited from EventEmitter --
|
53
47
|
# @nodoc
|
54
48
|
def off(event, callback)
|
@@ -61,6 +55,12 @@ module Playwright
|
|
61
55
|
event_emitter_proxy.once(event, callback)
|
62
56
|
end
|
63
57
|
|
58
|
+
# -- inherited from EventEmitter --
|
59
|
+
# @nodoc
|
60
|
+
def on(event, callback)
|
61
|
+
event_emitter_proxy.on(event, callback)
|
62
|
+
end
|
63
|
+
|
64
64
|
private def event_emitter_proxy
|
65
65
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
66
66
|
end
|
@@ -1,13 +1,14 @@
|
|
1
1
|
module Playwright
|
2
|
-
# API for collecting and saving Playwright traces. Playwright traces can be opened
|
3
|
-
# Playwright script runs.
|
2
|
+
# API for collecting and saving Playwright traces. Playwright traces can be opened in [Trace Viewer](./trace-viewer.md)
|
3
|
+
# after Playwright script runs.
|
4
4
|
#
|
5
|
-
# Start
|
5
|
+
# Start recording a trace before performing actions. At the end, stop tracing and save it to a file.
|
6
6
|
#
|
7
7
|
# ```python sync
|
8
8
|
# browser = chromium.launch()
|
9
9
|
# context = browser.new_context()
|
10
10
|
# context.tracing.start(screenshots=True, snapshots=True)
|
11
|
+
# page = context.new_page()
|
11
12
|
# page.goto("https://playwright.dev")
|
12
13
|
# context.tracing.stop(path = "trace.zip")
|
13
14
|
# ```
|
@@ -17,17 +18,45 @@ module Playwright
|
|
17
18
|
#
|
18
19
|
# ```python sync
|
19
20
|
# context.tracing.start(name="trace", screenshots=True, snapshots=True)
|
21
|
+
# page = context.new_page()
|
20
22
|
# page.goto("https://playwright.dev")
|
21
|
-
# context.tracing.stop()
|
22
23
|
# context.tracing.stop(path = "trace.zip")
|
23
24
|
# ```
|
24
25
|
def start(name: nil, screenshots: nil, snapshots: nil)
|
25
26
|
wrap_impl(@impl.start(name: unwrap_impl(name), screenshots: unwrap_impl(screenshots), snapshots: unwrap_impl(snapshots)))
|
26
27
|
end
|
27
28
|
|
29
|
+
# Start a new trace chunk. If you'd like to record multiple traces on the same `BrowserContext`, use
|
30
|
+
# [`method: Tracing.start`] once, and then create multiple trace chunks with [`method: Tracing.startChunk`] and
|
31
|
+
# [`method: Tracing.stopChunk`].
|
32
|
+
#
|
33
|
+
# ```python sync
|
34
|
+
# context.tracing.start(name="trace", screenshots=True, snapshots=True)
|
35
|
+
# page = context.new_page()
|
36
|
+
# page.goto("https://playwright.dev")
|
37
|
+
#
|
38
|
+
# context.tracing.start_chunk()
|
39
|
+
# page.click("text=Get Started")
|
40
|
+
# # Everything between start_chunk and stop_chunk will be recorded in the trace.
|
41
|
+
# context.tracing.stop_chunk(path = "trace1.zip")
|
42
|
+
#
|
43
|
+
# context.tracing.start_chunk()
|
44
|
+
# page.goto("http://example.com")
|
45
|
+
# # Save a second trace file with different actions.
|
46
|
+
# context.tracing.stop_chunk(path = "trace2.zip")
|
47
|
+
# ```
|
48
|
+
def start_chunk
|
49
|
+
wrap_impl(@impl.start_chunk)
|
50
|
+
end
|
51
|
+
|
28
52
|
# Stop tracing.
|
29
53
|
def stop(path: nil)
|
30
54
|
wrap_impl(@impl.stop(path: unwrap_impl(path)))
|
31
55
|
end
|
56
|
+
|
57
|
+
# Stop the trace chunk. See [`method: Tracing.startChunk`] for more details about multiple trace chunks.
|
58
|
+
def stop_chunk(path: nil)
|
59
|
+
wrap_impl(@impl.stop_chunk(path: unwrap_impl(path)))
|
60
|
+
end
|
32
61
|
end
|
33
62
|
end
|
@@ -27,12 +27,6 @@ module Playwright
|
|
27
27
|
wrap_impl(@impl.wait_for_event(unwrap_impl(event), predicate: unwrap_impl(predicate), timeout: unwrap_impl(timeout), &wrap_block_call(block)))
|
28
28
|
end
|
29
29
|
|
30
|
-
# -- inherited from EventEmitter --
|
31
|
-
# @nodoc
|
32
|
-
def on(event, callback)
|
33
|
-
event_emitter_proxy.on(event, callback)
|
34
|
-
end
|
35
|
-
|
36
30
|
# -- inherited from EventEmitter --
|
37
31
|
# @nodoc
|
38
32
|
def off(event, callback)
|
@@ -45,6 +39,12 @@ module Playwright
|
|
45
39
|
event_emitter_proxy.once(event, callback)
|
46
40
|
end
|
47
41
|
|
42
|
+
# -- inherited from EventEmitter --
|
43
|
+
# @nodoc
|
44
|
+
def on(event, callback)
|
45
|
+
event_emitter_proxy.on(event, callback)
|
46
|
+
end
|
47
|
+
|
48
48
|
private def event_emitter_proxy
|
49
49
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
50
50
|
end
|
@@ -43,20 +43,14 @@ module Playwright
|
|
43
43
|
wrap_impl(@impl.url)
|
44
44
|
end
|
45
45
|
|
46
|
-
# @nodoc
|
47
|
-
def context=(req)
|
48
|
-
wrap_impl(@impl.context=(unwrap_impl(req)))
|
49
|
-
end
|
50
|
-
|
51
46
|
# @nodoc
|
52
47
|
def page=(req)
|
53
48
|
wrap_impl(@impl.page=(unwrap_impl(req)))
|
54
49
|
end
|
55
50
|
|
56
|
-
# -- inherited from EventEmitter --
|
57
51
|
# @nodoc
|
58
|
-
def
|
59
|
-
|
52
|
+
def context=(req)
|
53
|
+
wrap_impl(@impl.context=(unwrap_impl(req)))
|
60
54
|
end
|
61
55
|
|
62
56
|
# -- inherited from EventEmitter --
|
@@ -71,6 +65,12 @@ module Playwright
|
|
71
65
|
event_emitter_proxy.once(event, callback)
|
72
66
|
end
|
73
67
|
|
68
|
+
# -- inherited from EventEmitter --
|
69
|
+
# @nodoc
|
70
|
+
def on(event, callback)
|
71
|
+
event_emitter_proxy.on(event, callback)
|
72
|
+
end
|
73
|
+
|
74
74
|
private def event_emitter_proxy
|
75
75
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
76
76
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: playwright-ruby-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.16.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- YusukeIwaki
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -224,6 +224,7 @@ files:
|
|
224
224
|
- documentation/docs/api/experimental/android_input.md
|
225
225
|
- documentation/docs/api/experimental/android_socket.md
|
226
226
|
- documentation/docs/api/experimental/android_web_view.md
|
227
|
+
- documentation/docs/api/fetch_request.md
|
227
228
|
- documentation/docs/api/file_chooser.md
|
228
229
|
- documentation/docs/api/frame.md
|
229
230
|
- documentation/docs/api/js_handle.md
|
@@ -248,6 +249,7 @@ files:
|
|
248
249
|
- documentation/docs/article/guides/launch_browser.md
|
249
250
|
- documentation/docs/article/guides/playwright_on_alpine_linux.md
|
250
251
|
- documentation/docs/article/guides/rails_integration.md
|
252
|
+
- documentation/docs/article/guides/rails_integration_with_null_driver.md
|
251
253
|
- documentation/docs/article/guides/recording_video.md
|
252
254
|
- documentation/docs/article/guides/semi_automation.md
|
253
255
|
- documentation/docs/article/guides/use_storage_state.md
|
@@ -263,6 +265,7 @@ files:
|
|
263
265
|
- documentation/src/pages/markdown-page.md
|
264
266
|
- documentation/static/.nojekyll
|
265
267
|
- documentation/static/img/playwright-logo.svg
|
268
|
+
- documentation/static/img/playwright-ruby-client.png
|
266
269
|
- documentation/static/img/undraw_dropdown_menu.svg
|
267
270
|
- documentation/static/img/undraw_web_development.svg
|
268
271
|
- documentation/static/img/undraw_windows.svg
|
@@ -285,6 +288,7 @@ files:
|
|
285
288
|
- lib/playwright/channel_owners/dialog.rb
|
286
289
|
- lib/playwright/channel_owners/electron.rb
|
287
290
|
- lib/playwright/channel_owners/element_handle.rb
|
291
|
+
- lib/playwright/channel_owners/fetch_request.rb
|
288
292
|
- lib/playwright/channel_owners/frame.rb
|
289
293
|
- lib/playwright/channel_owners/js_handle.rb
|
290
294
|
- lib/playwright/channel_owners/page.rb
|
@@ -313,7 +317,8 @@ files:
|
|
313
317
|
- lib/playwright/locator_impl.rb
|
314
318
|
- lib/playwright/mouse_impl.rb
|
315
319
|
- lib/playwright/playwright_api.rb
|
316
|
-
- lib/playwright/
|
320
|
+
- lib/playwright/raw_headers.rb
|
321
|
+
- lib/playwright/route_handler.rb
|
317
322
|
- lib/playwright/select_option_values.rb
|
318
323
|
- lib/playwright/timeout_settings.rb
|
319
324
|
- lib/playwright/touchscreen_impl.rb
|
@@ -340,6 +345,7 @@ files:
|
|
340
345
|
- lib/playwright_api/dialog.rb
|
341
346
|
- lib/playwright_api/download.rb
|
342
347
|
- lib/playwright_api/element_handle.rb
|
348
|
+
- lib/playwright_api/fetch_request.rb
|
343
349
|
- lib/playwright_api/file_chooser.rb
|
344
350
|
- lib/playwright_api/frame.rb
|
345
351
|
- lib/playwright_api/js_handle.rb
|
@@ -379,5 +385,5 @@ requirements: []
|
|
379
385
|
rubygems_version: 3.2.22
|
380
386
|
signing_key:
|
381
387
|
specification_version: 4
|
382
|
-
summary: The Ruby binding of playwright driver 1.
|
388
|
+
summary: The Ruby binding of playwright driver 1.16.0
|
383
389
|
test_files: []
|