playwright-ruby-client 1.62.0 → 1.64.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/documentation/docs/api/api_request_context.md +50 -0
- data/documentation/docs/api/browser.md +2 -0
- data/documentation/docs/api/browser_context.md +3 -3
- data/documentation/docs/api/browser_type.md +1 -0
- data/documentation/docs/api/clock.md +1 -0
- data/documentation/docs/api/credentials.md +6 -3
- data/documentation/docs/api/frame.md +18 -2
- data/documentation/docs/api/frame_locator.md +20 -0
- data/documentation/docs/api/locator.md +66 -0
- data/documentation/docs/api/page.md +44 -2
- data/documentation/docs/api/request.md +1 -1
- data/documentation/docs/api/response.md +2 -1
- data/documentation/docs/api/tracing.md +5 -3
- data/documentation/docs/api/web_mcp.md +34 -0
- data/documentation/docs/article/guides/playwright_on_alpine_linux.md +1 -1
- data/documentation/docs/include/api_coverage.md +13 -0
- data/lib/playwright/api_request_impl.rb +3 -1
- data/lib/playwright/channel.rb +2 -1
- data/lib/playwright/channel_owners/api_request_context.rb +16 -0
- data/lib/playwright/channel_owners/browser.rb +1 -0
- data/lib/playwright/channel_owners/browser_context.rb +21 -33
- data/lib/playwright/channel_owners/frame.rb +6 -5
- data/lib/playwright/channel_owners/local_utils.rb +5 -0
- data/lib/playwright/channel_owners/page.rb +12 -3
- data/lib/playwright/channel_owners/tracing.rb +45 -13
- data/lib/playwright/connection.rb +6 -2
- data/lib/playwright/credentials_impl.rb +2 -1
- data/lib/playwright/errors.rb +4 -1
- data/lib/playwright/events.rb +2 -0
- data/lib/playwright/frame_locator_impl.rb +20 -5
- data/lib/playwright/locator_impl.rb +26 -8
- data/lib/playwright/screencast.rb +4 -2
- data/lib/playwright/transport.rb +21 -5
- data/lib/playwright/utils.rb +32 -0
- data/lib/playwright/version.rb +2 -2
- data/lib/playwright/web_mcp_impl.rb +21 -0
- data/lib/playwright_api/api_request_context.rb +47 -7
- data/lib/playwright_api/browser.rb +10 -8
- data/lib/playwright_api/browser_context.rb +17 -17
- data/lib/playwright_api/browser_type.rb +8 -7
- data/lib/playwright_api/cdp_session.rb +6 -6
- data/lib/playwright_api/clock.rb +1 -0
- data/lib/playwright_api/credentials.rb +7 -4
- data/lib/playwright_api/dialog.rb +6 -6
- data/lib/playwright_api/element_handle.rb +6 -6
- data/lib/playwright_api/frame.rb +33 -16
- data/lib/playwright_api/frame_locator.rb +20 -0
- data/lib/playwright_api/js_handle.rb +6 -6
- data/lib/playwright_api/locator.rb +63 -3
- data/lib/playwright_api/page.rb +57 -17
- data/lib/playwright_api/playwright.rb +6 -6
- data/lib/playwright_api/request.rb +7 -7
- data/lib/playwright_api/response.rb +8 -7
- data/lib/playwright_api/route.rb +6 -6
- data/lib/playwright_api/tracing.rb +12 -10
- data/lib/playwright_api/web_mcp.rb +26 -0
- data/lib/playwright_api/web_socket.rb +6 -6
- data/lib/playwright_api/worker.rb +6 -6
- data/sig/playwright.rbs +26 -12
- metadata +5 -2
|
@@ -961,6 +961,26 @@ module Playwright
|
|
|
961
961
|
#
|
|
962
962
|
# Returns a new locator that uses best practices for referencing the matched element, prioritizing test ids,
|
|
963
963
|
# aria roles, and other user-facing attributes over CSS selectors. This is useful for converting implementation-detail selectors into more resilient, human-readable locators.
|
|
964
|
+
#
|
|
965
|
+
# **Usage**
|
|
966
|
+
#
|
|
967
|
+
# An agent can pick an element by its ref from an [`method: Page.ariaSnapshot`] taken in the `"ai"` mode. Refs only
|
|
968
|
+
# work for the latest snapshot. Normalize the ref locator and convert it to a string to get resilient locator code
|
|
969
|
+
# in your language, the same way `codegen` does.
|
|
970
|
+
#
|
|
971
|
+
# Consider the following aria snapshot.
|
|
972
|
+
#
|
|
973
|
+
# ```yaml
|
|
974
|
+
# - button "Submit" [ref=e2]
|
|
975
|
+
# ```
|
|
976
|
+
#
|
|
977
|
+
# You can turn the ref into locator code:
|
|
978
|
+
#
|
|
979
|
+
# ```python sync
|
|
980
|
+
# normalized = page.get_by_ref("e2").normalize()
|
|
981
|
+
# print(str(normalized))
|
|
982
|
+
# # get_by_role("button", name="Submit")
|
|
983
|
+
# ```
|
|
964
984
|
def normalize
|
|
965
985
|
wrap_impl(@impl.normalize)
|
|
966
986
|
end
|
|
@@ -1317,6 +1337,31 @@ module Playwright
|
|
|
1317
1337
|
wrap_impl(@impl.uncheck(force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), scroll: unwrap_impl(scroll), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
|
|
1318
1338
|
end
|
|
1319
1339
|
|
|
1340
|
+
#
|
|
1341
|
+
# Returns a locator that matches only [visible](../actionability.md#visible) elements, ignoring the invisible ones. This is the recommended way to distinguish elements by visibility, as opposed to the `:visible` CSS pseudo-class.
|
|
1342
|
+
#
|
|
1343
|
+
# Note that visibility is checked every time the locator is used, and not at the moment of the [`method: Locator.visible`] call.
|
|
1344
|
+
#
|
|
1345
|
+
# **Usage**
|
|
1346
|
+
#
|
|
1347
|
+
# Consider a page with two buttons, the first invisible and the second visible.
|
|
1348
|
+
#
|
|
1349
|
+
# ```html
|
|
1350
|
+
# <button style='display: none'>Invisible</button>
|
|
1351
|
+
# <button>Visible</button>
|
|
1352
|
+
# ```
|
|
1353
|
+
#
|
|
1354
|
+
# This will only find the second button, because it is visible, and then click it.
|
|
1355
|
+
#
|
|
1356
|
+
# ```python sync
|
|
1357
|
+
# page.locator("button").visible.click()
|
|
1358
|
+
# ```
|
|
1359
|
+
#
|
|
1360
|
+
# To match invisible elements instead, use [`method: Locator.filter`] with the `visible` option set to `false`.
|
|
1361
|
+
def visible
|
|
1362
|
+
wrap_impl(@impl.visible)
|
|
1363
|
+
end
|
|
1364
|
+
|
|
1320
1365
|
#
|
|
1321
1366
|
# Returns when element specified by locator satisfies the `state` option.
|
|
1322
1367
|
#
|
|
@@ -1351,9 +1396,19 @@ module Playwright
|
|
|
1351
1396
|
wrap_impl(@impl.wait_for_function(unwrap_impl(expression), arg: unwrap_impl(arg), timeout: unwrap_impl(timeout)))
|
|
1352
1397
|
end
|
|
1353
1398
|
|
|
1354
|
-
#
|
|
1355
|
-
|
|
1356
|
-
|
|
1399
|
+
#
|
|
1400
|
+
# Returns a locator that matches this locator's elements inside each element matched by `locator`.
|
|
1401
|
+
#
|
|
1402
|
+
# Note that relative locators, such as [`method: Locator.nth`] or [`method: Locator.first`], are resolved separately inside each matched parent. In the example below, `page.getByRole('cell').nth(2)` picks the third cell of every row, not the third cell in the whole table.
|
|
1403
|
+
#
|
|
1404
|
+
# **Usage**
|
|
1405
|
+
#
|
|
1406
|
+
# ```python sync
|
|
1407
|
+
# third_column = page.get_by_role("cell").nth(2).within(page.get_by_role("row"))
|
|
1408
|
+
# expect(third_column).to_have_text(["Apple", "Banana", "Cherry"])
|
|
1409
|
+
# ```
|
|
1410
|
+
def within(locator)
|
|
1411
|
+
wrap_impl(@impl.within(unwrap_impl(locator)))
|
|
1357
1412
|
end
|
|
1358
1413
|
|
|
1359
1414
|
# @nodoc
|
|
@@ -1366,6 +1421,11 @@ module Playwright
|
|
|
1366
1421
|
wrap_impl(@impl.resolve_selector)
|
|
1367
1422
|
end
|
|
1368
1423
|
|
|
1424
|
+
# @nodoc
|
|
1425
|
+
def expect(expression, options, title)
|
|
1426
|
+
wrap_impl(@impl.expect(unwrap_impl(expression), unwrap_impl(options), unwrap_impl(title)))
|
|
1427
|
+
end
|
|
1428
|
+
|
|
1369
1429
|
# @nodoc
|
|
1370
1430
|
def to_s
|
|
1371
1431
|
wrap_impl(@impl.to_s)
|
data/lib/playwright_api/page.rb
CHANGED
|
@@ -88,6 +88,14 @@ module Playwright
|
|
|
88
88
|
wrap_impl(@impl.touchscreen)
|
|
89
89
|
end
|
|
90
90
|
|
|
91
|
+
#
|
|
92
|
+
# Tools that the main frame registers through the experimental `WebMCP` browser API. Shortcut for [`property: Frame.webmcp`] of [`method: Page.mainFrame`], see `WebMCP` for details.
|
|
93
|
+
#
|
|
94
|
+
# **Usage**
|
|
95
|
+
def webmcp # property
|
|
96
|
+
wrap_impl(@impl.webmcp)
|
|
97
|
+
end
|
|
98
|
+
|
|
91
99
|
#
|
|
92
100
|
# Adds a script which would be evaluated in one of the following scenarios:
|
|
93
101
|
# - Whenever the page is navigated.
|
|
@@ -201,8 +209,8 @@ module Playwright
|
|
|
201
209
|
|
|
202
210
|
#
|
|
203
211
|
# Gets the full HTML contents of the page, including the doctype.
|
|
204
|
-
def content
|
|
205
|
-
wrap_impl(@impl.content)
|
|
212
|
+
def content(includeShadow: nil)
|
|
213
|
+
wrap_impl(@impl.content(includeShadow: unwrap_impl(includeShadow)))
|
|
206
214
|
end
|
|
207
215
|
|
|
208
216
|
#
|
|
@@ -592,6 +600,10 @@ module Playwright
|
|
|
592
600
|
# When working with iframes, you can create a frame locator that will enter the iframe and allow selecting elements
|
|
593
601
|
# in that iframe.
|
|
594
602
|
#
|
|
603
|
+
# When called without `selector`, the search starts in any frame on the page - the main frame or any of
|
|
604
|
+
# the iframes - so that you don't need to locate each iframe first. Note that the rest of the locator is resolved
|
|
605
|
+
# inside a single frame, just like any other locator. If it matches elements inside multiple frames, an error is thrown.
|
|
606
|
+
#
|
|
595
607
|
# **Usage**
|
|
596
608
|
#
|
|
597
609
|
# Following snippet locates element with text "Submit" in the iframe with id `my-frame`,
|
|
@@ -601,7 +613,14 @@ module Playwright
|
|
|
601
613
|
# locator = page.frame_locator("#my-iframe").get_by_text("Submit")
|
|
602
614
|
# locator.click()
|
|
603
615
|
# ```
|
|
604
|
-
|
|
616
|
+
#
|
|
617
|
+
# Following snippet locates a button, either in the main frame or in one of the iframes:
|
|
618
|
+
#
|
|
619
|
+
# ```python sync
|
|
620
|
+
# locator = page.frame_locator().get_by_role("button")
|
|
621
|
+
# locator.click()
|
|
622
|
+
# ```
|
|
623
|
+
def frame_locator(selector = nil)
|
|
605
624
|
wrap_impl(@impl.frame_locator(unwrap_impl(selector)))
|
|
606
625
|
end
|
|
607
626
|
|
|
@@ -676,6 +695,27 @@ module Playwright
|
|
|
676
695
|
wrap_impl(@impl.get_by_placeholder(unwrap_impl(text), exact: unwrap_impl(exact)))
|
|
677
696
|
end
|
|
678
697
|
|
|
698
|
+
#
|
|
699
|
+
# Locate element by its aria ref. Refs like `[ref=e2]` are reported by [`method: Page.ariaSnapshot`] when called with
|
|
700
|
+
# the `"ai"` mode, and resolve against the latest snapshot taken in the element's frame.
|
|
701
|
+
#
|
|
702
|
+
# **Usage**
|
|
703
|
+
#
|
|
704
|
+
# Consider the following aria snapshot.
|
|
705
|
+
#
|
|
706
|
+
# ```yaml
|
|
707
|
+
# - button "Submit" [ref=e2]
|
|
708
|
+
# ```
|
|
709
|
+
#
|
|
710
|
+
# You can locate the button by its ref:
|
|
711
|
+
#
|
|
712
|
+
# ```python sync
|
|
713
|
+
# page.get_by_ref("e2").click()
|
|
714
|
+
# ```
|
|
715
|
+
def get_by_ref(ref)
|
|
716
|
+
wrap_impl(@impl.get_by_ref(unwrap_impl(ref)))
|
|
717
|
+
end
|
|
718
|
+
|
|
679
719
|
#
|
|
680
720
|
# Allows locating elements by their [ARIA role](https://www.w3.org/TR/wai-aria-1.2/#roles), [ARIA attributes](https://www.w3.org/TR/wai-aria-1.2/#aria-attributes) and [accessible name](https://w3c.github.io/accname/#dfn-accessible-name).
|
|
681
721
|
#
|
|
@@ -1900,13 +1940,13 @@ module Playwright
|
|
|
1900
1940
|
end
|
|
1901
1941
|
|
|
1902
1942
|
# @nodoc
|
|
1903
|
-
def
|
|
1904
|
-
wrap_impl(@impl.
|
|
1943
|
+
def start_js_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
|
|
1944
|
+
wrap_impl(@impl.start_js_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
|
|
1905
1945
|
end
|
|
1906
1946
|
|
|
1907
1947
|
# @nodoc
|
|
1908
|
-
def
|
|
1909
|
-
wrap_impl(@impl.
|
|
1948
|
+
def stop_js_coverage
|
|
1949
|
+
wrap_impl(@impl.stop_js_coverage)
|
|
1910
1950
|
end
|
|
1911
1951
|
|
|
1912
1952
|
# @nodoc
|
|
@@ -1915,13 +1955,13 @@ module Playwright
|
|
|
1915
1955
|
end
|
|
1916
1956
|
|
|
1917
1957
|
# @nodoc
|
|
1918
|
-
def
|
|
1919
|
-
wrap_impl(@impl.
|
|
1958
|
+
def _assertions(timeout, is_not, message)
|
|
1959
|
+
wrap_impl(@impl._assertions(unwrap_impl(timeout), unwrap_impl(is_not), unwrap_impl(message)))
|
|
1920
1960
|
end
|
|
1921
1961
|
|
|
1922
1962
|
# @nodoc
|
|
1923
|
-
def
|
|
1924
|
-
wrap_impl(@impl.
|
|
1963
|
+
def start_css_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
|
|
1964
|
+
wrap_impl(@impl.start_css_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
|
|
1925
1965
|
end
|
|
1926
1966
|
|
|
1927
1967
|
# @nodoc
|
|
@@ -1936,20 +1976,20 @@ module Playwright
|
|
|
1936
1976
|
|
|
1937
1977
|
# -- inherited from EventEmitter --
|
|
1938
1978
|
# @nodoc
|
|
1939
|
-
def
|
|
1940
|
-
event_emitter_proxy.
|
|
1979
|
+
def off(event, callback)
|
|
1980
|
+
event_emitter_proxy.off(event, callback)
|
|
1941
1981
|
end
|
|
1942
1982
|
|
|
1943
1983
|
# -- inherited from EventEmitter --
|
|
1944
1984
|
# @nodoc
|
|
1945
|
-
def
|
|
1946
|
-
event_emitter_proxy.
|
|
1985
|
+
def once(event, callback)
|
|
1986
|
+
event_emitter_proxy.once(event, callback)
|
|
1947
1987
|
end
|
|
1948
1988
|
|
|
1949
1989
|
# -- inherited from EventEmitter --
|
|
1950
1990
|
# @nodoc
|
|
1951
|
-
def
|
|
1952
|
-
event_emitter_proxy.
|
|
1991
|
+
def on(event, callback)
|
|
1992
|
+
event_emitter_proxy.on(event, callback)
|
|
1953
1993
|
end
|
|
1954
1994
|
|
|
1955
1995
|
private def event_emitter_proxy
|
|
@@ -105,20 +105,20 @@ module Playwright
|
|
|
105
105
|
|
|
106
106
|
# -- inherited from EventEmitter --
|
|
107
107
|
# @nodoc
|
|
108
|
-
def
|
|
109
|
-
event_emitter_proxy.
|
|
108
|
+
def off(event, callback)
|
|
109
|
+
event_emitter_proxy.off(event, callback)
|
|
110
110
|
end
|
|
111
111
|
|
|
112
112
|
# -- inherited from EventEmitter --
|
|
113
113
|
# @nodoc
|
|
114
|
-
def
|
|
115
|
-
event_emitter_proxy.
|
|
114
|
+
def once(event, callback)
|
|
115
|
+
event_emitter_proxy.once(event, callback)
|
|
116
116
|
end
|
|
117
117
|
|
|
118
118
|
# -- inherited from EventEmitter --
|
|
119
119
|
# @nodoc
|
|
120
|
-
def
|
|
121
|
-
event_emitter_proxy.
|
|
120
|
+
def on(event, callback)
|
|
121
|
+
event_emitter_proxy.on(event, callback)
|
|
122
122
|
end
|
|
123
123
|
|
|
124
124
|
private def event_emitter_proxy
|
|
@@ -155,7 +155,7 @@ module Playwright
|
|
|
155
155
|
#
|
|
156
156
|
# Contains the request's resource type as it was perceived by the rendering engine. ResourceType will be one of the
|
|
157
157
|
# following: `document`, `stylesheet`, `image`, `media`, `font`, `script`, `texttrack`, `xhr`, `fetch`, `eventsource`,
|
|
158
|
-
# `websocket`, `manifest`, `other`.
|
|
158
|
+
# `websocket`, `manifest`, `beacon`, `ping`, `cspreport`, `other`.
|
|
159
159
|
def resource_type
|
|
160
160
|
wrap_impl(@impl.resource_type)
|
|
161
161
|
end
|
|
@@ -229,20 +229,20 @@ module Playwright
|
|
|
229
229
|
|
|
230
230
|
# -- inherited from EventEmitter --
|
|
231
231
|
# @nodoc
|
|
232
|
-
def
|
|
233
|
-
event_emitter_proxy.
|
|
232
|
+
def off(event, callback)
|
|
233
|
+
event_emitter_proxy.off(event, callback)
|
|
234
234
|
end
|
|
235
235
|
|
|
236
236
|
# -- inherited from EventEmitter --
|
|
237
237
|
# @nodoc
|
|
238
|
-
def
|
|
239
|
-
event_emitter_proxy.
|
|
238
|
+
def once(event, callback)
|
|
239
|
+
event_emitter_proxy.once(event, callback)
|
|
240
240
|
end
|
|
241
241
|
|
|
242
242
|
# -- inherited from EventEmitter --
|
|
243
243
|
# @nodoc
|
|
244
|
-
def
|
|
245
|
-
event_emitter_proxy.
|
|
244
|
+
def on(event, callback)
|
|
245
|
+
event_emitter_proxy.on(event, callback)
|
|
246
246
|
end
|
|
247
247
|
|
|
248
248
|
private def event_emitter_proxy
|
|
@@ -42,8 +42,9 @@ module Playwright
|
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
#
|
|
45
|
-
# An array with all the
|
|
45
|
+
# An array with all the response HTTP headers associated with this response. Unlike [`method: Response.allHeaders`], header names are NOT lower-cased.
|
|
46
46
|
# Headers with multiple entries, such as `Set-Cookie`, appear in the array multiple times.
|
|
47
|
+
# Some browser network stacks combine multiple field values before reporting them, so separate entries are not always available.
|
|
47
48
|
def headers_array
|
|
48
49
|
wrap_impl(@impl.headers_array)
|
|
49
50
|
end
|
|
@@ -135,20 +136,20 @@ module Playwright
|
|
|
135
136
|
|
|
136
137
|
# -- inherited from EventEmitter --
|
|
137
138
|
# @nodoc
|
|
138
|
-
def
|
|
139
|
-
event_emitter_proxy.
|
|
139
|
+
def off(event, callback)
|
|
140
|
+
event_emitter_proxy.off(event, callback)
|
|
140
141
|
end
|
|
141
142
|
|
|
142
143
|
# -- inherited from EventEmitter --
|
|
143
144
|
# @nodoc
|
|
144
|
-
def
|
|
145
|
-
event_emitter_proxy.
|
|
145
|
+
def once(event, callback)
|
|
146
|
+
event_emitter_proxy.once(event, callback)
|
|
146
147
|
end
|
|
147
148
|
|
|
148
149
|
# -- inherited from EventEmitter --
|
|
149
150
|
# @nodoc
|
|
150
|
-
def
|
|
151
|
-
event_emitter_proxy.
|
|
151
|
+
def on(event, callback)
|
|
152
|
+
event_emitter_proxy.on(event, callback)
|
|
152
153
|
end
|
|
153
154
|
|
|
154
155
|
private def event_emitter_proxy
|
data/lib/playwright_api/route.rb
CHANGED
|
@@ -179,20 +179,20 @@ module Playwright
|
|
|
179
179
|
|
|
180
180
|
# -- inherited from EventEmitter --
|
|
181
181
|
# @nodoc
|
|
182
|
-
def
|
|
183
|
-
event_emitter_proxy.
|
|
182
|
+
def off(event, callback)
|
|
183
|
+
event_emitter_proxy.off(event, callback)
|
|
184
184
|
end
|
|
185
185
|
|
|
186
186
|
# -- inherited from EventEmitter --
|
|
187
187
|
# @nodoc
|
|
188
|
-
def
|
|
189
|
-
event_emitter_proxy.
|
|
188
|
+
def once(event, callback)
|
|
189
|
+
event_emitter_proxy.once(event, callback)
|
|
190
190
|
end
|
|
191
191
|
|
|
192
192
|
# -- inherited from EventEmitter --
|
|
193
193
|
# @nodoc
|
|
194
|
-
def
|
|
195
|
-
event_emitter_proxy.
|
|
194
|
+
def on(event, callback)
|
|
195
|
+
event_emitter_proxy.on(event, callback)
|
|
196
196
|
end
|
|
197
197
|
|
|
198
198
|
private def event_emitter_proxy
|
|
@@ -19,7 +19,7 @@ module Playwright
|
|
|
19
19
|
class Tracing < PlaywrightApi
|
|
20
20
|
|
|
21
21
|
#
|
|
22
|
-
# Start tracing.
|
|
22
|
+
# Start tracing. Disposing the returned `Disposable` stops tracing without saving the trace, similarly to calling [`method: Tracing.stop`] without a path.
|
|
23
23
|
#
|
|
24
24
|
# **NOTE**: You probably want to [enable tracing in your config file](https://playwright.dev/docs/api/class-testoptions#test-options-trace) instead of using `Tracing.start`.
|
|
25
25
|
#
|
|
@@ -34,17 +34,19 @@ module Playwright
|
|
|
34
34
|
# context.tracing.stop(path = "trace.zip")
|
|
35
35
|
# ```
|
|
36
36
|
def start(
|
|
37
|
+
ariaSnapshots: nil,
|
|
37
38
|
live: nil,
|
|
38
39
|
name: nil,
|
|
39
40
|
screenshots: nil,
|
|
41
|
+
screenSnapshots: nil,
|
|
40
42
|
snapshots: nil,
|
|
41
43
|
sources: nil,
|
|
42
44
|
title: nil)
|
|
43
|
-
wrap_impl(@impl.start(live: unwrap_impl(live), name: unwrap_impl(name), screenshots: unwrap_impl(screenshots), snapshots: unwrap_impl(snapshots), sources: unwrap_impl(sources), title: unwrap_impl(title)))
|
|
45
|
+
wrap_impl(@impl.start(ariaSnapshots: unwrap_impl(ariaSnapshots), live: unwrap_impl(live), name: unwrap_impl(name), screenshots: unwrap_impl(screenshots), screenSnapshots: unwrap_impl(screenSnapshots), snapshots: unwrap_impl(snapshots), sources: unwrap_impl(sources), title: unwrap_impl(title)))
|
|
44
46
|
end
|
|
45
47
|
|
|
46
48
|
#
|
|
47
|
-
# Start a new trace chunk. If you'd like to record multiple traces on the same `BrowserContext`, use [`method: Tracing.start`] once, and then create multiple trace chunks with [`method: Tracing.startChunk`] and [`method: Tracing.stopChunk`].
|
|
49
|
+
# Start a new trace chunk. Disposing the returned `Disposable` stops the chunk without saving it, similarly to calling [`method: Tracing.stopChunk`] without a path. If you'd like to record multiple traces on the same `BrowserContext`, use [`method: Tracing.start`] once, and then create multiple trace chunks with [`method: Tracing.startChunk`] and [`method: Tracing.stopChunk`].
|
|
48
50
|
#
|
|
49
51
|
# **Usage**
|
|
50
52
|
#
|
|
@@ -70,7 +72,7 @@ module Playwright
|
|
|
70
72
|
#
|
|
71
73
|
# Start recording a HAR (HTTP Archive) of network activity in this context. The HAR file is written to disk when [`method: Tracing.stopHar`] is called, or when the returned `Disposable` is disposed.
|
|
72
74
|
#
|
|
73
|
-
# Only one HAR recording can be active at a time per `
|
|
75
|
+
# Only one HAR recording can be active at a time per `Tracing` instance.
|
|
74
76
|
#
|
|
75
77
|
# **Usage**
|
|
76
78
|
#
|
|
@@ -129,20 +131,20 @@ module Playwright
|
|
|
129
131
|
|
|
130
132
|
# -- inherited from EventEmitter --
|
|
131
133
|
# @nodoc
|
|
132
|
-
def
|
|
133
|
-
event_emitter_proxy.
|
|
134
|
+
def off(event, callback)
|
|
135
|
+
event_emitter_proxy.off(event, callback)
|
|
134
136
|
end
|
|
135
137
|
|
|
136
138
|
# -- inherited from EventEmitter --
|
|
137
139
|
# @nodoc
|
|
138
|
-
def
|
|
139
|
-
event_emitter_proxy.
|
|
140
|
+
def once(event, callback)
|
|
141
|
+
event_emitter_proxy.once(event, callback)
|
|
140
142
|
end
|
|
141
143
|
|
|
142
144
|
# -- inherited from EventEmitter --
|
|
143
145
|
# @nodoc
|
|
144
|
-
def
|
|
145
|
-
event_emitter_proxy.
|
|
146
|
+
def on(event, callback)
|
|
147
|
+
event_emitter_proxy.on(event, callback)
|
|
146
148
|
end
|
|
147
149
|
|
|
148
150
|
private def event_emitter_proxy
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module Playwright
|
|
2
|
+
#
|
|
3
|
+
# `WebMCP` exposes the tools that a frame registers through the experimental `WebMCP` browser API, `navigator.modelContext`. It lists the tools and calls them.
|
|
4
|
+
#
|
|
5
|
+
# Instances are accessed through [`property: Frame.webmcp`]. [`property: Page.webmcp`] is the instance of the main frame.
|
|
6
|
+
#
|
|
7
|
+
# **NOTE**: WebMCP is an experimental browser feature. Chromium enables it with the `--enable-features=WebMCP` launch argument, Firefox with the `dom.modelcontext.enabled` and `dom.modelcontext.testing.enabled` preferences. WebKit does not implement it.
|
|
8
|
+
#
|
|
9
|
+
# Tool names, descriptions, input schemas and results are provided by the page, so treat them as untrusted input.
|
|
10
|
+
class WebMCP < PlaywrightApi
|
|
11
|
+
|
|
12
|
+
#
|
|
13
|
+
# Calls a tool registered by the frame and returns its result. The result is whatever the tool's `execute` function resolved to, typically an object with a `content` array. A result with `isError: true` is returned as is. The method throws when the tool is not registered or its `execute` function throws.
|
|
14
|
+
def call_tool(name, input: nil, timeout: nil)
|
|
15
|
+
wrap_impl(@impl.call_tool(unwrap_impl(name), input: unwrap_impl(input), timeout: unwrap_impl(timeout)))
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
#
|
|
19
|
+
# Returns the tools currently registered by the frame. Throws if the browser was launched without WebMCP support, see the note above for the launch options that enable it.
|
|
20
|
+
#
|
|
21
|
+
# [`property: Page.webmcp`] covers the main frame only, child frames list their tools through their own [`property: Frame.webmcp`].
|
|
22
|
+
def tools(timeout: nil)
|
|
23
|
+
wrap_impl(@impl.tools(timeout: unwrap_impl(timeout)))
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -36,20 +36,20 @@ module Playwright
|
|
|
36
36
|
|
|
37
37
|
# -- inherited from EventEmitter --
|
|
38
38
|
# @nodoc
|
|
39
|
-
def
|
|
40
|
-
event_emitter_proxy.
|
|
39
|
+
def off(event, callback)
|
|
40
|
+
event_emitter_proxy.off(event, callback)
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
# -- inherited from EventEmitter --
|
|
44
44
|
# @nodoc
|
|
45
|
-
def
|
|
46
|
-
event_emitter_proxy.
|
|
45
|
+
def once(event, callback)
|
|
46
|
+
event_emitter_proxy.once(event, callback)
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
# -- inherited from EventEmitter --
|
|
50
50
|
# @nodoc
|
|
51
|
-
def
|
|
52
|
-
event_emitter_proxy.
|
|
51
|
+
def on(event, callback)
|
|
52
|
+
event_emitter_proxy.on(event, callback)
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
private def event_emitter_proxy
|
|
@@ -75,20 +75,20 @@ module Playwright
|
|
|
75
75
|
|
|
76
76
|
# -- inherited from EventEmitter --
|
|
77
77
|
# @nodoc
|
|
78
|
-
def
|
|
79
|
-
event_emitter_proxy.
|
|
78
|
+
def off(event, callback)
|
|
79
|
+
event_emitter_proxy.off(event, callback)
|
|
80
80
|
end
|
|
81
81
|
|
|
82
82
|
# -- inherited from EventEmitter --
|
|
83
83
|
# @nodoc
|
|
84
|
-
def
|
|
85
|
-
event_emitter_proxy.
|
|
84
|
+
def once(event, callback)
|
|
85
|
+
event_emitter_proxy.once(event, callback)
|
|
86
86
|
end
|
|
87
87
|
|
|
88
88
|
# -- inherited from EventEmitter --
|
|
89
89
|
# @nodoc
|
|
90
|
-
def
|
|
91
|
-
event_emitter_proxy.
|
|
90
|
+
def on(event, callback)
|
|
91
|
+
event_emitter_proxy.on(event, callback)
|
|
92
92
|
end
|
|
93
93
|
|
|
94
94
|
private def event_emitter_proxy
|