patchright-bun-core 1.58.2 → 1.59.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.
- package/ThirdPartyNotices.txt +126 -650
- package/browsers.json +16 -14
- package/lib/bootstrap.js +77 -0
- package/lib/cli/browserActions.js +308 -0
- package/lib/cli/driver.js +3 -2
- package/lib/cli/installActions.js +171 -0
- package/lib/cli/program.js +47 -411
- package/lib/client/android.js +4 -4
- package/lib/client/api.js +3 -3
- package/lib/client/browser.js +8 -0
- package/lib/client/browserContext.js +18 -37
- package/lib/client/browserType.js +19 -51
- package/lib/client/cdpSession.js +6 -2
- package/lib/client/channelOwner.js +1 -1
- package/lib/client/{webSocket.js → connect.js} +57 -7
- package/lib/client/connection.js +8 -4
- package/lib/client/consoleMessage.js +3 -0
- package/lib/client/debugger.js +57 -0
- package/lib/client/dialog.js +8 -1
- package/lib/client/disposable.js +76 -0
- package/lib/client/electron.js +1 -0
- package/lib/client/elementHandle.js +1 -4
- package/lib/client/events.js +3 -3
- package/lib/client/fetch.js +0 -1
- package/lib/client/frame.js +0 -5
- package/lib/client/harRouter.js +13 -1
- package/lib/client/jsHandle.js +0 -4
- package/lib/client/locator.js +5 -7
- package/lib/client/network.js +14 -11
- package/lib/client/page.js +34 -48
- package/lib/client/platform.js +0 -3
- package/lib/client/screencast.js +88 -0
- package/lib/client/selectors.js +3 -1
- package/lib/client/tracing.js +11 -4
- package/lib/client/video.js +13 -20
- package/lib/generated/bindingsControllerSource.js +1 -1
- package/lib/generated/clockSource.js +1 -1
- package/lib/generated/injectedScriptSource.js +1 -1
- package/lib/generated/pollingRecorderSource.js +1 -1
- package/lib/generated/storageScriptSource.js +1 -1
- package/lib/generated/utilityScriptSource.js +1 -1
- package/lib/mcpBundle.js +0 -6
- package/lib/mcpBundleImpl.js +91 -0
- package/lib/protocol/validator.js +216 -118
- package/lib/protocol/validatorPrimitives.js +1 -1
- package/lib/remote/playwrightConnection.js +10 -8
- package/lib/remote/playwrightPipeServer.js +100 -0
- package/lib/remote/playwrightServer.js +13 -8
- package/lib/remote/playwrightWebSocketServer.js +73 -0
- package/lib/remote/serverTransport.js +96 -0
- package/lib/server/android/android.js +2 -2
- package/lib/server/bidi/bidiBrowser.js +30 -8
- package/lib/server/bidi/bidiChromium.js +18 -5
- package/lib/server/bidi/bidiNetworkManager.js +39 -11
- package/lib/server/bidi/bidiPage.js +31 -15
- package/lib/server/bidi/third_party/firefoxPrefs.js +3 -1
- package/lib/server/browser.js +84 -21
- package/lib/server/browserContext.js +97 -58
- package/lib/server/browserType.js +14 -12
- package/lib/server/chromium/chromium.js +15 -13
- package/lib/server/chromium/crBrowser.js +18 -10
- package/lib/server/chromium/crNetworkManager.js +4 -4
- package/lib/server/chromium/crPage.js +26 -64
- package/lib/server/chromium/crServiceWorker.js +5 -4
- package/lib/server/clock.js +33 -33
- package/lib/server/console.js +5 -1
- package/lib/server/debugController.js +12 -6
- package/lib/server/debugger.js +40 -47
- package/lib/server/deviceDescriptorsSource.json +137 -137
- package/lib/server/dispatchers/browserContextDispatcher.js +27 -30
- package/lib/server/dispatchers/browserDispatcher.js +11 -5
- package/lib/server/dispatchers/browserTypeDispatcher.js +7 -0
- package/lib/server/dispatchers/cdpSessionDispatcher.js +4 -1
- package/lib/server/dispatchers/debuggerDispatcher.js +84 -0
- package/lib/server/dispatchers/dispatcher.js +1 -1
- package/lib/server/dispatchers/disposableDispatcher.js +39 -0
- package/lib/server/dispatchers/electronDispatcher.js +2 -1
- package/lib/server/dispatchers/frameDispatcher.js +3 -3
- package/lib/server/dispatchers/localUtilsDispatcher.js +37 -1
- package/lib/server/dispatchers/networkDispatchers.js +6 -5
- package/lib/server/dispatchers/pageDispatcher.js +101 -38
- package/lib/server/dispatchers/webSocketRouteDispatcher.js +4 -5
- package/lib/server/disposable.js +41 -0
- package/lib/server/dom.js +44 -26
- package/lib/server/download.js +3 -2
- package/lib/server/electron/electron.js +12 -7
- package/lib/server/firefox/ffBrowser.js +9 -19
- package/lib/server/firefox/ffInput.js +21 -5
- package/lib/server/firefox/ffNetworkManager.js +2 -2
- package/lib/server/firefox/ffPage.js +24 -27
- package/lib/server/frames.js +40 -11
- package/lib/server/har/harRecorder.js +2 -2
- package/lib/server/har/harTracer.js +5 -4
- package/lib/server/input.js +49 -4
- package/lib/server/instrumentation.js +5 -0
- package/lib/server/launchApp.js +0 -1
- package/lib/server/localUtils.js +6 -6
- package/lib/server/network.js +9 -8
- package/lib/server/overlay.js +138 -0
- package/lib/server/page.js +111 -51
- package/lib/server/progress.js +6 -0
- package/lib/server/recorder/recorderApp.js +9 -8
- package/lib/server/recorder.js +76 -40
- package/lib/server/registry/index.js +54 -81
- package/lib/server/registry/nativeDeps.js +1 -0
- package/lib/server/screencast.js +90 -143
- package/lib/server/trace/recorder/snapshotter.js +2 -2
- package/lib/server/trace/recorder/tracing.js +87 -36
- package/lib/server/trace/viewer/traceViewer.js +3 -4
- package/lib/server/usKeyboardLayout.js +7 -0
- package/lib/server/utils/comparators.js +1 -1
- package/lib/server/utils/disposable.js +32 -0
- package/lib/server/utils/eventsHelper.js +3 -1
- package/lib/server/utils/fileUtils.js +16 -2
- package/lib/server/utils/happyEyeballs.js +15 -12
- package/lib/server/utils/hostPlatform.js +0 -15
- package/lib/server/utils/httpServer.js +5 -3
- package/lib/server/utils/network.js +2 -1
- package/lib/server/utils/nodePlatform.js +0 -6
- package/lib/server/utils/processLauncher.js +8 -6
- package/lib/server/utils/zipFile.js +2 -2
- package/lib/server/videoRecorder.js +82 -12
- package/lib/server/webkit/wkBrowser.js +1 -6
- package/lib/server/webkit/wkPage.js +27 -25
- package/lib/server/webkit/wkWorkers.js +2 -1
- package/lib/serverRegistry.js +156 -0
- package/lib/tools/backend/browserBackend.js +79 -0
- package/lib/tools/backend/common.js +63 -0
- package/lib/tools/backend/config.js +41 -0
- package/lib/tools/backend/console.js +66 -0
- package/lib/tools/backend/context.js +296 -0
- package/lib/tools/backend/cookies.js +152 -0
- package/lib/tools/backend/devtools.js +69 -0
- package/lib/tools/backend/dialogs.js +59 -0
- package/lib/tools/backend/evaluate.js +64 -0
- package/lib/tools/backend/files.js +60 -0
- package/lib/tools/backend/form.js +64 -0
- package/lib/tools/backend/keyboard.js +155 -0
- package/lib/tools/backend/logFile.js +95 -0
- package/lib/tools/backend/mouse.js +168 -0
- package/lib/tools/backend/navigate.js +106 -0
- package/lib/tools/backend/network.js +135 -0
- package/lib/tools/backend/pdf.js +48 -0
- package/lib/tools/backend/response.js +305 -0
- package/lib/tools/backend/route.js +140 -0
- package/lib/tools/backend/runCode.js +77 -0
- package/lib/tools/backend/screenshot.js +88 -0
- package/lib/tools/backend/sessionLog.js +74 -0
- package/lib/tools/backend/snapshot.js +208 -0
- package/lib/tools/backend/storage.js +68 -0
- package/lib/tools/backend/tab.js +445 -0
- package/lib/tools/backend/tabs.js +67 -0
- package/lib/tools/backend/tool.js +47 -0
- package/lib/tools/backend/tools.js +102 -0
- package/lib/tools/backend/tracing.js +78 -0
- package/lib/tools/backend/utils.js +83 -0
- package/lib/tools/backend/verify.js +151 -0
- package/lib/tools/backend/video.js +98 -0
- package/lib/tools/backend/wait.js +63 -0
- package/lib/tools/backend/webstorage.js +223 -0
- package/lib/tools/cli-client/cli.js +6 -0
- package/lib/tools/cli-client/help.json +399 -0
- package/lib/tools/cli-client/minimist.js +128 -0
- package/lib/tools/cli-client/program.js +350 -0
- package/lib/tools/cli-client/registry.js +176 -0
- package/lib/tools/cli-client/session.js +289 -0
- package/lib/tools/cli-client/skill/SKILL.md +328 -0
- package/lib/tools/cli-client/skill/references/element-attributes.md +23 -0
- package/lib/tools/cli-client/skill/references/playwright-tests.md +39 -0
- package/lib/tools/cli-client/skill/references/request-mocking.md +87 -0
- package/lib/tools/cli-client/skill/references/running-code.md +231 -0
- package/lib/tools/cli-client/skill/references/session-management.md +169 -0
- package/lib/tools/cli-client/skill/references/storage-state.md +275 -0
- package/lib/tools/cli-client/skill/references/test-generation.md +88 -0
- package/lib/tools/cli-client/skill/references/tracing.md +139 -0
- package/lib/tools/cli-client/skill/references/video-recording.md +143 -0
- package/lib/tools/cli-daemon/command.js +73 -0
- package/lib/tools/cli-daemon/commands.js +956 -0
- package/lib/tools/cli-daemon/daemon.js +157 -0
- package/lib/tools/cli-daemon/helpGenerator.js +177 -0
- package/lib/tools/cli-daemon/program.js +129 -0
- package/lib/tools/dashboard/appIcon.png +0 -0
- package/lib/tools/dashboard/dashboardApp.js +284 -0
- package/lib/tools/dashboard/dashboardController.js +296 -0
- package/lib/tools/exports.js +60 -0
- package/lib/tools/mcp/browserFactory.js +233 -0
- package/lib/tools/mcp/cdpRelay.js +352 -0
- package/lib/tools/mcp/cli-stub.js +7 -0
- package/lib/tools/mcp/config.d.js +16 -0
- package/lib/tools/mcp/config.js +446 -0
- package/lib/tools/mcp/configIni.js +189 -0
- package/lib/tools/mcp/extensionContextFactory.js +55 -0
- package/lib/tools/mcp/index.js +62 -0
- package/lib/tools/mcp/log.js +35 -0
- package/lib/tools/mcp/program.js +107 -0
- package/lib/tools/mcp/protocol.js +28 -0
- package/lib/tools/mcp/watchdog.js +44 -0
- package/lib/tools/trace/SKILL.md +171 -0
- package/lib/{server/trace/viewer/traceParser.js → tools/trace/installSkill.js} +15 -39
- package/lib/tools/trace/traceActions.js +142 -0
- package/lib/tools/trace/traceAttachments.js +69 -0
- package/lib/tools/trace/traceCli.js +87 -0
- package/lib/tools/trace/traceConsole.js +97 -0
- package/lib/tools/trace/traceErrors.js +55 -0
- package/lib/tools/trace/traceOpen.js +69 -0
- package/lib/tools/trace/traceParser.js +96 -0
- package/lib/tools/trace/traceRequests.js +182 -0
- package/lib/tools/trace/traceScreenshot.js +68 -0
- package/lib/tools/trace/traceSnapshot.js +149 -0
- package/lib/tools/trace/traceUtils.js +153 -0
- package/lib/tools/utils/connect.js +32 -0
- package/lib/tools/utils/mcp/http.js +152 -0
- package/lib/tools/utils/mcp/server.js +230 -0
- package/lib/tools/utils/mcp/tool.js +47 -0
- package/lib/tools/utils/socketConnection.js +108 -0
- package/lib/utils/isomorphic/formatUtils.js +64 -0
- package/lib/utils/isomorphic/jsonSchema.js +89 -0
- package/lib/utils/isomorphic/mimeType.js +7 -2
- package/lib/utils/isomorphic/protocolFormatter.js +2 -2
- package/lib/utils/isomorphic/protocolMetainfo.js +127 -106
- package/lib/utils/isomorphic/stringUtils.js +3 -3
- package/lib/utils/isomorphic/timeoutRunner.js +3 -3
- package/lib/utils/isomorphic/trace/snapshotRenderer.js +35 -42
- package/lib/utils/isomorphic/trace/traceLoader.js +15 -14
- package/lib/utils/isomorphic/trace/traceModel.js +3 -2
- package/lib/utils/isomorphic/trace/traceModernizer.js +1 -0
- package/lib/utils/isomorphic/urlMatch.js +54 -1
- package/lib/utils/isomorphic/utilityScriptSerializers.js +11 -0
- package/lib/utils.js +6 -2
- package/lib/utilsBundle.js +3 -21
- package/lib/utilsBundleImpl/index.js +132 -133
- package/lib/vite/dashboard/assets/index-BAOybkp8.js +50 -0
- package/lib/vite/dashboard/assets/index-CZAYOG76.css +1 -0
- package/lib/vite/dashboard/index.html +28 -0
- package/lib/vite/htmlReport/index.html +2 -70
- package/lib/vite/htmlReport/report.css +1 -0
- package/lib/vite/htmlReport/report.js +72 -0
- package/lib/vite/recorder/assets/{codeMirrorModule-DadYNm1I.js → codeMirrorModule-C8KMvO9L.js} +20 -20
- package/lib/vite/recorder/assets/index-CqAYX1I3.js +193 -0
- package/lib/vite/recorder/index.html +1 -1
- package/lib/vite/traceViewer/assets/{codeMirrorModule-a5XoALAZ.js → codeMirrorModule-DS0FLvoc.js} +20 -20
- package/lib/vite/traceViewer/assets/defaultSettingsView-GTWI-W_B.js +262 -0
- package/lib/vite/traceViewer/defaultSettingsView.B4dS75f0.css +1 -0
- package/lib/vite/traceViewer/{index.BVu7tZDe.css → index.CzXZzn5A.css} +1 -1
- package/lib/vite/traceViewer/{index.BDwrLSGN.js → index.Dtstcb7U.js} +1 -1
- package/lib/vite/traceViewer/index.html +4 -4
- package/lib/vite/traceViewer/sw.bundle.js +4 -4
- package/lib/vite/traceViewer/uiMode.Vipi55dB.js +6 -0
- package/lib/vite/traceViewer/uiMode.html +3 -3
- package/lib/zipBundleImpl.js +2 -2
- package/lib/zodBundle.js +39 -0
- package/lib/zodBundleImpl.js +40 -0
- package/package.json +6 -1
- package/types/protocol.d.ts +947 -51
- package/types/types.d.ts +854 -74
- package/lib/client/pageAgent.js +0 -64
- package/lib/mcpBundleImpl/index.js +0 -147
- package/lib/server/agent/actionRunner.js +0 -335
- package/lib/server/agent/actions.js +0 -128
- package/lib/server/agent/codegen.js +0 -111
- package/lib/server/agent/context.js +0 -150
- package/lib/server/agent/expectTools.js +0 -156
- package/lib/server/agent/pageAgent.js +0 -204
- package/lib/server/agent/performTools.js +0 -262
- package/lib/server/agent/tool.js +0 -109
- package/lib/server/dispatchers/pageAgentDispatcher.js +0 -96
- package/lib/vite/recorder/assets/index-BhTWtUlo.js +0 -193
- package/lib/vite/traceViewer/assets/defaultSettingsView-CJSZINFr.js +0 -266
- package/lib/vite/traceViewer/defaultSettingsView.7ch9cixO.css +0 -1
- package/lib/vite/traceViewer/uiMode.CQJ9SCIQ.js +0 -5
- /package/lib/{server/utils → utils/isomorphic}/imageUtils.js +0 -0
- /package/lib/utils/isomorphic/{traceUtils.js → trace/traceUtils.js} +0 -0
package/types/types.d.ts
CHANGED
|
@@ -20,6 +20,10 @@ import { ReadStream } from 'fs';
|
|
|
20
20
|
import { Protocol } from './protocol';
|
|
21
21
|
import { Serializable, EvaluationArgument, PageFunction, PageFunctionOn, SmartHandle, ElementHandleForTag, BindingSource } from './structs';
|
|
22
22
|
|
|
23
|
+
// Use the global URLPattern type if available (Node.js 22+, modern browsers),
|
|
24
|
+
// otherwise fall back to `never` so it disappears from union types.
|
|
25
|
+
type URLPattern = typeof globalThis extends { URLPattern: infer T } ? T : never;
|
|
26
|
+
|
|
23
27
|
type PageWaitForSelectorOptionsNotHidden = PageWaitForSelectorOptions & {
|
|
24
28
|
state?: 'visible'|'attached';
|
|
25
29
|
};
|
|
@@ -27,6 +31,13 @@ type ElementHandleWaitForSelectorOptionsNotHidden = ElementHandleWaitForSelector
|
|
|
27
31
|
state?: 'visible'|'attached';
|
|
28
32
|
};
|
|
29
33
|
|
|
34
|
+
// @ts-ignore this will be any if zod is not installed
|
|
35
|
+
import { ZodTypeAny, z } from 'zod';
|
|
36
|
+
// @ts-ignore this will be any if zod is not installed
|
|
37
|
+
import * as z3 from 'zod/v3';
|
|
38
|
+
type ZodSchema = ZodTypeAny | z3.ZodTypeAny;
|
|
39
|
+
type InferZodSchema<T extends ZodSchema> = T extends z3.ZodTypeAny ? z3.infer<T> : T extends ZodTypeAny ? z.infer<T> : never;
|
|
40
|
+
|
|
30
41
|
/**
|
|
31
42
|
* Page provides methods to interact with a single tab in a [Browser](https://playwright.dev/docs/api/class-browser),
|
|
32
43
|
* or an [extension background page](https://developer.chrome.com/extensions/background_pages) in Chromium. One
|
|
@@ -304,7 +315,7 @@ export interface Page {
|
|
|
304
315
|
* [`script`](https://playwright.dev/docs/api/class-page#page-add-init-script-option-script) (only supported when
|
|
305
316
|
* passing a function).
|
|
306
317
|
*/
|
|
307
|
-
addInitScript<Arg>(script: PageFunction<Arg, any> | { path?: string, content?: string }, arg?: Arg): Promise<
|
|
318
|
+
addInitScript<Arg>(script: PageFunction<Arg, any> | { path?: string, content?: string }, arg?: Arg): Promise<Disposable>;
|
|
308
319
|
|
|
309
320
|
/**
|
|
310
321
|
* **NOTE** Use locator-based [page.locator(selector[, options])](https://playwright.dev/docs/api/class-page#page-locator)
|
|
@@ -909,7 +920,7 @@ export interface Page {
|
|
|
909
920
|
* @param callback Callback function that will be called in the Playwright's context.
|
|
910
921
|
* @param options
|
|
911
922
|
*/
|
|
912
|
-
exposeBinding(name: string, playwrightBinding: (source: BindingSource, arg: JSHandle) => any, options: { handle: true }): Promise<
|
|
923
|
+
exposeBinding(name: string, playwrightBinding: (source: BindingSource, arg: JSHandle) => any, options: { handle: true }): Promise<Disposable>;
|
|
913
924
|
/**
|
|
914
925
|
* The method adds a function called
|
|
915
926
|
* [`name`](https://playwright.dev/docs/api/class-page#page-expose-binding-option-name) on the `window` object of
|
|
@@ -961,7 +972,7 @@ export interface Page {
|
|
|
961
972
|
* @param callback Callback function that will be called in the Playwright's context.
|
|
962
973
|
* @param options
|
|
963
974
|
*/
|
|
964
|
-
exposeBinding(name: string, playwrightBinding: (source: BindingSource, ...args: any[]) => any, options?: { handle?: boolean }): Promise<
|
|
975
|
+
exposeBinding(name: string, playwrightBinding: (source: BindingSource, ...args: any[]) => any, options?: { handle?: boolean }): Promise<Disposable>;
|
|
965
976
|
|
|
966
977
|
/**
|
|
967
978
|
* Removes all the listeners of the given type (or all registered listeners if no type given). Allows to wait for
|
|
@@ -2088,11 +2099,42 @@ export interface Page {
|
|
|
2088
2099
|
url?: string;
|
|
2089
2100
|
}): Promise<ElementHandle>;
|
|
2090
2101
|
|
|
2102
|
+
/**
|
|
2103
|
+
* Captures the aria snapshot of the page. Read more about [aria snapshots](https://playwright.dev/docs/aria-snapshots).
|
|
2104
|
+
* @param options
|
|
2105
|
+
*/
|
|
2106
|
+
ariaSnapshot(options?: {
|
|
2107
|
+
/**
|
|
2108
|
+
* When specified, limits the depth of the snapshot.
|
|
2109
|
+
*/
|
|
2110
|
+
depth?: number;
|
|
2111
|
+
|
|
2112
|
+
/**
|
|
2113
|
+
* When set to `"ai"`, returns a snapshot optimized for AI consumption: including element references like `[ref=e2]`
|
|
2114
|
+
* and snapshots of `<iframe>`s. Defaults to `"default"`.
|
|
2115
|
+
*/
|
|
2116
|
+
mode?: "ai"|"default";
|
|
2117
|
+
|
|
2118
|
+
/**
|
|
2119
|
+
* Maximum time in milliseconds. Defaults to `0` - no timeout. The default value can be changed via `actionTimeout`
|
|
2120
|
+
* option in the config, or by using the
|
|
2121
|
+
* [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout)
|
|
2122
|
+
* or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods.
|
|
2123
|
+
*/
|
|
2124
|
+
timeout?: number;
|
|
2125
|
+
}): Promise<string>;
|
|
2126
|
+
|
|
2091
2127
|
/**
|
|
2092
2128
|
* Brings page to front (activates tab).
|
|
2093
2129
|
*/
|
|
2094
2130
|
bringToFront(): Promise<void>;
|
|
2095
2131
|
|
|
2132
|
+
/**
|
|
2133
|
+
* Cancels an ongoing [page.pickLocator()](https://playwright.dev/docs/api/class-page#page-pick-locator) call by
|
|
2134
|
+
* deactivating pick locator mode. If no pick locator mode is active, this method is a no-op.
|
|
2135
|
+
*/
|
|
2136
|
+
cancelPickLocator(): Promise<void>;
|
|
2137
|
+
|
|
2096
2138
|
/**
|
|
2097
2139
|
* **NOTE** Use locator-based [locator.check([options])](https://playwright.dev/docs/api/class-locator#locator-check) instead.
|
|
2098
2140
|
* Read more about [locators](https://playwright.dev/docs/locators).
|
|
@@ -2162,6 +2204,20 @@ export interface Page {
|
|
|
2162
2204
|
trial?: boolean;
|
|
2163
2205
|
}): Promise<void>;
|
|
2164
2206
|
|
|
2207
|
+
/**
|
|
2208
|
+
* Clears all stored console messages from this page. Subsequent calls to
|
|
2209
|
+
* [page.consoleMessages([options])](https://playwright.dev/docs/api/class-page#page-console-messages) will only
|
|
2210
|
+
* return messages logged after the clear.
|
|
2211
|
+
*/
|
|
2212
|
+
clearConsoleMessages(): Promise<void>;
|
|
2213
|
+
|
|
2214
|
+
/**
|
|
2215
|
+
* Clears all stored page errors from this page. Subsequent calls to
|
|
2216
|
+
* [page.pageErrors([options])](https://playwright.dev/docs/api/class-page#page-page-errors) will only return errors
|
|
2217
|
+
* thrown after the clear.
|
|
2218
|
+
*/
|
|
2219
|
+
clearPageErrors(): Promise<void>;
|
|
2220
|
+
|
|
2165
2221
|
/**
|
|
2166
2222
|
* **NOTE** Use locator-based [locator.click([options])](https://playwright.dev/docs/api/class-locator#locator-click) instead.
|
|
2167
2223
|
* Read more about [locators](https://playwright.dev/docs/locators).
|
|
@@ -2287,8 +2343,14 @@ export interface Page {
|
|
|
2287
2343
|
/**
|
|
2288
2344
|
* Returns up to (currently) 200 last console messages from this page. See
|
|
2289
2345
|
* [page.on('console')](https://playwright.dev/docs/api/class-page#page-event-console) for more details.
|
|
2346
|
+
* @param options
|
|
2290
2347
|
*/
|
|
2291
|
-
consoleMessages(
|
|
2348
|
+
consoleMessages(options?: {
|
|
2349
|
+
/**
|
|
2350
|
+
* Controls which messages are returned:
|
|
2351
|
+
*/
|
|
2352
|
+
filter?: "all"|"since-navigation";
|
|
2353
|
+
}): Promise<Array<ConsoleMessage>>;
|
|
2292
2354
|
|
|
2293
2355
|
/**
|
|
2294
2356
|
* Gets the full HTML contents of the page, including the doctype.
|
|
@@ -2650,7 +2712,7 @@ export interface Page {
|
|
|
2650
2712
|
* @param name Name of the function on the window object
|
|
2651
2713
|
* @param callback Callback function which will be called in Playwright's context.
|
|
2652
2714
|
*/
|
|
2653
|
-
exposeFunction(name: string, callback: Function): Promise<
|
|
2715
|
+
exposeFunction(name: string, callback: Function): Promise<Disposable>;
|
|
2654
2716
|
|
|
2655
2717
|
/**
|
|
2656
2718
|
* **NOTE** Use locator-based [locator.fill(value[, options])](https://playwright.dev/docs/api/class-locator#locator-fill)
|
|
@@ -2750,9 +2812,9 @@ export interface Page {
|
|
|
2750
2812
|
name?: string;
|
|
2751
2813
|
|
|
2752
2814
|
/**
|
|
2753
|
-
* A glob pattern, regex pattern or predicate receiving frame's `url` as a [URL] object. Optional.
|
|
2815
|
+
* A glob pattern, regex pattern, URL pattern, or predicate receiving frame's `url` as a [URL] object. Optional.
|
|
2754
2816
|
*/
|
|
2755
|
-
url?: string|RegExp|((url: URL) => boolean);
|
|
2817
|
+
url?: string|RegExp|URLPattern|((url: URL) => boolean);
|
|
2756
2818
|
}): null|Frame;
|
|
2757
2819
|
|
|
2758
2820
|
/**
|
|
@@ -2909,7 +2971,7 @@ export interface Page {
|
|
|
2909
2971
|
* <button>Submit</button>
|
|
2910
2972
|
* ```
|
|
2911
2973
|
*
|
|
2912
|
-
* You can locate each element by
|
|
2974
|
+
* You can locate each element by its implicit role:
|
|
2913
2975
|
*
|
|
2914
2976
|
* ```js
|
|
2915
2977
|
* await expect(page.getByRole('heading', { name: 'Sign up' })).toBeVisible();
|
|
@@ -3014,7 +3076,7 @@ export interface Page {
|
|
|
3014
3076
|
* <button data-testid="directions">Itinéraire</button>
|
|
3015
3077
|
* ```
|
|
3016
3078
|
*
|
|
3017
|
-
* You can locate the element by
|
|
3079
|
+
* You can locate the element by its test id:
|
|
3018
3080
|
*
|
|
3019
3081
|
* ```js
|
|
3020
3082
|
* await page.getByTestId('directions').click();
|
|
@@ -3613,8 +3675,14 @@ export interface Page {
|
|
|
3613
3675
|
/**
|
|
3614
3676
|
* Returns up to (currently) 200 last page errors from this page. See
|
|
3615
3677
|
* [page.on('pageerror')](https://playwright.dev/docs/api/class-page#page-event-page-error) for more details.
|
|
3678
|
+
* @param options
|
|
3616
3679
|
*/
|
|
3617
|
-
pageErrors(
|
|
3680
|
+
pageErrors(options?: {
|
|
3681
|
+
/**
|
|
3682
|
+
* Controls which errors are returned:
|
|
3683
|
+
*/
|
|
3684
|
+
filter?: "all"|"since-navigation";
|
|
3685
|
+
}): Promise<Array<Error>>;
|
|
3618
3686
|
|
|
3619
3687
|
/**
|
|
3620
3688
|
* Pauses script execution. Playwright will stop executing the script and wait for the user to either press the
|
|
@@ -3796,6 +3864,21 @@ export interface Page {
|
|
|
3796
3864
|
width?: string|number;
|
|
3797
3865
|
}): Promise<Buffer>;
|
|
3798
3866
|
|
|
3867
|
+
/**
|
|
3868
|
+
* Enters pick locator mode where hovering over page elements highlights them and shows the corresponding locator.
|
|
3869
|
+
* Once the user clicks an element, the mode is deactivated and the
|
|
3870
|
+
* [Locator](https://playwright.dev/docs/api/class-locator) for the picked element is returned.
|
|
3871
|
+
*
|
|
3872
|
+
* **Usage**
|
|
3873
|
+
*
|
|
3874
|
+
* ```js
|
|
3875
|
+
* const locator = await page.pickLocator();
|
|
3876
|
+
* console.log(locator);
|
|
3877
|
+
* ```
|
|
3878
|
+
*
|
|
3879
|
+
*/
|
|
3880
|
+
pickLocator(): Promise<Locator>;
|
|
3881
|
+
|
|
3799
3882
|
/**
|
|
3800
3883
|
* **NOTE** Use locator-based [locator.press(key[, options])](https://playwright.dev/docs/api/class-locator#locator-press)
|
|
3801
3884
|
* instead. Read more about [locators](https://playwright.dev/docs/locators).
|
|
@@ -3998,6 +4081,8 @@ export interface Page {
|
|
|
3998
4081
|
* });
|
|
3999
4082
|
* ```
|
|
4000
4083
|
*
|
|
4084
|
+
* If a request matches multiple registered routes, the most recently registered route takes precedence.
|
|
4085
|
+
*
|
|
4001
4086
|
* Page routes take precedence over browser context routes (set up with
|
|
4002
4087
|
* [browserContext.route(url, handler[, options])](https://playwright.dev/docs/api/class-browsercontext#browser-context-route))
|
|
4003
4088
|
* when request matches both handlers.
|
|
@@ -4007,19 +4092,19 @@ export interface Page {
|
|
|
4007
4092
|
*
|
|
4008
4093
|
* **NOTE** Enabling routing disables http cache.
|
|
4009
4094
|
*
|
|
4010
|
-
* @param url A glob pattern, regex pattern, or predicate that receives a [URL] to match during routing. If
|
|
4095
|
+
* @param url A glob pattern, regex pattern, URL pattern, or predicate that receives a [URL] to match during routing. If
|
|
4011
4096
|
* [`baseURL`](https://playwright.dev/docs/api/class-browser#browser-new-context-option-base-url) is set in the
|
|
4012
4097
|
* context options and the provided URL is a string that does not start with `*`, it is resolved using the
|
|
4013
4098
|
* [`new URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor.
|
|
4014
4099
|
* @param handler handler function to route the request.
|
|
4015
4100
|
* @param options
|
|
4016
4101
|
*/
|
|
4017
|
-
route(url: string|RegExp|((url: URL) => boolean), handler: ((route: Route, request: Request) => Promise<any>|any), options?: {
|
|
4102
|
+
route(url: string|RegExp|URLPattern|((url: URL) => boolean), handler: ((route: Route, request: Request) => Promise<any>|any), options?: {
|
|
4018
4103
|
/**
|
|
4019
4104
|
* How often a route should be used. By default it will be used every time.
|
|
4020
4105
|
*/
|
|
4021
4106
|
times?: number;
|
|
4022
|
-
}): Promise<
|
|
4107
|
+
}): Promise<Disposable>;
|
|
4023
4108
|
|
|
4024
4109
|
/**
|
|
4025
4110
|
* If specified the network requests that are made in the page will be served from the HAR file. Read more about
|
|
@@ -4095,7 +4180,7 @@ export interface Page {
|
|
|
4095
4180
|
* [`baseURL`](https://playwright.dev/docs/api/class-browser#browser-new-context-option-base-url) context option.
|
|
4096
4181
|
* @param handler Handler function to route the WebSocket.
|
|
4097
4182
|
*/
|
|
4098
|
-
routeWebSocket(url: string|RegExp|((url: URL) => boolean), handler: ((websocketroute: WebSocketRoute) => Promise<any>|any)): Promise<void>;
|
|
4183
|
+
routeWebSocket(url: string|RegExp|URLPattern|((url: URL) => boolean), handler: ((websocketroute: WebSocketRoute) => Promise<any>|any)): Promise<void>;
|
|
4099
4184
|
|
|
4100
4185
|
/**
|
|
4101
4186
|
* Returns the buffer with the captured screenshot.
|
|
@@ -4686,10 +4771,10 @@ export interface Page {
|
|
|
4686
4771
|
* [page.route(url, handler[, options])](https://playwright.dev/docs/api/class-page#page-route). When
|
|
4687
4772
|
* [`handler`](https://playwright.dev/docs/api/class-page#page-unroute-option-handler) is not specified, removes all
|
|
4688
4773
|
* routes for the [`url`](https://playwright.dev/docs/api/class-page#page-unroute-option-url).
|
|
4689
|
-
* @param url A glob pattern, regex pattern or predicate receiving [URL] to match while routing.
|
|
4774
|
+
* @param url A glob pattern, regex pattern, URL pattern, or predicate receiving [URL] to match while routing.
|
|
4690
4775
|
* @param handler Optional handler function to route the request.
|
|
4691
4776
|
*/
|
|
4692
|
-
unroute(url: string|RegExp|((url: URL) => boolean), handler?: ((route: Route, request: Request) => Promise<any>|any)): Promise<void>;
|
|
4777
|
+
unroute(url: string|RegExp|URLPattern|((url: URL) => boolean), handler?: ((route: Route, request: Request) => Promise<any>|any)): Promise<void>;
|
|
4693
4778
|
|
|
4694
4779
|
/**
|
|
4695
4780
|
* Removes all routes created with
|
|
@@ -4712,7 +4797,8 @@ export interface Page {
|
|
|
4712
4797
|
url(): string;
|
|
4713
4798
|
|
|
4714
4799
|
/**
|
|
4715
|
-
* Video object associated with this page.
|
|
4800
|
+
* Video object associated with this page. Can be used to access the video file when using the `recordVideo` context
|
|
4801
|
+
* option.
|
|
4716
4802
|
*/
|
|
4717
4803
|
video(): null|Video;
|
|
4718
4804
|
|
|
@@ -5018,11 +5104,11 @@ export interface Page {
|
|
|
5018
5104
|
timeout?: number;
|
|
5019
5105
|
|
|
5020
5106
|
/**
|
|
5021
|
-
* A glob pattern, regex pattern or predicate receiving [URL] to match while waiting for the navigation.
|
|
5022
|
-
* the parameter is a string without wildcard characters, the method will wait for navigation to URL that
|
|
5023
|
-
* equal to the string.
|
|
5107
|
+
* A glob pattern, regex pattern, URL pattern, or predicate receiving [URL] to match while waiting for the navigation.
|
|
5108
|
+
* Note that if the parameter is a string without wildcard characters, the method will wait for navigation to URL that
|
|
5109
|
+
* is exactly equal to the string.
|
|
5024
5110
|
*/
|
|
5025
|
-
url?: string|RegExp|((url: URL) => boolean);
|
|
5111
|
+
url?: string|RegExp|URLPattern|((url: URL) => boolean);
|
|
5026
5112
|
|
|
5027
5113
|
/**
|
|
5028
5114
|
* When to consider operation succeeded, defaults to `load`. Events can be either:
|
|
@@ -5136,12 +5222,12 @@ export interface Page {
|
|
|
5136
5222
|
* await page.waitForURL('**\/target.html');
|
|
5137
5223
|
* ```
|
|
5138
5224
|
*
|
|
5139
|
-
* @param url A glob pattern, regex pattern or predicate receiving [URL] to match while waiting for the navigation.
|
|
5140
|
-
* the parameter is a string without wildcard characters, the method will wait for navigation to URL that
|
|
5141
|
-
* equal to the string.
|
|
5225
|
+
* @param url A glob pattern, regex pattern, URL pattern, or predicate receiving [URL] to match while waiting for the navigation.
|
|
5226
|
+
* Note that if the parameter is a string without wildcard characters, the method will wait for navigation to URL that
|
|
5227
|
+
* is exactly equal to the string.
|
|
5142
5228
|
* @param options
|
|
5143
5229
|
*/
|
|
5144
|
-
waitForURL(url: string|RegExp|((url: URL) => boolean), options?: {
|
|
5230
|
+
waitForURL(url: string|RegExp|URLPattern|((url: URL) => boolean), options?: {
|
|
5145
5231
|
/**
|
|
5146
5232
|
* Maximum operation time in milliseconds. Defaults to `0` - no timeout. The default value can be changed via
|
|
5147
5233
|
* `navigationTimeout` option in the config, or by using the
|
|
@@ -5199,6 +5285,23 @@ export interface Page {
|
|
|
5199
5285
|
*/
|
|
5200
5286
|
request: APIRequestContext;
|
|
5201
5287
|
|
|
5288
|
+
/**
|
|
5289
|
+
* [Screencast](https://playwright.dev/docs/api/class-screencast) object associated with this page.
|
|
5290
|
+
*
|
|
5291
|
+
* **Usage**
|
|
5292
|
+
*
|
|
5293
|
+
* ```js
|
|
5294
|
+
* page.screencast.on('screencastFrame', data => {
|
|
5295
|
+
* console.log('received frame, jpeg size:', data.length);
|
|
5296
|
+
* });
|
|
5297
|
+
* await page.screencast.start();
|
|
5298
|
+
* // ... perform actions ...
|
|
5299
|
+
* await page.screencast.stop();
|
|
5300
|
+
* ```
|
|
5301
|
+
*
|
|
5302
|
+
*/
|
|
5303
|
+
screencast: Screencast;
|
|
5304
|
+
|
|
5202
5305
|
touchscreen: Touchscreen;
|
|
5203
5306
|
|
|
5204
5307
|
[Symbol.asyncDispose](): Promise<void>;
|
|
@@ -6688,7 +6791,7 @@ export interface Frame {
|
|
|
6688
6791
|
* <button>Submit</button>
|
|
6689
6792
|
* ```
|
|
6690
6793
|
*
|
|
6691
|
-
* You can locate each element by
|
|
6794
|
+
* You can locate each element by its implicit role:
|
|
6692
6795
|
*
|
|
6693
6796
|
* ```js
|
|
6694
6797
|
* await expect(page.getByRole('heading', { name: 'Sign up' })).toBeVisible();
|
|
@@ -6793,7 +6896,7 @@ export interface Frame {
|
|
|
6793
6896
|
* <button data-testid="directions">Itinéraire</button>
|
|
6794
6897
|
* ```
|
|
6795
6898
|
*
|
|
6796
|
-
* You can locate the element by
|
|
6899
|
+
* You can locate the element by its test id:
|
|
6797
6900
|
*
|
|
6798
6901
|
* ```js
|
|
6799
6902
|
* await page.getByTestId('directions').click();
|
|
@@ -7964,11 +8067,11 @@ export interface Frame {
|
|
|
7964
8067
|
timeout?: number;
|
|
7965
8068
|
|
|
7966
8069
|
/**
|
|
7967
|
-
* A glob pattern, regex pattern or predicate receiving [URL] to match while waiting for the navigation.
|
|
7968
|
-
* the parameter is a string without wildcard characters, the method will wait for navigation to URL that
|
|
7969
|
-
* equal to the string.
|
|
8070
|
+
* A glob pattern, regex pattern, URL pattern, or predicate receiving [URL] to match while waiting for the navigation.
|
|
8071
|
+
* Note that if the parameter is a string without wildcard characters, the method will wait for navigation to URL that
|
|
8072
|
+
* is exactly equal to the string.
|
|
7970
8073
|
*/
|
|
7971
|
-
url?: string|RegExp|((url: URL) => boolean);
|
|
8074
|
+
url?: string|RegExp|URLPattern|((url: URL) => boolean);
|
|
7972
8075
|
|
|
7973
8076
|
/**
|
|
7974
8077
|
* When to consider operation succeeded, defaults to `load`. Events can be either:
|
|
@@ -8005,12 +8108,12 @@ export interface Frame {
|
|
|
8005
8108
|
* await frame.waitForURL('**\/target.html');
|
|
8006
8109
|
* ```
|
|
8007
8110
|
*
|
|
8008
|
-
* @param url A glob pattern, regex pattern or predicate receiving [URL] to match while waiting for the navigation.
|
|
8009
|
-
* the parameter is a string without wildcard characters, the method will wait for navigation to URL that
|
|
8010
|
-
* equal to the string.
|
|
8111
|
+
* @param url A glob pattern, regex pattern, URL pattern, or predicate receiving [URL] to match while waiting for the navigation.
|
|
8112
|
+
* Note that if the parameter is a string without wildcard characters, the method will wait for navigation to URL that
|
|
8113
|
+
* is exactly equal to the string.
|
|
8011
8114
|
* @param options
|
|
8012
8115
|
*/
|
|
8013
|
-
waitForURL(url: string|RegExp|((url: URL) => boolean), options?: {
|
|
8116
|
+
waitForURL(url: string|RegExp|URLPattern|((url: URL) => boolean), options?: {
|
|
8014
8117
|
/**
|
|
8015
8118
|
* Maximum operation time in milliseconds. Defaults to `0` - no timeout. The default value can be changed via
|
|
8016
8119
|
* `navigationTimeout` option in the config, or by using the
|
|
@@ -8103,7 +8206,7 @@ export interface BrowserContext {
|
|
|
8103
8206
|
* @param callback Callback function that will be called in the Playwright's context.
|
|
8104
8207
|
* @param options
|
|
8105
8208
|
*/
|
|
8106
|
-
exposeBinding(name: string, playwrightBinding: (source: BindingSource, arg: JSHandle) => any, options: { handle: true }): Promise<
|
|
8209
|
+
exposeBinding(name: string, playwrightBinding: (source: BindingSource, arg: JSHandle) => any, options: { handle: true }): Promise<Disposable>;
|
|
8107
8210
|
/**
|
|
8108
8211
|
* The method adds a function called
|
|
8109
8212
|
* [`name`](https://playwright.dev/docs/api/class-browsercontext#browser-context-expose-binding-option-name) on the
|
|
@@ -8151,7 +8254,7 @@ export interface BrowserContext {
|
|
|
8151
8254
|
* @param callback Callback function that will be called in the Playwright's context.
|
|
8152
8255
|
* @param options
|
|
8153
8256
|
*/
|
|
8154
|
-
exposeBinding(name: string, playwrightBinding: (source: BindingSource, ...args: any[]) => any, options?: { handle?: boolean }): Promise<
|
|
8257
|
+
exposeBinding(name: string, playwrightBinding: (source: BindingSource, ...args: any[]) => any, options?: { handle?: boolean }): Promise<Disposable>;
|
|
8155
8258
|
|
|
8156
8259
|
/**
|
|
8157
8260
|
* Adds a script which would be evaluated in one of the following scenarios:
|
|
@@ -8188,7 +8291,7 @@ export interface BrowserContext {
|
|
|
8188
8291
|
* [`script`](https://playwright.dev/docs/api/class-browsercontext#browser-context-add-init-script-option-script)
|
|
8189
8292
|
* (only supported when passing a function).
|
|
8190
8293
|
*/
|
|
8191
|
-
addInitScript<Arg>(script: PageFunction<Arg, any> | { path?: string, content?: string }, arg?: Arg): Promise<
|
|
8294
|
+
addInitScript<Arg>(script: PageFunction<Arg, any> | { path?: string, content?: string }, arg?: Arg): Promise<Disposable>;
|
|
8192
8295
|
|
|
8193
8296
|
/**
|
|
8194
8297
|
* Removes all the listeners of the given type (or all registered listeners if no type given). Allows to wait for
|
|
@@ -8212,6 +8315,7 @@ export interface BrowserContext {
|
|
|
8212
8315
|
*/
|
|
8213
8316
|
behavior?: 'wait'|'ignoreErrors'|'default'
|
|
8214
8317
|
}): Promise<void>;
|
|
8318
|
+
|
|
8215
8319
|
/**
|
|
8216
8320
|
* This event is not emitted.
|
|
8217
8321
|
*/
|
|
@@ -8977,7 +9081,7 @@ export interface BrowserContext {
|
|
|
8977
9081
|
* @param name Name of the function on the window object.
|
|
8978
9082
|
* @param callback Callback function that will be called in the Playwright's context.
|
|
8979
9083
|
*/
|
|
8980
|
-
exposeFunction(name: string, callback: Function): Promise<
|
|
9084
|
+
exposeFunction(name: string, callback: Function): Promise<Disposable>;
|
|
8981
9085
|
|
|
8982
9086
|
/**
|
|
8983
9087
|
* Grants specified permissions to the browser context. Only grants corresponding permissions to the given origin if
|
|
@@ -9005,6 +9109,7 @@ export interface BrowserContext {
|
|
|
9005
9109
|
* - `'notifications'`
|
|
9006
9110
|
* - `'payment-handler'`
|
|
9007
9111
|
* - `'storage-access'`
|
|
9112
|
+
* - `'screen-wake-lock'`
|
|
9008
9113
|
* @param options
|
|
9009
9114
|
*/
|
|
9010
9115
|
grantPermissions(permissions: ReadonlyArray<string>, options?: {
|
|
@@ -9014,6 +9119,11 @@ export interface BrowserContext {
|
|
|
9014
9119
|
origin?: string;
|
|
9015
9120
|
}): Promise<void>;
|
|
9016
9121
|
|
|
9122
|
+
/**
|
|
9123
|
+
* Indicates that the browser context is in the process of closing or has already been closed.
|
|
9124
|
+
*/
|
|
9125
|
+
isClosed(): boolean;
|
|
9126
|
+
|
|
9017
9127
|
/**
|
|
9018
9128
|
* **NOTE** CDP sessions are only supported on Chromium-based browsers.
|
|
9019
9129
|
*
|
|
@@ -9088,19 +9198,19 @@ export interface BrowserContext {
|
|
|
9088
9198
|
*
|
|
9089
9199
|
* **NOTE** Enabling routing disables http cache.
|
|
9090
9200
|
*
|
|
9091
|
-
* @param url A glob pattern, regex pattern, or predicate that receives a [URL] to match during routing. If
|
|
9201
|
+
* @param url A glob pattern, regex pattern, URL pattern, or predicate that receives a [URL] to match during routing. If
|
|
9092
9202
|
* [`baseURL`](https://playwright.dev/docs/api/class-browser#browser-new-context-option-base-url) is set in the
|
|
9093
9203
|
* context options and the provided URL is a string that does not start with `*`, it is resolved using the
|
|
9094
9204
|
* [`new URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor.
|
|
9095
9205
|
* @param handler handler function to route the request.
|
|
9096
9206
|
* @param options
|
|
9097
9207
|
*/
|
|
9098
|
-
route(url: string|RegExp|((url: URL) => boolean), handler: ((route: Route, request: Request) => Promise<any>|any), options?: {
|
|
9208
|
+
route(url: string|RegExp|URLPattern|((url: URL) => boolean), handler: ((route: Route, request: Request) => Promise<any>|any), options?: {
|
|
9099
9209
|
/**
|
|
9100
9210
|
* How often a route should be used. By default it will be used every time.
|
|
9101
9211
|
*/
|
|
9102
9212
|
times?: number;
|
|
9103
|
-
}): Promise<
|
|
9213
|
+
}): Promise<Disposable>;
|
|
9104
9214
|
|
|
9105
9215
|
/**
|
|
9106
9216
|
* If specified the network requests that are made in the context will be served from the HAR file. Read more about
|
|
@@ -9284,6 +9394,71 @@ export interface BrowserContext {
|
|
|
9284
9394
|
*/
|
|
9285
9395
|
setOffline(offline: boolean): Promise<void>;
|
|
9286
9396
|
|
|
9397
|
+
/**
|
|
9398
|
+
* Clears the existing cookies, local storage and IndexedDB entries for all origins and sets the new storage state.
|
|
9399
|
+
*
|
|
9400
|
+
* **Usage**
|
|
9401
|
+
*
|
|
9402
|
+
* ```js
|
|
9403
|
+
* // Load storage state from a file and apply it to the context.
|
|
9404
|
+
* await context.setStorageState('state.json');
|
|
9405
|
+
* ```
|
|
9406
|
+
*
|
|
9407
|
+
* @param storageState Learn more about [storage state and auth](https://playwright.dev/docs/auth).
|
|
9408
|
+
*
|
|
9409
|
+
* Populates context with given storage state. This option can be used to initialize context with logged-in
|
|
9410
|
+
* information obtained via
|
|
9411
|
+
* [browserContext.storageState([options])](https://playwright.dev/docs/api/class-browsercontext#browser-context-storage-state).
|
|
9412
|
+
*/
|
|
9413
|
+
setStorageState(storageState: string|{
|
|
9414
|
+
/**
|
|
9415
|
+
* Cookies to set for context
|
|
9416
|
+
*/
|
|
9417
|
+
cookies: Array<{
|
|
9418
|
+
name: string;
|
|
9419
|
+
|
|
9420
|
+
value: string;
|
|
9421
|
+
|
|
9422
|
+
/**
|
|
9423
|
+
* Domain and path are required. For the cookie to apply to all subdomains as well, prefix domain with a dot, like
|
|
9424
|
+
* this: ".example.com"
|
|
9425
|
+
*/
|
|
9426
|
+
domain: string;
|
|
9427
|
+
|
|
9428
|
+
/**
|
|
9429
|
+
* Domain and path are required
|
|
9430
|
+
*/
|
|
9431
|
+
path: string;
|
|
9432
|
+
|
|
9433
|
+
/**
|
|
9434
|
+
* Unix time in seconds.
|
|
9435
|
+
*/
|
|
9436
|
+
expires: number;
|
|
9437
|
+
|
|
9438
|
+
httpOnly: boolean;
|
|
9439
|
+
|
|
9440
|
+
secure: boolean;
|
|
9441
|
+
|
|
9442
|
+
/**
|
|
9443
|
+
* sameSite flag
|
|
9444
|
+
*/
|
|
9445
|
+
sameSite: "Strict"|"Lax"|"None";
|
|
9446
|
+
}>;
|
|
9447
|
+
|
|
9448
|
+
origins: Array<{
|
|
9449
|
+
origin: string;
|
|
9450
|
+
|
|
9451
|
+
/**
|
|
9452
|
+
* localStorage to set for context
|
|
9453
|
+
*/
|
|
9454
|
+
localStorage: Array<{
|
|
9455
|
+
name: string;
|
|
9456
|
+
|
|
9457
|
+
value: string;
|
|
9458
|
+
}>;
|
|
9459
|
+
}>;
|
|
9460
|
+
}): Promise<void>;
|
|
9461
|
+
|
|
9287
9462
|
/**
|
|
9288
9463
|
* Returns storage state for this browser context, contains current cookies, local storage snapshot and IndexedDB
|
|
9289
9464
|
* snapshot.
|
|
@@ -9343,12 +9518,12 @@ export interface BrowserContext {
|
|
|
9343
9518
|
* When [`handler`](https://playwright.dev/docs/api/class-browsercontext#browser-context-unroute-option-handler) is
|
|
9344
9519
|
* not specified, removes all routes for the
|
|
9345
9520
|
* [`url`](https://playwright.dev/docs/api/class-browsercontext#browser-context-unroute-option-url).
|
|
9346
|
-
* @param url A glob pattern, regex pattern or predicate receiving [URL] used to register a routing with
|
|
9521
|
+
* @param url A glob pattern, regex pattern, URL pattern, or predicate receiving [URL] used to register a routing with
|
|
9347
9522
|
* [browserContext.route(url, handler[, options])](https://playwright.dev/docs/api/class-browsercontext#browser-context-route).
|
|
9348
9523
|
* @param handler Optional handler function used to register a routing with
|
|
9349
9524
|
* [browserContext.route(url, handler[, options])](https://playwright.dev/docs/api/class-browsercontext#browser-context-route).
|
|
9350
9525
|
*/
|
|
9351
|
-
unroute(url: string|RegExp|((url: URL) => boolean), handler?: ((route: Route, request: Request) => Promise<any>|any)): Promise<void>;
|
|
9526
|
+
unroute(url: string|RegExp|URLPattern|((url: URL) => boolean), handler?: ((route: Route, request: Request) => Promise<any>|any)): Promise<void>;
|
|
9352
9527
|
|
|
9353
9528
|
/**
|
|
9354
9529
|
* Removes all routes created with
|
|
@@ -9512,6 +9687,11 @@ export interface BrowserContext {
|
|
|
9512
9687
|
*/
|
|
9513
9688
|
clock: Clock;
|
|
9514
9689
|
|
|
9690
|
+
/**
|
|
9691
|
+
* Debugger allows to pause and resume the execution.
|
|
9692
|
+
*/
|
|
9693
|
+
debugger: Debugger;
|
|
9694
|
+
|
|
9515
9695
|
/**
|
|
9516
9696
|
* API testing helper associated with this context. Requests made with this API will use context cookies.
|
|
9517
9697
|
*/
|
|
@@ -9602,6 +9782,36 @@ export interface Browser {
|
|
|
9602
9782
|
*/
|
|
9603
9783
|
prependListener(event: 'disconnected', listener: (browser: Browser) => any): this;
|
|
9604
9784
|
|
|
9785
|
+
/**
|
|
9786
|
+
* Binds the browser to a named pipe or web socket, making it available for other clients to connect to.
|
|
9787
|
+
* @param title Title of the browser server, used for identification.
|
|
9788
|
+
* @param options
|
|
9789
|
+
*/
|
|
9790
|
+
bind(title: string, options?: {
|
|
9791
|
+
/**
|
|
9792
|
+
* Host to bind the web socket server to. When specified, a web socket server is created instead of a named pipe.
|
|
9793
|
+
*/
|
|
9794
|
+
host?: string;
|
|
9795
|
+
|
|
9796
|
+
/**
|
|
9797
|
+
* Additional metadata to associate with the browser server.
|
|
9798
|
+
*/
|
|
9799
|
+
metadata?: { [key: string]: any; };
|
|
9800
|
+
|
|
9801
|
+
/**
|
|
9802
|
+
* Port to bind the web socket server to. When specified, a web socket server is created instead of a named pipe. Use
|
|
9803
|
+
* `0` to let the OS pick an available port.
|
|
9804
|
+
*/
|
|
9805
|
+
port?: number;
|
|
9806
|
+
|
|
9807
|
+
/**
|
|
9808
|
+
* Working directory associated with this browser server.
|
|
9809
|
+
*/
|
|
9810
|
+
workspaceDir?: string;
|
|
9811
|
+
}): Promise<{
|
|
9812
|
+
endpoint: string;
|
|
9813
|
+
}>;
|
|
9814
|
+
|
|
9605
9815
|
/**
|
|
9606
9816
|
* Get the browser type (chromium, firefox or webkit) that the browser belongs to.
|
|
9607
9817
|
*/
|
|
@@ -9992,9 +10202,10 @@ export interface Browser {
|
|
|
9992
10202
|
*/
|
|
9993
10203
|
recordVideo?: {
|
|
9994
10204
|
/**
|
|
9995
|
-
* Path to the directory to put videos into.
|
|
10205
|
+
* Path to the directory to put videos into. If not specified, the videos will be stored in `artifactsDir` (see
|
|
10206
|
+
* [browserType.launch([options])](https://playwright.dev/docs/api/class-browsertype#browser-type-launch) options).
|
|
9996
10207
|
*/
|
|
9997
|
-
dir
|
|
10208
|
+
dir?: string;
|
|
9998
10209
|
|
|
9999
10210
|
/**
|
|
10000
10211
|
* Optional dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to
|
|
@@ -10012,6 +10223,26 @@ export interface Browser {
|
|
|
10012
10223
|
*/
|
|
10013
10224
|
height: number;
|
|
10014
10225
|
};
|
|
10226
|
+
|
|
10227
|
+
/**
|
|
10228
|
+
* If specified, enables visual annotations on interacted elements during video recording.
|
|
10229
|
+
*/
|
|
10230
|
+
showActions?: {
|
|
10231
|
+
/**
|
|
10232
|
+
* How long each annotation is displayed in milliseconds. Defaults to `500`.
|
|
10233
|
+
*/
|
|
10234
|
+
duration?: number;
|
|
10235
|
+
|
|
10236
|
+
/**
|
|
10237
|
+
* Position of the action title overlay. Defaults to `"top-right"`.
|
|
10238
|
+
*/
|
|
10239
|
+
position?: "top-left"|"top"|"top-right"|"bottom-left"|"bottom"|"bottom-right";
|
|
10240
|
+
|
|
10241
|
+
/**
|
|
10242
|
+
* Font size of the action title in pixels. Defaults to `24`.
|
|
10243
|
+
*/
|
|
10244
|
+
fontSize?: number;
|
|
10245
|
+
};
|
|
10015
10246
|
};
|
|
10016
10247
|
|
|
10017
10248
|
/**
|
|
@@ -10211,6 +10442,12 @@ export interface Browser {
|
|
|
10211
10442
|
*/
|
|
10212
10443
|
stopTracing(): Promise<Buffer>;
|
|
10213
10444
|
|
|
10445
|
+
/**
|
|
10446
|
+
* Unbinds the browser server previously bound with
|
|
10447
|
+
* [browser.bind(title[, options])](https://playwright.dev/docs/api/class-browser#browser-bind).
|
|
10448
|
+
*/
|
|
10449
|
+
unbind(): Promise<void>;
|
|
10450
|
+
|
|
10214
10451
|
/**
|
|
10215
10452
|
* Returns the browser version.
|
|
10216
10453
|
*/
|
|
@@ -12575,9 +12812,25 @@ export interface Locator {
|
|
|
12575
12812
|
* - link "About"
|
|
12576
12813
|
* ```
|
|
12577
12814
|
*
|
|
12815
|
+
* An AI-optimized snapshot, controlled by
|
|
12816
|
+
* [`mode`](https://playwright.dev/docs/api/class-locator#locator-aria-snapshot-option-mode), is different from a
|
|
12817
|
+
* default snapshot:
|
|
12818
|
+
* 1. Includes element references `[ref=e2]`. 2. Does not wait for an element matching the locator, and throws when
|
|
12819
|
+
* no elements match. 3. Includes snapshots of `<iframe>`s inside the target.
|
|
12578
12820
|
* @param options
|
|
12579
12821
|
*/
|
|
12580
12822
|
ariaSnapshot(options?: {
|
|
12823
|
+
/**
|
|
12824
|
+
* When specified, limits the depth of the snapshot.
|
|
12825
|
+
*/
|
|
12826
|
+
depth?: number;
|
|
12827
|
+
|
|
12828
|
+
/**
|
|
12829
|
+
* When set to `"ai"`, returns a snapshot optimized for AI consumption. Defaults to `"default"`. See details for more
|
|
12830
|
+
* information.
|
|
12831
|
+
*/
|
|
12832
|
+
mode?: "ai"|"default";
|
|
12833
|
+
|
|
12581
12834
|
/**
|
|
12582
12835
|
* Maximum time in milliseconds. Defaults to `0` - no timeout. The default value can be changed via `actionTimeout`
|
|
12583
12836
|
* option in the config, or by using the
|
|
@@ -13438,7 +13691,7 @@ export interface Locator {
|
|
|
13438
13691
|
* <button>Submit</button>
|
|
13439
13692
|
* ```
|
|
13440
13693
|
*
|
|
13441
|
-
* You can locate each element by
|
|
13694
|
+
* You can locate each element by its implicit role:
|
|
13442
13695
|
*
|
|
13443
13696
|
* ```js
|
|
13444
13697
|
* await expect(page.getByRole('heading', { name: 'Sign up' })).toBeVisible();
|
|
@@ -13543,7 +13796,7 @@ export interface Locator {
|
|
|
13543
13796
|
* <button data-testid="directions">Itinéraire</button>
|
|
13544
13797
|
* ```
|
|
13545
13798
|
*
|
|
13546
|
-
* You can locate the element by
|
|
13799
|
+
* You can locate the element by its test id:
|
|
13547
13800
|
*
|
|
13548
13801
|
* ```js
|
|
13549
13802
|
* await page.getByTestId('directions').click();
|
|
@@ -14003,6 +14256,13 @@ export interface Locator {
|
|
|
14003
14256
|
hasText?: string|RegExp;
|
|
14004
14257
|
}): Locator;
|
|
14005
14258
|
|
|
14259
|
+
/**
|
|
14260
|
+
* Returns a new locator that uses best practices for referencing the matched element, prioritizing test ids, aria
|
|
14261
|
+
* roles, and other user-facing attributes over CSS selectors. This is useful for converting implementation-detail
|
|
14262
|
+
* selectors into more resilient, human-readable locators.
|
|
14263
|
+
*/
|
|
14264
|
+
normalize(): Promise<Locator>;
|
|
14265
|
+
|
|
14006
14266
|
/**
|
|
14007
14267
|
* Returns locator to the n-th matching element. It's zero based, `nth(0)` selects the first element.
|
|
14008
14268
|
*
|
|
@@ -14735,9 +14995,9 @@ export interface BrowserType<Unused = {}> {
|
|
|
14735
14995
|
* **NOTE** Connecting over the Chrome DevTools Protocol is only supported for Chromium-based browsers.
|
|
14736
14996
|
*
|
|
14737
14997
|
* **NOTE** This connection is significantly lower fidelity than the Playwright protocol connection via
|
|
14738
|
-
* [browserType.connect(
|
|
14998
|
+
* [browserType.connect(endpoint[, options])](https://playwright.dev/docs/api/class-browsertype#browser-type-connect).
|
|
14739
14999
|
* If you are experiencing issues or attempting to use advanced functionality, you probably want to use
|
|
14740
|
-
* [browserType.connect(
|
|
15000
|
+
* [browserType.connect(endpoint[, options])](https://playwright.dev/docs/api/class-browsertype#browser-type-connect).
|
|
14741
15001
|
*
|
|
14742
15002
|
* **Usage**
|
|
14743
15003
|
*
|
|
@@ -14765,9 +15025,9 @@ export interface BrowserType<Unused = {}> {
|
|
|
14765
15025
|
* **NOTE** Connecting over the Chrome DevTools Protocol is only supported for Chromium-based browsers.
|
|
14766
15026
|
*
|
|
14767
15027
|
* **NOTE** This connection is significantly lower fidelity than the Playwright protocol connection via
|
|
14768
|
-
* [browserType.connect(
|
|
15028
|
+
* [browserType.connect(endpoint[, options])](https://playwright.dev/docs/api/class-browsertype#browser-type-connect).
|
|
14769
15029
|
* If you are experiencing issues or attempting to use advanced functionality, you probably want to use
|
|
14770
|
-
* [browserType.connect(
|
|
15030
|
+
* [browserType.connect(endpoint[, options])](https://playwright.dev/docs/api/class-browsertype#browser-type-connect).
|
|
14771
15031
|
*
|
|
14772
15032
|
* **Usage**
|
|
14773
15033
|
*
|
|
@@ -14788,7 +15048,7 @@ export interface BrowserType<Unused = {}> {
|
|
|
14788
15048
|
* **NOTE** The major and minor version of the Playwright instance that connects needs to match the version of
|
|
14789
15049
|
* Playwright that launches the browser (1.2.3 → is compatible with 1.2.x).
|
|
14790
15050
|
*
|
|
14791
|
-
* @param
|
|
15051
|
+
* @param endpoint A Playwright browser websocket endpoint to connect to. You obtain this endpoint via `BrowserServer.wsEndpoint`.
|
|
14792
15052
|
* @param options
|
|
14793
15053
|
*/
|
|
14794
15054
|
connect(wsEndpoint: string, options?: ConnectOptions): Promise<Browser>;
|
|
@@ -14804,7 +15064,7 @@ export interface BrowserType<Unused = {}> {
|
|
|
14804
15064
|
* **NOTE** The major and minor version of the Playwright instance that connects needs to match the version of
|
|
14805
15065
|
* Playwright that launches the browser (1.2.3 → is compatible with 1.2.x).
|
|
14806
15066
|
*
|
|
14807
|
-
* @param
|
|
15067
|
+
* @param endpoint A Playwright browser websocket endpoint to connect to. You obtain this endpoint via `BrowserServer.wsEndpoint`.
|
|
14808
15068
|
* @param options
|
|
14809
15069
|
*/
|
|
14810
15070
|
connect(options: ConnectOptions & { wsEndpoint?: string }): Promise<Browser>;
|
|
@@ -14886,6 +15146,13 @@ export interface BrowserType<Unused = {}> {
|
|
|
14886
15146
|
*/
|
|
14887
15147
|
args?: Array<string>;
|
|
14888
15148
|
|
|
15149
|
+
/**
|
|
15150
|
+
* If specified, artifacts (traces, videos, downloads, HAR files, etc.) are saved into this directory. The directory
|
|
15151
|
+
* is not cleaned up when the browser closes. If not specified, a temporary directory is used and cleaned up when the
|
|
15152
|
+
* browser closes.
|
|
15153
|
+
*/
|
|
15154
|
+
artifactsDir?: string;
|
|
15155
|
+
|
|
14889
15156
|
/**
|
|
14890
15157
|
* When using [page.goto(url[, options])](https://playwright.dev/docs/api/class-page#page-goto),
|
|
14891
15158
|
* [page.route(url, handler[, options])](https://playwright.dev/docs/api/class-page#page-route),
|
|
@@ -15240,9 +15507,10 @@ export interface BrowserType<Unused = {}> {
|
|
|
15240
15507
|
*/
|
|
15241
15508
|
recordVideo?: {
|
|
15242
15509
|
/**
|
|
15243
|
-
* Path to the directory to put videos into.
|
|
15510
|
+
* Path to the directory to put videos into. If not specified, the videos will be stored in `artifactsDir` (see
|
|
15511
|
+
* [browserType.launch([options])](https://playwright.dev/docs/api/class-browsertype#browser-type-launch) options).
|
|
15244
15512
|
*/
|
|
15245
|
-
dir
|
|
15513
|
+
dir?: string;
|
|
15246
15514
|
|
|
15247
15515
|
/**
|
|
15248
15516
|
* Optional dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to
|
|
@@ -15260,6 +15528,26 @@ export interface BrowserType<Unused = {}> {
|
|
|
15260
15528
|
*/
|
|
15261
15529
|
height: number;
|
|
15262
15530
|
};
|
|
15531
|
+
|
|
15532
|
+
/**
|
|
15533
|
+
* If specified, enables visual annotations on interacted elements during video recording.
|
|
15534
|
+
*/
|
|
15535
|
+
showActions?: {
|
|
15536
|
+
/**
|
|
15537
|
+
* How long each annotation is displayed in milliseconds. Defaults to `500`.
|
|
15538
|
+
*/
|
|
15539
|
+
duration?: number;
|
|
15540
|
+
|
|
15541
|
+
/**
|
|
15542
|
+
* Position of the action title overlay. Defaults to `"top-right"`.
|
|
15543
|
+
*/
|
|
15544
|
+
position?: "top-left"|"top"|"top-right"|"bottom-left"|"bottom"|"bottom-right";
|
|
15545
|
+
|
|
15546
|
+
/**
|
|
15547
|
+
* Font size of the action title in pixels. Defaults to `24`.
|
|
15548
|
+
*/
|
|
15549
|
+
fontSize?: number;
|
|
15550
|
+
};
|
|
15263
15551
|
};
|
|
15264
15552
|
|
|
15265
15553
|
/**
|
|
@@ -15378,7 +15666,7 @@ export interface BrowserType<Unused = {}> {
|
|
|
15378
15666
|
|
|
15379
15667
|
/**
|
|
15380
15668
|
* Returns the browser app instance. You can connect to it via
|
|
15381
|
-
* [browserType.connect(
|
|
15669
|
+
* [browserType.connect(endpoint[, options])](https://playwright.dev/docs/api/class-browsertype#browser-type-connect),
|
|
15382
15670
|
* which requires the major/minor client/server version to match (1.2.3 → is compatible with 1.2.x).
|
|
15383
15671
|
*
|
|
15384
15672
|
* **Usage**
|
|
@@ -15410,6 +15698,13 @@ export interface BrowserType<Unused = {}> {
|
|
|
15410
15698
|
*/
|
|
15411
15699
|
args?: Array<string>;
|
|
15412
15700
|
|
|
15701
|
+
/**
|
|
15702
|
+
* If specified, artifacts (traces, videos, downloads, HAR files, etc.) are saved into this directory. The directory
|
|
15703
|
+
* is not cleaned up when the browser closes. If not specified, a temporary directory is used and cleaned up when the
|
|
15704
|
+
* browser closes.
|
|
15705
|
+
*/
|
|
15706
|
+
artifactsDir?: string;
|
|
15707
|
+
|
|
15413
15708
|
/**
|
|
15414
15709
|
* Browser distribution channel.
|
|
15415
15710
|
*
|
|
@@ -15575,11 +15870,11 @@ export interface BrowserType<Unused = {}> {
|
|
|
15575
15870
|
*
|
|
15576
15871
|
*/
|
|
15577
15872
|
export interface CDPSession {
|
|
15578
|
-
on
|
|
15579
|
-
addListener
|
|
15580
|
-
off
|
|
15581
|
-
removeListener
|
|
15582
|
-
once
|
|
15873
|
+
on<T extends keyof Protocol.Events | symbol>(event: T, listener: (payload: T extends symbol ? any : Protocol.Events[T extends keyof Protocol.Events ? T : never]) => void): this;
|
|
15874
|
+
addListener<T extends keyof Protocol.Events | symbol>(event: T, listener: (payload: T extends symbol ? any : Protocol.Events[T extends keyof Protocol.Events ? T : never]) => void): this;
|
|
15875
|
+
off<T extends keyof Protocol.Events | symbol>(event: T, listener: (payload: T extends symbol ? any : Protocol.Events[T extends keyof Protocol.Events ? T : never]) => void): this;
|
|
15876
|
+
removeListener<T extends keyof Protocol.Events | symbol>(event: T, listener: (payload: T extends symbol ? any : Protocol.Events[T extends keyof Protocol.Events ? T : never]) => void): this;
|
|
15877
|
+
once<T extends keyof Protocol.Events | symbol>(event: T, listener: (payload: T extends symbol ? any : Protocol.Events[T extends keyof Protocol.Events ? T : never]) => void): this;
|
|
15583
15878
|
/**
|
|
15584
15879
|
* @param method Protocol method name.
|
|
15585
15880
|
* @param params Optional method parameters.
|
|
@@ -15588,6 +15883,156 @@ export interface CDPSession {
|
|
|
15588
15883
|
method: T,
|
|
15589
15884
|
params?: Protocol.CommandParameters[T]
|
|
15590
15885
|
): Promise<Protocol.CommandReturnValues[T]>;
|
|
15886
|
+
/**
|
|
15887
|
+
* Emitted when the session is closed, either because the target was closed or `session.detach()` was called.
|
|
15888
|
+
*/
|
|
15889
|
+
on(event: 'close', listener: (cdpSession: CDPSession) => any): this;
|
|
15890
|
+
|
|
15891
|
+
/**
|
|
15892
|
+
* Emitted for every CDP event received from the session. Allows subscribing to all CDP events at once without knowing
|
|
15893
|
+
* their names ahead of time.
|
|
15894
|
+
*
|
|
15895
|
+
* **Usage**
|
|
15896
|
+
*
|
|
15897
|
+
* ```js
|
|
15898
|
+
* session.on('event', ({ name, params }) => {
|
|
15899
|
+
* console.log(`CDP event: ${name}`, params);
|
|
15900
|
+
* });
|
|
15901
|
+
* ```
|
|
15902
|
+
*
|
|
15903
|
+
*/
|
|
15904
|
+
on(event: 'event', listener: (data: {
|
|
15905
|
+
/**
|
|
15906
|
+
* CDP event name.
|
|
15907
|
+
*/
|
|
15908
|
+
method: string;
|
|
15909
|
+
|
|
15910
|
+
/**
|
|
15911
|
+
* CDP event parameters.
|
|
15912
|
+
*/
|
|
15913
|
+
params?: Object;
|
|
15914
|
+
}) => any): this;
|
|
15915
|
+
|
|
15916
|
+
/**
|
|
15917
|
+
* Adds an event listener that will be automatically removed after it is triggered once. See `addListener` for more information about this event.
|
|
15918
|
+
*/
|
|
15919
|
+
once(event: 'close', listener: (cdpSession: CDPSession) => any): this;
|
|
15920
|
+
|
|
15921
|
+
/**
|
|
15922
|
+
* Adds an event listener that will be automatically removed after it is triggered once. See `addListener` for more information about this event.
|
|
15923
|
+
*/
|
|
15924
|
+
once(event: 'event', listener: (data: {
|
|
15925
|
+
/**
|
|
15926
|
+
* CDP event name.
|
|
15927
|
+
*/
|
|
15928
|
+
method: string;
|
|
15929
|
+
|
|
15930
|
+
/**
|
|
15931
|
+
* CDP event parameters.
|
|
15932
|
+
*/
|
|
15933
|
+
params?: Object;
|
|
15934
|
+
}) => any): this;
|
|
15935
|
+
|
|
15936
|
+
/**
|
|
15937
|
+
* Emitted when the session is closed, either because the target was closed or `session.detach()` was called.
|
|
15938
|
+
*/
|
|
15939
|
+
addListener(event: 'close', listener: (cdpSession: CDPSession) => any): this;
|
|
15940
|
+
|
|
15941
|
+
/**
|
|
15942
|
+
* Emitted for every CDP event received from the session. Allows subscribing to all CDP events at once without knowing
|
|
15943
|
+
* their names ahead of time.
|
|
15944
|
+
*
|
|
15945
|
+
* **Usage**
|
|
15946
|
+
*
|
|
15947
|
+
* ```js
|
|
15948
|
+
* session.on('event', ({ name, params }) => {
|
|
15949
|
+
* console.log(`CDP event: ${name}`, params);
|
|
15950
|
+
* });
|
|
15951
|
+
* ```
|
|
15952
|
+
*
|
|
15953
|
+
*/
|
|
15954
|
+
addListener(event: 'event', listener: (data: {
|
|
15955
|
+
/**
|
|
15956
|
+
* CDP event name.
|
|
15957
|
+
*/
|
|
15958
|
+
method: string;
|
|
15959
|
+
|
|
15960
|
+
/**
|
|
15961
|
+
* CDP event parameters.
|
|
15962
|
+
*/
|
|
15963
|
+
params?: Object;
|
|
15964
|
+
}) => any): this;
|
|
15965
|
+
|
|
15966
|
+
/**
|
|
15967
|
+
* Removes an event listener added by `on` or `addListener`.
|
|
15968
|
+
*/
|
|
15969
|
+
removeListener(event: 'close', listener: (cdpSession: CDPSession) => any): this;
|
|
15970
|
+
|
|
15971
|
+
/**
|
|
15972
|
+
* Removes an event listener added by `on` or `addListener`.
|
|
15973
|
+
*/
|
|
15974
|
+
removeListener(event: 'event', listener: (data: {
|
|
15975
|
+
/**
|
|
15976
|
+
* CDP event name.
|
|
15977
|
+
*/
|
|
15978
|
+
method: string;
|
|
15979
|
+
|
|
15980
|
+
/**
|
|
15981
|
+
* CDP event parameters.
|
|
15982
|
+
*/
|
|
15983
|
+
params?: Object;
|
|
15984
|
+
}) => any): this;
|
|
15985
|
+
|
|
15986
|
+
/**
|
|
15987
|
+
* Removes an event listener added by `on` or `addListener`.
|
|
15988
|
+
*/
|
|
15989
|
+
off(event: 'close', listener: (cdpSession: CDPSession) => any): this;
|
|
15990
|
+
|
|
15991
|
+
/**
|
|
15992
|
+
* Removes an event listener added by `on` or `addListener`.
|
|
15993
|
+
*/
|
|
15994
|
+
off(event: 'event', listener: (data: {
|
|
15995
|
+
/**
|
|
15996
|
+
* CDP event name.
|
|
15997
|
+
*/
|
|
15998
|
+
method: string;
|
|
15999
|
+
|
|
16000
|
+
/**
|
|
16001
|
+
* CDP event parameters.
|
|
16002
|
+
*/
|
|
16003
|
+
params?: Object;
|
|
16004
|
+
}) => any): this;
|
|
16005
|
+
|
|
16006
|
+
/**
|
|
16007
|
+
* Emitted when the session is closed, either because the target was closed or `session.detach()` was called.
|
|
16008
|
+
*/
|
|
16009
|
+
prependListener(event: 'close', listener: (cdpSession: CDPSession) => any): this;
|
|
16010
|
+
|
|
16011
|
+
/**
|
|
16012
|
+
* Emitted for every CDP event received from the session. Allows subscribing to all CDP events at once without knowing
|
|
16013
|
+
* their names ahead of time.
|
|
16014
|
+
*
|
|
16015
|
+
* **Usage**
|
|
16016
|
+
*
|
|
16017
|
+
* ```js
|
|
16018
|
+
* session.on('event', ({ name, params }) => {
|
|
16019
|
+
* console.log(`CDP event: ${name}`, params);
|
|
16020
|
+
* });
|
|
16021
|
+
* ```
|
|
16022
|
+
*
|
|
16023
|
+
*/
|
|
16024
|
+
prependListener(event: 'event', listener: (data: {
|
|
16025
|
+
/**
|
|
16026
|
+
* CDP event name.
|
|
16027
|
+
*/
|
|
16028
|
+
method: string;
|
|
16029
|
+
|
|
16030
|
+
/**
|
|
16031
|
+
* CDP event parameters.
|
|
16032
|
+
*/
|
|
16033
|
+
params?: Object;
|
|
16034
|
+
}) => any): this;
|
|
16035
|
+
|
|
15591
16036
|
/**
|
|
15592
16037
|
* Detaches the CDPSession from the target. Once detached, the CDPSession object won't emit any events and can't be
|
|
15593
16038
|
* used to send messages.
|
|
@@ -15771,6 +16216,126 @@ export interface WebSocketRoute {
|
|
|
15771
16216
|
[Symbol.asyncDispose](): Promise<void>;
|
|
15772
16217
|
}
|
|
15773
16218
|
|
|
16219
|
+
/**
|
|
16220
|
+
* Interface for capturing screencast frames from a page.
|
|
16221
|
+
*/
|
|
16222
|
+
export interface Screencast {
|
|
16223
|
+
/**
|
|
16224
|
+
* Starts the screencast. When [`path`](https://playwright.dev/docs/api/class-screencast#screencast-start-option-path)
|
|
16225
|
+
* is provided, it saves video recording to the specified file. When
|
|
16226
|
+
* [`onFrame`](https://playwright.dev/docs/api/class-screencast#screencast-start-option-on-frame) is provided,
|
|
16227
|
+
* delivers JPEG-encoded frames to the callback. Both can be used together.
|
|
16228
|
+
*
|
|
16229
|
+
* **Usage**
|
|
16230
|
+
*
|
|
16231
|
+
* ```js
|
|
16232
|
+
* // Record video
|
|
16233
|
+
* await page.screencast.start({ path: 'video.webm', size: { width: 1280, height: 800 } });
|
|
16234
|
+
* // ... perform actions ...
|
|
16235
|
+
* await page.screencast.stop();
|
|
16236
|
+
* ```
|
|
16237
|
+
*
|
|
16238
|
+
* ```js
|
|
16239
|
+
* // Capture frames
|
|
16240
|
+
* await page.screencast.start({
|
|
16241
|
+
* onFrame: ({ data }) => console.log(`frame size: ${data.length}`),
|
|
16242
|
+
* size: { width: 800, height: 600 },
|
|
16243
|
+
* });
|
|
16244
|
+
* // ... perform actions ...
|
|
16245
|
+
* await page.screencast.stop();
|
|
16246
|
+
* ```
|
|
16247
|
+
*
|
|
16248
|
+
* @param options
|
|
16249
|
+
*/
|
|
16250
|
+
start(options?: {
|
|
16251
|
+
onFrame?: (frame: { data: Buffer }) => Promise<any>|any;
|
|
16252
|
+
path?: string;
|
|
16253
|
+
size?: {
|
|
16254
|
+
width: number;
|
|
16255
|
+
height: number;
|
|
16256
|
+
};
|
|
16257
|
+
quality?: number;
|
|
16258
|
+
annotate?: {
|
|
16259
|
+
duration?: number;
|
|
16260
|
+
position?: 'top-left' | 'top' | 'top-right' | 'bottom-left' | 'bottom' | 'bottom-right';
|
|
16261
|
+
fontSize?: number;
|
|
16262
|
+
};
|
|
16263
|
+
}): Promise<Disposable>;
|
|
16264
|
+
/**
|
|
16265
|
+
* Removes action decorations.
|
|
16266
|
+
*/
|
|
16267
|
+
hideActions(): Promise<void>;
|
|
16268
|
+
|
|
16269
|
+
/**
|
|
16270
|
+
* Hides overlays without removing them.
|
|
16271
|
+
*/
|
|
16272
|
+
hideOverlays(): Promise<void>;
|
|
16273
|
+
|
|
16274
|
+
/**
|
|
16275
|
+
* Enables visual annotations on interacted elements. Returns a disposable that stops showing actions when disposed.
|
|
16276
|
+
* @param options
|
|
16277
|
+
*/
|
|
16278
|
+
showActions(options?: {
|
|
16279
|
+
/**
|
|
16280
|
+
* How long each annotation is displayed in milliseconds. Defaults to `500`.
|
|
16281
|
+
*/
|
|
16282
|
+
duration?: number;
|
|
16283
|
+
|
|
16284
|
+
/**
|
|
16285
|
+
* Font size of the action title in pixels. Defaults to `24`.
|
|
16286
|
+
*/
|
|
16287
|
+
fontSize?: number;
|
|
16288
|
+
|
|
16289
|
+
/**
|
|
16290
|
+
* Position of the action title overlay. Defaults to `"top-right"`.
|
|
16291
|
+
*/
|
|
16292
|
+
position?: "top-left"|"top"|"top-right"|"bottom-left"|"bottom"|"bottom-right";
|
|
16293
|
+
}): Promise<Disposable>;
|
|
16294
|
+
|
|
16295
|
+
/**
|
|
16296
|
+
* Shows a chapter overlay with a title and optional description, centered on the page with a blurred backdrop. Useful
|
|
16297
|
+
* for narrating video recordings. The overlay is removed after the specified duration, or 2000ms.
|
|
16298
|
+
* @param title Title text displayed prominently in the overlay.
|
|
16299
|
+
* @param options
|
|
16300
|
+
*/
|
|
16301
|
+
showChapter(title: string, options?: {
|
|
16302
|
+
/**
|
|
16303
|
+
* Optional description text displayed below the title.
|
|
16304
|
+
*/
|
|
16305
|
+
description?: string;
|
|
16306
|
+
|
|
16307
|
+
/**
|
|
16308
|
+
* Duration in milliseconds after which the overlay is automatically removed. Defaults to `2000`.
|
|
16309
|
+
*/
|
|
16310
|
+
duration?: number;
|
|
16311
|
+
}): Promise<void>;
|
|
16312
|
+
|
|
16313
|
+
/**
|
|
16314
|
+
* Adds an overlay with the given HTML content. The overlay is displayed on top of the page until removed. Returns a
|
|
16315
|
+
* disposable that removes the overlay when disposed.
|
|
16316
|
+
* @param html HTML content for the overlay.
|
|
16317
|
+
* @param options
|
|
16318
|
+
*/
|
|
16319
|
+
showOverlay(html: string, options?: {
|
|
16320
|
+
/**
|
|
16321
|
+
* Duration in milliseconds after which the overlay is automatically removed. Overlay stays until dismissed if not
|
|
16322
|
+
* provided.
|
|
16323
|
+
*/
|
|
16324
|
+
duration?: number;
|
|
16325
|
+
}): Promise<Disposable>;
|
|
16326
|
+
|
|
16327
|
+
/**
|
|
16328
|
+
* Shows overlays.
|
|
16329
|
+
*/
|
|
16330
|
+
showOverlays(): Promise<void>;
|
|
16331
|
+
|
|
16332
|
+
/**
|
|
16333
|
+
* Stops the screencast and video recording if active. If a video was being recorded, saves it to the path specified
|
|
16334
|
+
* in [screencast.start([options])](https://playwright.dev/docs/api/class-screencast#screencast-start).
|
|
16335
|
+
*/
|
|
16336
|
+
stop(): Promise<void>;
|
|
16337
|
+
}
|
|
16338
|
+
|
|
15774
16339
|
type DeviceDescriptor = {
|
|
15775
16340
|
viewport: ViewportSize;
|
|
15776
16341
|
userAgent: string;
|
|
@@ -16370,10 +16935,10 @@ export interface Android {
|
|
|
16370
16935
|
* This methods attaches Playwright to an existing Android device. Use
|
|
16371
16936
|
* [android.launchServer([options])](https://playwright.dev/docs/api/class-android#android-launch-server) to launch a
|
|
16372
16937
|
* new Android server instance.
|
|
16373
|
-
* @param
|
|
16938
|
+
* @param endpoint A browser websocket endpoint to connect to.
|
|
16374
16939
|
* @param options
|
|
16375
16940
|
*/
|
|
16376
|
-
connect(
|
|
16941
|
+
connect(endpoint: string, options?: {
|
|
16377
16942
|
/**
|
|
16378
16943
|
* Additional HTTP headers to be sent with web socket connect request. Optional.
|
|
16379
16944
|
*/
|
|
@@ -16913,9 +17478,10 @@ export interface AndroidDevice {
|
|
|
16913
17478
|
*/
|
|
16914
17479
|
recordVideo?: {
|
|
16915
17480
|
/**
|
|
16916
|
-
* Path to the directory to put videos into.
|
|
17481
|
+
* Path to the directory to put videos into. If not specified, the videos will be stored in `artifactsDir` (see
|
|
17482
|
+
* [browserType.launch([options])](https://playwright.dev/docs/api/class-browsertype#browser-type-launch) options).
|
|
16917
17483
|
*/
|
|
16918
|
-
dir
|
|
17484
|
+
dir?: string;
|
|
16919
17485
|
|
|
16920
17486
|
/**
|
|
16921
17487
|
* Optional dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to
|
|
@@ -16933,6 +17499,26 @@ export interface AndroidDevice {
|
|
|
16933
17499
|
*/
|
|
16934
17500
|
height: number;
|
|
16935
17501
|
};
|
|
17502
|
+
|
|
17503
|
+
/**
|
|
17504
|
+
* If specified, enables visual annotations on interacted elements during video recording.
|
|
17505
|
+
*/
|
|
17506
|
+
showActions?: {
|
|
17507
|
+
/**
|
|
17508
|
+
* How long each annotation is displayed in milliseconds. Defaults to `500`.
|
|
17509
|
+
*/
|
|
17510
|
+
duration?: number;
|
|
17511
|
+
|
|
17512
|
+
/**
|
|
17513
|
+
* Position of the action title overlay. Defaults to `"top-right"`.
|
|
17514
|
+
*/
|
|
17515
|
+
position?: "top-left"|"top"|"top-right"|"bottom-left"|"bottom"|"bottom-right";
|
|
17516
|
+
|
|
17517
|
+
/**
|
|
17518
|
+
* Font size of the action title in pixels. Defaults to `24`.
|
|
17519
|
+
*/
|
|
17520
|
+
fontSize?: number;
|
|
17521
|
+
};
|
|
16936
17522
|
};
|
|
16937
17523
|
|
|
16938
17524
|
/**
|
|
@@ -18655,7 +19241,7 @@ export interface BrowserServer {
|
|
|
18655
19241
|
* Browser websocket url.
|
|
18656
19242
|
*
|
|
18657
19243
|
* Browser websocket endpoint which can be used as an argument to
|
|
18658
|
-
* [browserType.connect(
|
|
19244
|
+
* [browserType.connect(endpoint[, options])](https://playwright.dev/docs/api/class-browsertype#browser-type-connect)
|
|
18659
19245
|
* to establish connection to the browser.
|
|
18660
19246
|
*
|
|
18661
19247
|
* Note that if the listen `host` option in `launchServer` options is not specified, localhost will be output anyway,
|
|
@@ -18868,6 +19454,11 @@ export interface ConsoleMessage {
|
|
|
18868
19454
|
*/
|
|
18869
19455
|
text(): string;
|
|
18870
19456
|
|
|
19457
|
+
/**
|
|
19458
|
+
* The timestamp of the console message in milliseconds since the Unix epoch.
|
|
19459
|
+
*/
|
|
19460
|
+
timestamp(): number;
|
|
19461
|
+
|
|
18871
19462
|
type(): "log"|"debug"|"info"|"error"|"warning"|"dir"|"dirxml"|"table"|"trace"|"clear"|"startGroup"|"startGroupCollapsed"|"endGroup"|"assert"|"profile"|"profileEnd"|"count"|"time"|"timeEnd";
|
|
18872
19463
|
|
|
18873
19464
|
/**
|
|
@@ -19015,6 +19606,95 @@ export interface Coverage {
|
|
|
19015
19606
|
}>>;
|
|
19016
19607
|
}
|
|
19017
19608
|
|
|
19609
|
+
/**
|
|
19610
|
+
* API for controlling the Playwright debugger. The debugger allows pausing script execution and inspecting the page.
|
|
19611
|
+
* Obtain the debugger instance via
|
|
19612
|
+
* [browserContext.debugger](https://playwright.dev/docs/api/class-browsercontext#browser-context-debugger).
|
|
19613
|
+
*/
|
|
19614
|
+
export interface Debugger {
|
|
19615
|
+
/**
|
|
19616
|
+
* Emitted when the debugger pauses or resumes.
|
|
19617
|
+
*/
|
|
19618
|
+
on(event: 'pausedstatechanged', listener: () => any): this;
|
|
19619
|
+
|
|
19620
|
+
/**
|
|
19621
|
+
* Adds an event listener that will be automatically removed after it is triggered once. See `addListener` for more information about this event.
|
|
19622
|
+
*/
|
|
19623
|
+
once(event: 'pausedstatechanged', listener: () => any): this;
|
|
19624
|
+
|
|
19625
|
+
/**
|
|
19626
|
+
* Emitted when the debugger pauses or resumes.
|
|
19627
|
+
*/
|
|
19628
|
+
addListener(event: 'pausedstatechanged', listener: () => any): this;
|
|
19629
|
+
|
|
19630
|
+
/**
|
|
19631
|
+
* Removes an event listener added by `on` or `addListener`.
|
|
19632
|
+
*/
|
|
19633
|
+
removeListener(event: 'pausedstatechanged', listener: () => any): this;
|
|
19634
|
+
|
|
19635
|
+
/**
|
|
19636
|
+
* Removes an event listener added by `on` or `addListener`.
|
|
19637
|
+
*/
|
|
19638
|
+
off(event: 'pausedstatechanged', listener: () => any): this;
|
|
19639
|
+
|
|
19640
|
+
/**
|
|
19641
|
+
* Emitted when the debugger pauses or resumes.
|
|
19642
|
+
*/
|
|
19643
|
+
prependListener(event: 'pausedstatechanged', listener: () => any): this;
|
|
19644
|
+
|
|
19645
|
+
/**
|
|
19646
|
+
* Resumes script execution and pauses again before the next action. Throws if the debugger is not paused.
|
|
19647
|
+
*/
|
|
19648
|
+
next(): Promise<void>;
|
|
19649
|
+
|
|
19650
|
+
/**
|
|
19651
|
+
* Returns details about the currently paused call. Returns `null` if the debugger is not paused.
|
|
19652
|
+
*/
|
|
19653
|
+
pausedDetails(): null|{
|
|
19654
|
+
location: {
|
|
19655
|
+
file: string;
|
|
19656
|
+
|
|
19657
|
+
line?: number;
|
|
19658
|
+
|
|
19659
|
+
column?: number;
|
|
19660
|
+
};
|
|
19661
|
+
|
|
19662
|
+
title: string;
|
|
19663
|
+
};
|
|
19664
|
+
|
|
19665
|
+
/**
|
|
19666
|
+
* Configures the debugger to pause before the next action is executed.
|
|
19667
|
+
*
|
|
19668
|
+
* Throws if the debugger is already paused. Use
|
|
19669
|
+
* [debugger.next()](https://playwright.dev/docs/api/class-debugger#debugger-next) or
|
|
19670
|
+
* [debugger.runTo(location)](https://playwright.dev/docs/api/class-debugger#debugger-run-to) to step while paused.
|
|
19671
|
+
*
|
|
19672
|
+
* Note that [page.pause()](https://playwright.dev/docs/api/class-page#page-pause) is equivalent to a "debugger"
|
|
19673
|
+
* statement — it pauses execution at the call site immediately. On the contrary,
|
|
19674
|
+
* [debugger.requestPause()](https://playwright.dev/docs/api/class-debugger#debugger-request-pause) is equivalent to
|
|
19675
|
+
* "pause on next statement" — it configures the debugger to pause before the next action is executed.
|
|
19676
|
+
*/
|
|
19677
|
+
requestPause(): Promise<void>;
|
|
19678
|
+
|
|
19679
|
+
/**
|
|
19680
|
+
* Resumes script execution. Throws if the debugger is not paused.
|
|
19681
|
+
*/
|
|
19682
|
+
resume(): Promise<void>;
|
|
19683
|
+
|
|
19684
|
+
/**
|
|
19685
|
+
* Resumes script execution and pauses when an action originates from the given source location. Throws if the
|
|
19686
|
+
* debugger is not paused.
|
|
19687
|
+
* @param location The source location to pause at.
|
|
19688
|
+
*/
|
|
19689
|
+
runTo(location: {
|
|
19690
|
+
file: string;
|
|
19691
|
+
|
|
19692
|
+
line?: number;
|
|
19693
|
+
|
|
19694
|
+
column?: number;
|
|
19695
|
+
}): Promise<void>;
|
|
19696
|
+
}
|
|
19697
|
+
|
|
19018
19698
|
/**
|
|
19019
19699
|
* [Dialog](https://playwright.dev/docs/api/class-dialog) objects are dispatched by page via the
|
|
19020
19700
|
* [page.on('dialog')](https://playwright.dev/docs/api/class-page#page-event-dialog) event.
|
|
@@ -19078,6 +19758,23 @@ export interface Dialog {
|
|
|
19078
19758
|
type(): string;
|
|
19079
19759
|
}
|
|
19080
19760
|
|
|
19761
|
+
/**
|
|
19762
|
+
* [Disposable](https://playwright.dev/docs/api/class-disposable) is returned from various methods to allow undoing
|
|
19763
|
+
* the corresponding action. For example,
|
|
19764
|
+
* [page.addInitScript(script[, arg])](https://playwright.dev/docs/api/class-page#page-add-init-script) returns a
|
|
19765
|
+
* [Disposable](https://playwright.dev/docs/api/class-disposable) that can be used to remove the init script.
|
|
19766
|
+
*/
|
|
19767
|
+
export interface Disposable {
|
|
19768
|
+
/**
|
|
19769
|
+
* Removes the associated resource. For example, removes the init script installed via
|
|
19770
|
+
* [page.addInitScript(script[, arg])](https://playwright.dev/docs/api/class-page#page-add-init-script) or
|
|
19771
|
+
* [browserContext.addInitScript(script[, arg])](https://playwright.dev/docs/api/class-browsercontext#browser-context-add-init-script).
|
|
19772
|
+
*/
|
|
19773
|
+
dispose(): Promise<void>;
|
|
19774
|
+
|
|
19775
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
19776
|
+
}
|
|
19777
|
+
|
|
19081
19778
|
/**
|
|
19082
19779
|
* [Download](https://playwright.dev/docs/api/class-download) objects are dispatched by page via the
|
|
19083
19780
|
* [page.on('download')](https://playwright.dev/docs/api/class-page#page-event-download) event.
|
|
@@ -19234,11 +19931,23 @@ export interface Electron {
|
|
|
19234
19931
|
*/
|
|
19235
19932
|
args?: Array<string>;
|
|
19236
19933
|
|
|
19934
|
+
/**
|
|
19935
|
+
* If specified, artifacts (traces, videos, downloads, HAR files, etc.) are saved into this directory. The directory
|
|
19936
|
+
* is not cleaned up when the browser closes. If not specified, a temporary directory is used and cleaned up when the
|
|
19937
|
+
* browser closes.
|
|
19938
|
+
*/
|
|
19939
|
+
artifactsDir?: string;
|
|
19940
|
+
|
|
19237
19941
|
/**
|
|
19238
19942
|
* Toggles bypassing page's Content-Security-Policy. Defaults to `false`.
|
|
19239
19943
|
*/
|
|
19240
19944
|
bypassCSP?: boolean;
|
|
19241
19945
|
|
|
19946
|
+
/**
|
|
19947
|
+
* Enable Chromium sandboxing. Defaults to `false`.
|
|
19948
|
+
*/
|
|
19949
|
+
chromiumSandbox?: boolean;
|
|
19950
|
+
|
|
19242
19951
|
/**
|
|
19243
19952
|
* Emulates [prefers-colors-scheme](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme)
|
|
19244
19953
|
* media feature, supported values are `'light'` and `'dark'`. See
|
|
@@ -19377,9 +20086,10 @@ export interface Electron {
|
|
|
19377
20086
|
*/
|
|
19378
20087
|
recordVideo?: {
|
|
19379
20088
|
/**
|
|
19380
|
-
* Path to the directory to put videos into.
|
|
20089
|
+
* Path to the directory to put videos into. If not specified, the videos will be stored in `artifactsDir` (see
|
|
20090
|
+
* [browserType.launch([options])](https://playwright.dev/docs/api/class-browsertype#browser-type-launch) options).
|
|
19381
20091
|
*/
|
|
19382
|
-
dir
|
|
20092
|
+
dir?: string;
|
|
19383
20093
|
|
|
19384
20094
|
/**
|
|
19385
20095
|
* Optional dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to
|
|
@@ -19397,6 +20107,26 @@ export interface Electron {
|
|
|
19397
20107
|
*/
|
|
19398
20108
|
height: number;
|
|
19399
20109
|
};
|
|
20110
|
+
|
|
20111
|
+
/**
|
|
20112
|
+
* If specified, enables visual annotations on interacted elements during video recording.
|
|
20113
|
+
*/
|
|
20114
|
+
showActions?: {
|
|
20115
|
+
/**
|
|
20116
|
+
* How long each annotation is displayed in milliseconds. Defaults to `500`.
|
|
20117
|
+
*/
|
|
20118
|
+
duration?: number;
|
|
20119
|
+
|
|
20120
|
+
/**
|
|
20121
|
+
* Position of the action title overlay. Defaults to `"top-right"`.
|
|
20122
|
+
*/
|
|
20123
|
+
position?: "top-left"|"top"|"top-right"|"bottom-left"|"bottom"|"bottom-right";
|
|
20124
|
+
|
|
20125
|
+
/**
|
|
20126
|
+
* Font size of the action title in pixels. Defaults to `24`.
|
|
20127
|
+
*/
|
|
20128
|
+
fontSize?: number;
|
|
20129
|
+
};
|
|
19400
20130
|
};
|
|
19401
20131
|
|
|
19402
20132
|
/**
|
|
@@ -19657,7 +20387,7 @@ export interface FrameLocator {
|
|
|
19657
20387
|
* <button>Submit</button>
|
|
19658
20388
|
* ```
|
|
19659
20389
|
*
|
|
19660
|
-
* You can locate each element by
|
|
20390
|
+
* You can locate each element by its implicit role:
|
|
19661
20391
|
*
|
|
19662
20392
|
* ```js
|
|
19663
20393
|
* await expect(page.getByRole('heading', { name: 'Sign up' })).toBeVisible();
|
|
@@ -19763,7 +20493,7 @@ export interface FrameLocator {
|
|
|
19763
20493
|
* <button data-testid="directions">Itinéraire</button>
|
|
19764
20494
|
* ```
|
|
19765
20495
|
*
|
|
19766
|
-
* You can locate the element by
|
|
20496
|
+
* You can locate the element by its test id:
|
|
19767
20497
|
*
|
|
19768
20498
|
* ```js
|
|
19769
20499
|
* await page.getByTestId('directions').click();
|
|
@@ -20365,6 +21095,16 @@ export interface Request {
|
|
|
20365
21095
|
*/
|
|
20366
21096
|
allHeaders(): Promise<{ [key: string]: string; }>;
|
|
20367
21097
|
|
|
21098
|
+
/**
|
|
21099
|
+
* Returns the [Response](https://playwright.dev/docs/api/class-response) object if the response has already been
|
|
21100
|
+
* received, `null` otherwise.
|
|
21101
|
+
*
|
|
21102
|
+
* Unlike [request.response()](https://playwright.dev/docs/api/class-request#request-response), this method does not
|
|
21103
|
+
* wait for the response to arrive. It returns immediately with the response object if the response has been received,
|
|
21104
|
+
* or `null` if the response has not been received yet.
|
|
21105
|
+
*/
|
|
21106
|
+
existingResponse(): null|Response;
|
|
21107
|
+
|
|
20368
21108
|
/**
|
|
20369
21109
|
* The method returns `null` unless this request has failed, as reported by `requestfailed` event.
|
|
20370
21110
|
*
|
|
@@ -20719,6 +21459,11 @@ export interface Response {
|
|
|
20719
21459
|
*/
|
|
20720
21460
|
headerValues(name: string): Promise<Array<string>>;
|
|
20721
21461
|
|
|
21462
|
+
/**
|
|
21463
|
+
* Returns the http version used by the response.
|
|
21464
|
+
*/
|
|
21465
|
+
httpVersion(): Promise<string>;
|
|
21466
|
+
|
|
20722
21467
|
/**
|
|
20723
21468
|
* Returns the JSON representation of response body.
|
|
20724
21469
|
*
|
|
@@ -21285,7 +22030,7 @@ export interface Tracing {
|
|
|
21285
22030
|
|
|
21286
22031
|
column?: number;
|
|
21287
22032
|
};
|
|
21288
|
-
}): Promise<
|
|
22033
|
+
}): Promise<Disposable>;
|
|
21289
22034
|
|
|
21290
22035
|
/**
|
|
21291
22036
|
* Closes the last group created by
|
|
@@ -21318,6 +22063,13 @@ export interface Tracing {
|
|
|
21318
22063
|
* @param options
|
|
21319
22064
|
*/
|
|
21320
22065
|
start(options?: {
|
|
22066
|
+
/**
|
|
22067
|
+
* When enabled, the trace is written to an unarchived file that is updated in real time as actions occur, instead of
|
|
22068
|
+
* caching changes and archiving them into a zip file at the end. This is useful for live trace viewing during test
|
|
22069
|
+
* execution.
|
|
22070
|
+
*/
|
|
22071
|
+
live?: boolean;
|
|
22072
|
+
|
|
21321
22073
|
/**
|
|
21322
22074
|
* If specified, intermediate trace files are going to be saved into the files with the given name prefix inside the
|
|
21323
22075
|
* [`tracesDir`](https://playwright.dev/docs/api/class-browsertype#browser-type-launch-option-traces-dir) directory
|
|
@@ -21739,6 +22491,13 @@ export interface LaunchOptions {
|
|
|
21739
22491
|
*/
|
|
21740
22492
|
args?: Array<string>;
|
|
21741
22493
|
|
|
22494
|
+
/**
|
|
22495
|
+
* If specified, artifacts (traces, videos, downloads, HAR files, etc.) are saved into this directory. The directory
|
|
22496
|
+
* is not cleaned up when the browser closes. If not specified, a temporary directory is used and cleaned up when the
|
|
22497
|
+
* browser closes.
|
|
22498
|
+
*/
|
|
22499
|
+
artifactsDir?: string;
|
|
22500
|
+
|
|
21742
22501
|
/**
|
|
21743
22502
|
* Browser distribution channel.
|
|
21744
22503
|
*
|
|
@@ -22300,9 +23059,10 @@ export interface BrowserContextOptions {
|
|
|
22300
23059
|
*/
|
|
22301
23060
|
recordVideo?: {
|
|
22302
23061
|
/**
|
|
22303
|
-
* Path to the directory to put videos into.
|
|
23062
|
+
* Path to the directory to put videos into. If not specified, the videos will be stored in `artifactsDir` (see
|
|
23063
|
+
* [browserType.launch([options])](https://playwright.dev/docs/api/class-browsertype#browser-type-launch) options).
|
|
22304
23064
|
*/
|
|
22305
|
-
dir
|
|
23065
|
+
dir?: string;
|
|
22306
23066
|
|
|
22307
23067
|
/**
|
|
22308
23068
|
* Optional dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to
|
|
@@ -22320,6 +23080,26 @@ export interface BrowserContextOptions {
|
|
|
22320
23080
|
*/
|
|
22321
23081
|
height: number;
|
|
22322
23082
|
};
|
|
23083
|
+
|
|
23084
|
+
/**
|
|
23085
|
+
* If specified, enables visual annotations on interacted elements during video recording.
|
|
23086
|
+
*/
|
|
23087
|
+
showActions?: {
|
|
23088
|
+
/**
|
|
23089
|
+
* How long each annotation is displayed in milliseconds. Defaults to `500`.
|
|
23090
|
+
*/
|
|
23091
|
+
duration?: number;
|
|
23092
|
+
|
|
23093
|
+
/**
|
|
23094
|
+
* Position of the action title overlay. Defaults to `"top-right"`.
|
|
23095
|
+
*/
|
|
23096
|
+
position?: "top-left"|"top"|"top-right"|"bottom-left"|"bottom"|"bottom-right";
|
|
23097
|
+
|
|
23098
|
+
/**
|
|
23099
|
+
* Font size of the action title in pixels. Defaults to `24`.
|
|
23100
|
+
*/
|
|
23101
|
+
fontSize?: number;
|
|
23102
|
+
};
|
|
22323
23103
|
};
|
|
22324
23104
|
|
|
22325
23105
|
/**
|