patchright-core 1.57.0 → 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 +2688 -297
- package/browsers.json +23 -22
- 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 +48 -413
- package/lib/client/android.js +4 -4
- package/lib/client/api.js +3 -0
- package/lib/client/browser.js +11 -5
- package/lib/client/browserContext.js +20 -23
- package/lib/client/browserType.js +23 -54
- package/lib/client/cdpSession.js +6 -2
- package/lib/client/channelOwner.js +1 -1
- package/lib/client/clientHelper.js +2 -1
- package/lib/client/clock.js +0 -1
- package/lib/client/{webSocket.js → connect.js} +57 -7
- package/lib/client/connection.js +8 -0
- 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 -1
- package/lib/client/events.js +3 -0
- package/lib/client/fetch.js +2 -4
- package/lib/client/frame.js +9 -13
- package/lib/client/harRouter.js +13 -1
- package/lib/client/jsHandle.js +4 -8
- package/lib/client/locator.js +13 -36
- package/lib/client/network.js +14 -11
- package/lib/client/page.js +44 -50
- package/lib/client/screencast.js +88 -0
- package/lib/client/selectors.js +3 -1
- package/lib/client/tracing.js +11 -5
- package/lib/client/video.js +13 -20
- package/lib/client/worker.js +6 -6
- 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 +78 -0
- package/lib/mcpBundleImpl.js +91 -0
- package/lib/protocol/serializers.js +5 -0
- package/lib/protocol/validator.js +228 -58
- 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 +14 -10
- 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/artifact.js +1 -1
- package/lib/server/bidi/bidiBrowser.js +80 -14
- package/lib/server/bidi/bidiChromium.js +23 -14
- package/lib/server/bidi/bidiConnection.js +1 -0
- package/lib/server/bidi/bidiDeserializer.js +116 -0
- package/lib/server/bidi/bidiExecutionContext.js +75 -29
- package/lib/server/bidi/bidiFirefox.js +6 -8
- package/lib/server/bidi/bidiNetworkManager.js +40 -12
- package/lib/server/bidi/bidiPage.js +67 -40
- package/lib/server/bidi/third_party/bidiProtocolCore.js +1 -0
- package/lib/server/bidi/third_party/firefoxPrefs.js +3 -1
- package/lib/server/browser.js +84 -21
- package/lib/server/browserContext.js +137 -77
- package/lib/server/browserType.js +26 -16
- package/lib/server/chromium/chromium.js +28 -31
- package/lib/server/chromium/chromiumSwitches.js +16 -4
- package/lib/server/chromium/crBrowser.js +40 -27
- package/lib/server/chromium/crConnection.js +0 -5
- package/lib/server/chromium/crDevTools.js +1 -2
- package/lib/server/chromium/crNetworkManager.js +54 -229
- package/lib/server/chromium/crPage.js +74 -260
- package/lib/server/chromium/crServiceWorker.js +7 -14
- package/lib/server/clock.js +33 -41
- package/lib/server/codegen/javascript.js +6 -29
- 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 +30 -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 +7 -14
- package/lib/server/dispatchers/disposableDispatcher.js +39 -0
- package/lib/server/dispatchers/electronDispatcher.js +2 -1
- package/lib/server/dispatchers/frameDispatcher.js +7 -7
- package/lib/server/dispatchers/localUtilsDispatcher.js +37 -1
- package/lib/server/dispatchers/networkDispatchers.js +6 -5
- package/lib/server/dispatchers/pageDispatcher.js +101 -34
- package/lib/server/dispatchers/webSocketRouteDispatcher.js +4 -5
- package/lib/server/disposable.js +41 -0
- package/lib/server/dom.js +56 -29
- package/lib/server/download.js +3 -2
- package/lib/server/electron/electron.js +17 -9
- package/lib/server/firefox/ffBrowser.js +9 -29
- package/lib/server/firefox/ffConnection.js +0 -5
- package/lib/server/firefox/ffInput.js +21 -5
- package/lib/server/firefox/ffNetworkManager.js +4 -4
- package/lib/server/firefox/ffPage.js +27 -33
- package/lib/server/firefox/firefox.js +6 -8
- package/lib/server/frameSelectors.js +14 -169
- package/lib/server/frames.js +263 -551
- 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 +8 -0
- package/lib/server/javascript.js +6 -22
- package/lib/server/launchApp.js +0 -1
- package/lib/server/localUtils.js +6 -6
- package/lib/server/network.js +59 -20
- package/lib/server/overlay.js +138 -0
- package/lib/server/page.js +179 -157
- package/lib/server/progress.js +32 -6
- package/lib/server/recorder/recorderApp.js +84 -104
- package/lib/server/recorder.js +76 -40
- package/lib/server/registry/browserFetcher.js +6 -4
- package/lib/server/registry/index.js +222 -226
- package/lib/server/registry/nativeDeps.js +1 -0
- package/lib/server/registry/oopDownloadBrowserMain.js +3 -0
- package/lib/server/screencast.js +137 -0
- package/lib/server/trace/recorder/snapshotter.js +2 -2
- package/lib/server/trace/recorder/snapshotterInjected.js +21 -1
- package/lib/server/trace/recorder/tracing.js +98 -47
- package/lib/server/trace/viewer/traceViewer.js +24 -21
- 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/expectUtils.js +87 -2
- package/lib/server/utils/fileUtils.js +16 -2
- package/lib/server/utils/happyEyeballs.js +15 -12
- package/lib/server/utils/httpServer.js +10 -23
- package/lib/server/utils/network.js +39 -29
- package/lib/server/utils/processLauncher.js +8 -6
- package/lib/server/utils/zipFile.js +2 -2
- package/lib/server/videoRecorder.js +194 -0
- package/lib/server/webkit/webkit.js +4 -6
- package/lib/server/webkit/wkBrowser.js +1 -10
- package/lib/server/webkit/wkConnection.js +1 -6
- package/lib/server/webkit/wkInterceptableRequest.js +29 -1
- package/lib/server/webkit/wkPage.js +88 -57
- 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/tools/trace/installSkill.js +48 -0
- 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/ariaSnapshot.js +60 -2
- package/lib/utils/isomorphic/formatUtils.js +64 -0
- package/lib/utils/isomorphic/jsonSchema.js +89 -0
- package/lib/utils/isomorphic/lruCache.js +51 -0
- package/lib/utils/isomorphic/mimeType.js +7 -2
- package/lib/utils/isomorphic/protocolFormatter.js +2 -2
- package/lib/utils/isomorphic/protocolMetainfo.js +127 -98
- package/lib/utils/isomorphic/stringUtils.js +49 -0
- package/lib/utils/isomorphic/timeoutRunner.js +3 -3
- package/lib/utils/isomorphic/trace/entries.js +16 -0
- package/lib/utils/isomorphic/trace/snapshotRenderer.js +492 -0
- package/lib/utils/isomorphic/trace/snapshotServer.js +120 -0
- package/lib/utils/isomorphic/trace/snapshotStorage.js +89 -0
- package/lib/utils/isomorphic/trace/traceLoader.js +132 -0
- package/lib/utils/isomorphic/trace/traceModel.js +366 -0
- package/lib/utils/isomorphic/trace/traceModernizer.js +401 -0
- package/lib/utils/isomorphic/trace/versions/traceV3.js +16 -0
- package/lib/utils/isomorphic/trace/versions/traceV4.js +16 -0
- package/lib/utils/isomorphic/trace/versions/traceV5.js +16 -0
- package/lib/utils/isomorphic/trace/versions/traceV6.js +16 -0
- package/lib/utils/isomorphic/trace/versions/traceV7.js +16 -0
- package/lib/utils/isomorphic/trace/versions/traceV8.js +16 -0
- package/lib/utils/isomorphic/urlMatch.js +54 -1
- package/lib/utils/isomorphic/utilityScriptSerializers.js +11 -0
- package/lib/utils/isomorphic/yaml.js +84 -0
- package/lib/utils.js +8 -2
- package/lib/utilsBundle.js +5 -26
- package/lib/utilsBundleImpl/index.js +172 -173
- 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-C8KMvO9L.js +32 -0
- package/lib/vite/recorder/assets/{codeMirrorModule-C3UTv-Ge.css → codeMirrorModule-DYBRYzYX.css} +1 -1
- package/lib/vite/recorder/assets/{index-Ri0uHF7I.css → index-BSjZa4pk.css} +1 -1
- package/lib/vite/recorder/assets/index-CqAYX1I3.js +193 -0
- package/lib/vite/recorder/index.html +2 -2
- package/lib/vite/traceViewer/assets/codeMirrorModule-DS0FLvoc.js +32 -0
- package/lib/vite/traceViewer/assets/defaultSettingsView-GTWI-W_B.js +262 -0
- package/lib/vite/traceViewer/{codeMirrorModule.C3UTv-Ge.css → codeMirrorModule.DYBRYzYX.css} +1 -1
- package/lib/vite/traceViewer/defaultSettingsView.B4dS75f0.css +1 -0
- package/lib/vite/traceViewer/index.CzXZzn5A.css +1 -0
- package/lib/vite/traceViewer/index.Dtstcb7U.js +2 -0
- package/lib/vite/traceViewer/index.html +4 -4
- package/lib/vite/traceViewer/sw.bundle.js +5 -3
- 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 +7 -1
- package/types/protocol.d.ts +1696 -221
- package/types/types.d.ts +879 -112
- package/lib/server/bidi/third_party/bidiDeserializer.js +0 -98
- package/lib/server/chromium/videoRecorder.js +0 -115
- package/lib/server/pageBinding.js +0 -87
- package/lib/server/trace/test/inMemorySnapshotter.js +0 -87
- package/lib/utils/isomorphic/oldUtilityScriptSerializers.js +0 -248
- package/lib/vite/recorder/assets/codeMirrorModule-CBbSe-ZI.js +0 -25
- package/lib/vite/recorder/assets/index-CpZVd2nA.js +0 -193
- package/lib/vite/traceViewer/assets/codeMirrorModule-DHz0wP2C.js +0 -25
- package/lib/vite/traceViewer/assets/defaultSettingsView-WsZP88O6.js +0 -266
- package/lib/vite/traceViewer/defaultSettingsView.ConWv5KN.css +0 -1
- package/lib/vite/traceViewer/index.C4Y3Aw8n.css +0 -1
- package/lib/vite/traceViewer/index.C8xAeo93.js +0 -2
- package/lib/vite/traceViewer/uiMode.BltraIJB.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
|
*/
|
|
@@ -12457,6 +12694,12 @@ export interface Locator {
|
|
|
12457
12694
|
elementHandle(options?: {
|
|
12458
12695
|
timeout?: number;
|
|
12459
12696
|
}): Promise<null|ElementHandle<SVGElement | HTMLElement>>;
|
|
12697
|
+
/**
|
|
12698
|
+
* Returns a human-readable representation of the locator, using the
|
|
12699
|
+
* [locator.description()](https://playwright.dev/docs/api/class-locator#locator-description) if one exists;
|
|
12700
|
+
* otherwise, it generates a string based on the locator's selector.
|
|
12701
|
+
*/
|
|
12702
|
+
toString(): string;
|
|
12460
12703
|
/**
|
|
12461
12704
|
* When the locator points to a list of elements, this returns an array of locators, pointing to their respective
|
|
12462
12705
|
* elements.
|
|
@@ -12569,9 +12812,25 @@ export interface Locator {
|
|
|
12569
12812
|
* - link "About"
|
|
12570
12813
|
* ```
|
|
12571
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.
|
|
12572
12820
|
* @param options
|
|
12573
12821
|
*/
|
|
12574
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
|
+
|
|
12575
12834
|
/**
|
|
12576
12835
|
* Maximum time in milliseconds. Defaults to `0` - no timeout. The default value can be changed via `actionTimeout`
|
|
12577
12836
|
* option in the config, or by using the
|
|
@@ -13011,8 +13270,9 @@ export interface Locator {
|
|
|
13011
13270
|
/**
|
|
13012
13271
|
* Returns locator description previously set with
|
|
13013
13272
|
* [locator.describe(description)](https://playwright.dev/docs/api/class-locator#locator-describe). Returns `null` if
|
|
13014
|
-
* no custom description has been set. Prefer
|
|
13015
|
-
*
|
|
13273
|
+
* no custom description has been set. Prefer
|
|
13274
|
+
* [locator.toString()](https://playwright.dev/docs/api/class-locator#locator-to-string) for a human-readable
|
|
13275
|
+
* representation, as it uses the description when available.
|
|
13016
13276
|
*
|
|
13017
13277
|
* **Usage**
|
|
13018
13278
|
*
|
|
@@ -13431,7 +13691,7 @@ export interface Locator {
|
|
|
13431
13691
|
* <button>Submit</button>
|
|
13432
13692
|
* ```
|
|
13433
13693
|
*
|
|
13434
|
-
* You can locate each element by
|
|
13694
|
+
* You can locate each element by its implicit role:
|
|
13435
13695
|
*
|
|
13436
13696
|
* ```js
|
|
13437
13697
|
* await expect(page.getByRole('heading', { name: 'Sign up' })).toBeVisible();
|
|
@@ -13536,7 +13796,7 @@ export interface Locator {
|
|
|
13536
13796
|
* <button data-testid="directions">Itinéraire</button>
|
|
13537
13797
|
* ```
|
|
13538
13798
|
*
|
|
13539
|
-
* You can locate the element by
|
|
13799
|
+
* You can locate the element by its test id:
|
|
13540
13800
|
*
|
|
13541
13801
|
* ```js
|
|
13542
13802
|
* await page.getByTestId('directions').click();
|
|
@@ -13996,6 +14256,13 @@ export interface Locator {
|
|
|
13996
14256
|
hasText?: string|RegExp;
|
|
13997
14257
|
}): Locator;
|
|
13998
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
|
+
|
|
13999
14266
|
/**
|
|
14000
14267
|
* Returns locator to the n-th matching element. It's zero based, `nth(0)` selects the first element.
|
|
14001
14268
|
*
|
|
@@ -14728,9 +14995,9 @@ export interface BrowserType<Unused = {}> {
|
|
|
14728
14995
|
* **NOTE** Connecting over the Chrome DevTools Protocol is only supported for Chromium-based browsers.
|
|
14729
14996
|
*
|
|
14730
14997
|
* **NOTE** This connection is significantly lower fidelity than the Playwright protocol connection via
|
|
14731
|
-
* [browserType.connect(
|
|
14998
|
+
* [browserType.connect(endpoint[, options])](https://playwright.dev/docs/api/class-browsertype#browser-type-connect).
|
|
14732
14999
|
* If you are experiencing issues or attempting to use advanced functionality, you probably want to use
|
|
14733
|
-
* [browserType.connect(
|
|
15000
|
+
* [browserType.connect(endpoint[, options])](https://playwright.dev/docs/api/class-browsertype#browser-type-connect).
|
|
14734
15001
|
*
|
|
14735
15002
|
* **Usage**
|
|
14736
15003
|
*
|
|
@@ -14758,9 +15025,9 @@ export interface BrowserType<Unused = {}> {
|
|
|
14758
15025
|
* **NOTE** Connecting over the Chrome DevTools Protocol is only supported for Chromium-based browsers.
|
|
14759
15026
|
*
|
|
14760
15027
|
* **NOTE** This connection is significantly lower fidelity than the Playwright protocol connection via
|
|
14761
|
-
* [browserType.connect(
|
|
15028
|
+
* [browserType.connect(endpoint[, options])](https://playwright.dev/docs/api/class-browsertype#browser-type-connect).
|
|
14762
15029
|
* If you are experiencing issues or attempting to use advanced functionality, you probably want to use
|
|
14763
|
-
* [browserType.connect(
|
|
15030
|
+
* [browserType.connect(endpoint[, options])](https://playwright.dev/docs/api/class-browsertype#browser-type-connect).
|
|
14764
15031
|
*
|
|
14765
15032
|
* **Usage**
|
|
14766
15033
|
*
|
|
@@ -14781,7 +15048,7 @@ export interface BrowserType<Unused = {}> {
|
|
|
14781
15048
|
* **NOTE** The major and minor version of the Playwright instance that connects needs to match the version of
|
|
14782
15049
|
* Playwright that launches the browser (1.2.3 → is compatible with 1.2.x).
|
|
14783
15050
|
*
|
|
14784
|
-
* @param
|
|
15051
|
+
* @param endpoint A Playwright browser websocket endpoint to connect to. You obtain this endpoint via `BrowserServer.wsEndpoint`.
|
|
14785
15052
|
* @param options
|
|
14786
15053
|
*/
|
|
14787
15054
|
connect(wsEndpoint: string, options?: ConnectOptions): Promise<Browser>;
|
|
@@ -14797,7 +15064,7 @@ export interface BrowserType<Unused = {}> {
|
|
|
14797
15064
|
* **NOTE** The major and minor version of the Playwright instance that connects needs to match the version of
|
|
14798
15065
|
* Playwright that launches the browser (1.2.3 → is compatible with 1.2.x).
|
|
14799
15066
|
*
|
|
14800
|
-
* @param
|
|
15067
|
+
* @param endpoint A Playwright browser websocket endpoint to connect to. You obtain this endpoint via `BrowserServer.wsEndpoint`.
|
|
14801
15068
|
* @param options
|
|
14802
15069
|
*/
|
|
14803
15070
|
connect(options: ConnectOptions & { wsEndpoint?: string }): Promise<Browser>;
|
|
@@ -14879,6 +15146,13 @@ export interface BrowserType<Unused = {}> {
|
|
|
14879
15146
|
*/
|
|
14880
15147
|
args?: Array<string>;
|
|
14881
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
|
+
|
|
14882
15156
|
/**
|
|
14883
15157
|
* When using [page.goto(url[, options])](https://playwright.dev/docs/api/class-page#page-goto),
|
|
14884
15158
|
* [page.route(url, handler[, options])](https://playwright.dev/docs/api/class-page#page-route),
|
|
@@ -14998,14 +15272,6 @@ export interface BrowserType<Unused = {}> {
|
|
|
14998
15272
|
*/
|
|
14999
15273
|
deviceScaleFactor?: number;
|
|
15000
15274
|
|
|
15001
|
-
/**
|
|
15002
|
-
* **Chromium-only** Whether to auto-open a Developer Tools panel for each tab. If this option is `true`, the
|
|
15003
|
-
* [`headless`](https://playwright.dev/docs/api/class-browsertype#browser-type-launch-persistent-context-option-headless)
|
|
15004
|
-
* option will be set `false`.
|
|
15005
|
-
* @deprecated Use [debugging tools](https://playwright.dev/docs/debug) instead.
|
|
15006
|
-
*/
|
|
15007
|
-
devtools?: boolean;
|
|
15008
|
-
|
|
15009
15275
|
/**
|
|
15010
15276
|
* If specified, accepted downloads are downloaded into this directory. Otherwise, temporary directory is created and
|
|
15011
15277
|
* is deleted when browser is closed. In either case, the downloads are deleted when the browser context they were
|
|
@@ -15085,9 +15351,7 @@ export interface BrowserType<Unused = {}> {
|
|
|
15085
15351
|
/**
|
|
15086
15352
|
* Whether to run browser in headless mode. More details for
|
|
15087
15353
|
* [Chromium](https://developers.google.com/web/updates/2017/04/headless-chrome) and
|
|
15088
|
-
* [Firefox](https://hacks.mozilla.org/2017/12/using-headless-mode-in-firefox/). Defaults to `true
|
|
15089
|
-
* [`devtools`](https://playwright.dev/docs/api/class-browsertype#browser-type-launch-option-devtools) option is
|
|
15090
|
-
* `true`.
|
|
15354
|
+
* [Firefox](https://hacks.mozilla.org/2017/12/using-headless-mode-in-firefox/). Defaults to `true`.
|
|
15091
15355
|
*/
|
|
15092
15356
|
headless?: boolean;
|
|
15093
15357
|
|
|
@@ -15243,9 +15507,10 @@ export interface BrowserType<Unused = {}> {
|
|
|
15243
15507
|
*/
|
|
15244
15508
|
recordVideo?: {
|
|
15245
15509
|
/**
|
|
15246
|
-
* 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).
|
|
15247
15512
|
*/
|
|
15248
|
-
dir
|
|
15513
|
+
dir?: string;
|
|
15249
15514
|
|
|
15250
15515
|
/**
|
|
15251
15516
|
* Optional dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to
|
|
@@ -15263,6 +15528,26 @@ export interface BrowserType<Unused = {}> {
|
|
|
15263
15528
|
*/
|
|
15264
15529
|
height: number;
|
|
15265
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
|
+
};
|
|
15266
15551
|
};
|
|
15267
15552
|
|
|
15268
15553
|
/**
|
|
@@ -15381,7 +15666,7 @@ export interface BrowserType<Unused = {}> {
|
|
|
15381
15666
|
|
|
15382
15667
|
/**
|
|
15383
15668
|
* Returns the browser app instance. You can connect to it via
|
|
15384
|
-
* [browserType.connect(
|
|
15669
|
+
* [browserType.connect(endpoint[, options])](https://playwright.dev/docs/api/class-browsertype#browser-type-connect),
|
|
15385
15670
|
* which requires the major/minor client/server version to match (1.2.3 → is compatible with 1.2.x).
|
|
15386
15671
|
*
|
|
15387
15672
|
* **Usage**
|
|
@@ -15413,6 +15698,13 @@ export interface BrowserType<Unused = {}> {
|
|
|
15413
15698
|
*/
|
|
15414
15699
|
args?: Array<string>;
|
|
15415
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
|
+
|
|
15416
15708
|
/**
|
|
15417
15709
|
* Browser distribution channel.
|
|
15418
15710
|
*
|
|
@@ -15428,14 +15720,6 @@ export interface BrowserType<Unused = {}> {
|
|
|
15428
15720
|
*/
|
|
15429
15721
|
chromiumSandbox?: boolean;
|
|
15430
15722
|
|
|
15431
|
-
/**
|
|
15432
|
-
* **Chromium-only** Whether to auto-open a Developer Tools panel for each tab. If this option is `true`, the
|
|
15433
|
-
* [`headless`](https://playwright.dev/docs/api/class-browsertype#browser-type-launch-server-option-headless) option
|
|
15434
|
-
* will be set `false`.
|
|
15435
|
-
* @deprecated Use [debugging tools](https://playwright.dev/docs/debug) instead.
|
|
15436
|
-
*/
|
|
15437
|
-
devtools?: boolean;
|
|
15438
|
-
|
|
15439
15723
|
/**
|
|
15440
15724
|
* If specified, accepted downloads are downloaded into this directory. Otherwise, temporary directory is created and
|
|
15441
15725
|
* is deleted when browser is closed. In either case, the downloads are deleted when the browser context they were
|
|
@@ -15480,9 +15764,7 @@ export interface BrowserType<Unused = {}> {
|
|
|
15480
15764
|
/**
|
|
15481
15765
|
* Whether to run browser in headless mode. More details for
|
|
15482
15766
|
* [Chromium](https://developers.google.com/web/updates/2017/04/headless-chrome) and
|
|
15483
|
-
* [Firefox](https://hacks.mozilla.org/2017/12/using-headless-mode-in-firefox/). Defaults to `true
|
|
15484
|
-
* [`devtools`](https://playwright.dev/docs/api/class-browsertype#browser-type-launch-option-devtools) option is
|
|
15485
|
-
* `true`.
|
|
15767
|
+
* [Firefox](https://hacks.mozilla.org/2017/12/using-headless-mode-in-firefox/). Defaults to `true`.
|
|
15486
15768
|
*/
|
|
15487
15769
|
headless?: boolean;
|
|
15488
15770
|
|
|
@@ -15588,11 +15870,11 @@ export interface BrowserType<Unused = {}> {
|
|
|
15588
15870
|
*
|
|
15589
15871
|
*/
|
|
15590
15872
|
export interface CDPSession {
|
|
15591
|
-
on
|
|
15592
|
-
addListener
|
|
15593
|
-
off
|
|
15594
|
-
removeListener
|
|
15595
|
-
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;
|
|
15596
15878
|
/**
|
|
15597
15879
|
* @param method Protocol method name.
|
|
15598
15880
|
* @param params Optional method parameters.
|
|
@@ -15601,6 +15883,156 @@ export interface CDPSession {
|
|
|
15601
15883
|
method: T,
|
|
15602
15884
|
params?: Protocol.CommandParameters[T]
|
|
15603
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
|
+
|
|
15604
16036
|
/**
|
|
15605
16037
|
* Detaches the CDPSession from the target. Once detached, the CDPSession object won't emit any events and can't be
|
|
15606
16038
|
* used to send messages.
|
|
@@ -15784,6 +16216,126 @@ export interface WebSocketRoute {
|
|
|
15784
16216
|
[Symbol.asyncDispose](): Promise<void>;
|
|
15785
16217
|
}
|
|
15786
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
|
+
|
|
15787
16339
|
type DeviceDescriptor = {
|
|
15788
16340
|
viewport: ViewportSize;
|
|
15789
16341
|
userAgent: string;
|
|
@@ -16383,10 +16935,10 @@ export interface Android {
|
|
|
16383
16935
|
* This methods attaches Playwright to an existing Android device. Use
|
|
16384
16936
|
* [android.launchServer([options])](https://playwright.dev/docs/api/class-android#android-launch-server) to launch a
|
|
16385
16937
|
* new Android server instance.
|
|
16386
|
-
* @param
|
|
16938
|
+
* @param endpoint A browser websocket endpoint to connect to.
|
|
16387
16939
|
* @param options
|
|
16388
16940
|
*/
|
|
16389
|
-
connect(
|
|
16941
|
+
connect(endpoint: string, options?: {
|
|
16390
16942
|
/**
|
|
16391
16943
|
* Additional HTTP headers to be sent with web socket connect request. Optional.
|
|
16392
16944
|
*/
|
|
@@ -16926,9 +17478,10 @@ export interface AndroidDevice {
|
|
|
16926
17478
|
*/
|
|
16927
17479
|
recordVideo?: {
|
|
16928
17480
|
/**
|
|
16929
|
-
* 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).
|
|
16930
17483
|
*/
|
|
16931
|
-
dir
|
|
17484
|
+
dir?: string;
|
|
16932
17485
|
|
|
16933
17486
|
/**
|
|
16934
17487
|
* Optional dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to
|
|
@@ -16946,6 +17499,26 @@ export interface AndroidDevice {
|
|
|
16946
17499
|
*/
|
|
16947
17500
|
height: number;
|
|
16948
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
|
+
};
|
|
16949
17522
|
};
|
|
16950
17523
|
|
|
16951
17524
|
/**
|
|
@@ -18668,7 +19241,7 @@ export interface BrowserServer {
|
|
|
18668
19241
|
* Browser websocket url.
|
|
18669
19242
|
*
|
|
18670
19243
|
* Browser websocket endpoint which can be used as an argument to
|
|
18671
|
-
* [browserType.connect(
|
|
19244
|
+
* [browserType.connect(endpoint[, options])](https://playwright.dev/docs/api/class-browsertype#browser-type-connect)
|
|
18672
19245
|
* to establish connection to the browser.
|
|
18673
19246
|
*
|
|
18674
19247
|
* Note that if the listen `host` option in `launchServer` options is not specified, localhost will be output anyway,
|
|
@@ -18881,7 +19454,12 @@ export interface ConsoleMessage {
|
|
|
18881
19454
|
*/
|
|
18882
19455
|
text(): string;
|
|
18883
19456
|
|
|
18884
|
-
|
|
19457
|
+
/**
|
|
19458
|
+
* The timestamp of the console message in milliseconds since the Unix epoch.
|
|
19459
|
+
*/
|
|
19460
|
+
timestamp(): number;
|
|
19461
|
+
|
|
19462
|
+
type(): "log"|"debug"|"info"|"error"|"warning"|"dir"|"dirxml"|"table"|"trace"|"clear"|"startGroup"|"startGroupCollapsed"|"endGroup"|"assert"|"profile"|"profileEnd"|"count"|"time"|"timeEnd";
|
|
18885
19463
|
|
|
18886
19464
|
/**
|
|
18887
19465
|
* The web worker or service worker that produced this console message, if any. Note that console messages from web
|
|
@@ -19028,6 +19606,95 @@ export interface Coverage {
|
|
|
19028
19606
|
}>>;
|
|
19029
19607
|
}
|
|
19030
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
|
+
|
|
19031
19698
|
/**
|
|
19032
19699
|
* [Dialog](https://playwright.dev/docs/api/class-dialog) objects are dispatched by page via the
|
|
19033
19700
|
* [page.on('dialog')](https://playwright.dev/docs/api/class-page#page-event-dialog) event.
|
|
@@ -19091,6 +19758,23 @@ export interface Dialog {
|
|
|
19091
19758
|
type(): string;
|
|
19092
19759
|
}
|
|
19093
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
|
+
|
|
19094
19778
|
/**
|
|
19095
19779
|
* [Download](https://playwright.dev/docs/api/class-download) objects are dispatched by page via the
|
|
19096
19780
|
* [page.on('download')](https://playwright.dev/docs/api/class-page#page-event-download) event.
|
|
@@ -19247,11 +19931,23 @@ export interface Electron {
|
|
|
19247
19931
|
*/
|
|
19248
19932
|
args?: Array<string>;
|
|
19249
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
|
+
|
|
19250
19941
|
/**
|
|
19251
19942
|
* Toggles bypassing page's Content-Security-Policy. Defaults to `false`.
|
|
19252
19943
|
*/
|
|
19253
19944
|
bypassCSP?: boolean;
|
|
19254
19945
|
|
|
19946
|
+
/**
|
|
19947
|
+
* Enable Chromium sandboxing. Defaults to `false`.
|
|
19948
|
+
*/
|
|
19949
|
+
chromiumSandbox?: boolean;
|
|
19950
|
+
|
|
19255
19951
|
/**
|
|
19256
19952
|
* Emulates [prefers-colors-scheme](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme)
|
|
19257
19953
|
* media feature, supported values are `'light'` and `'dark'`. See
|
|
@@ -19390,9 +20086,10 @@ export interface Electron {
|
|
|
19390
20086
|
*/
|
|
19391
20087
|
recordVideo?: {
|
|
19392
20088
|
/**
|
|
19393
|
-
* 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).
|
|
19394
20091
|
*/
|
|
19395
|
-
dir
|
|
20092
|
+
dir?: string;
|
|
19396
20093
|
|
|
19397
20094
|
/**
|
|
19398
20095
|
* Optional dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to
|
|
@@ -19410,6 +20107,26 @@ export interface Electron {
|
|
|
19410
20107
|
*/
|
|
19411
20108
|
height: number;
|
|
19412
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
|
+
};
|
|
19413
20130
|
};
|
|
19414
20131
|
|
|
19415
20132
|
/**
|
|
@@ -19670,7 +20387,7 @@ export interface FrameLocator {
|
|
|
19670
20387
|
* <button>Submit</button>
|
|
19671
20388
|
* ```
|
|
19672
20389
|
*
|
|
19673
|
-
* You can locate each element by
|
|
20390
|
+
* You can locate each element by its implicit role:
|
|
19674
20391
|
*
|
|
19675
20392
|
* ```js
|
|
19676
20393
|
* await expect(page.getByRole('heading', { name: 'Sign up' })).toBeVisible();
|
|
@@ -19776,7 +20493,7 @@ export interface FrameLocator {
|
|
|
19776
20493
|
* <button data-testid="directions">Itinéraire</button>
|
|
19777
20494
|
* ```
|
|
19778
20495
|
*
|
|
19779
|
-
* You can locate the element by
|
|
20496
|
+
* You can locate the element by its test id:
|
|
19780
20497
|
*
|
|
19781
20498
|
* ```js
|
|
19782
20499
|
* await page.getByTestId('directions').click();
|
|
@@ -20378,6 +21095,16 @@ export interface Request {
|
|
|
20378
21095
|
*/
|
|
20379
21096
|
allHeaders(): Promise<{ [key: string]: string; }>;
|
|
20380
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
|
+
|
|
20381
21108
|
/**
|
|
20382
21109
|
* The method returns `null` unless this request has failed, as reported by `requestfailed` event.
|
|
20383
21110
|
*
|
|
@@ -20732,6 +21459,11 @@ export interface Response {
|
|
|
20732
21459
|
*/
|
|
20733
21460
|
headerValues(name: string): Promise<Array<string>>;
|
|
20734
21461
|
|
|
21462
|
+
/**
|
|
21463
|
+
* Returns the http version used by the response.
|
|
21464
|
+
*/
|
|
21465
|
+
httpVersion(): Promise<string>;
|
|
21466
|
+
|
|
20735
21467
|
/**
|
|
20736
21468
|
* Returns the JSON representation of response body.
|
|
20737
21469
|
*
|
|
@@ -20876,8 +21608,12 @@ export interface Route {
|
|
|
20876
21608
|
* [route.fallback([options])](https://playwright.dev/docs/api/class-route#route-fallback) If you want next matching
|
|
20877
21609
|
* handler in the chain to be invoked.
|
|
20878
21610
|
*
|
|
20879
|
-
* **NOTE**
|
|
20880
|
-
* and
|
|
21611
|
+
* **NOTE** Some request headers are **forbidden** and cannot be overridden (for example, `Cookie`, `Host`,
|
|
21612
|
+
* `Content-Length` and others, see
|
|
21613
|
+
* [this MDN page](https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_request_header) for full list). If an
|
|
21614
|
+
* override is provided for a forbidden header, it will be ignored and the original request header will be used.
|
|
21615
|
+
*
|
|
21616
|
+
* To set custom cookies, use
|
|
20881
21617
|
* [browserContext.addCookies(cookies)](https://playwright.dev/docs/api/class-browsercontext#browser-context-add-cookies).
|
|
20882
21618
|
*
|
|
20883
21619
|
* @param options
|
|
@@ -21294,7 +22030,7 @@ export interface Tracing {
|
|
|
21294
22030
|
|
|
21295
22031
|
column?: number;
|
|
21296
22032
|
};
|
|
21297
|
-
}): Promise<
|
|
22033
|
+
}): Promise<Disposable>;
|
|
21298
22034
|
|
|
21299
22035
|
/**
|
|
21300
22036
|
* Closes the last group created by
|
|
@@ -21327,6 +22063,13 @@ export interface Tracing {
|
|
|
21327
22063
|
* @param options
|
|
21328
22064
|
*/
|
|
21329
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
|
+
|
|
21330
22073
|
/**
|
|
21331
22074
|
* If specified, intermediate trace files are going to be saved into the files with the given name prefix inside the
|
|
21332
22075
|
* [`tracesDir`](https://playwright.dev/docs/api/class-browsertype#browser-type-launch-option-traces-dir) directory
|
|
@@ -21748,6 +22491,13 @@ export interface LaunchOptions {
|
|
|
21748
22491
|
*/
|
|
21749
22492
|
args?: Array<string>;
|
|
21750
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
|
+
|
|
21751
22501
|
/**
|
|
21752
22502
|
* Browser distribution channel.
|
|
21753
22503
|
*
|
|
@@ -21763,14 +22513,6 @@ export interface LaunchOptions {
|
|
|
21763
22513
|
*/
|
|
21764
22514
|
chromiumSandbox?: boolean;
|
|
21765
22515
|
|
|
21766
|
-
/**
|
|
21767
|
-
* **Chromium-only** Whether to auto-open a Developer Tools panel for each tab. If this option is `true`, the
|
|
21768
|
-
* [`headless`](https://playwright.dev/docs/api/class-browsertype#browser-type-launch-option-headless) option will be
|
|
21769
|
-
* set `false`.
|
|
21770
|
-
* @deprecated Use [debugging tools](https://playwright.dev/docs/debug) instead.
|
|
21771
|
-
*/
|
|
21772
|
-
devtools?: boolean;
|
|
21773
|
-
|
|
21774
22516
|
/**
|
|
21775
22517
|
* If specified, accepted downloads are downloaded into this directory. Otherwise, temporary directory is created and
|
|
21776
22518
|
* is deleted when browser is closed. In either case, the downloads are deleted when the browser context they were
|
|
@@ -21815,9 +22557,7 @@ export interface LaunchOptions {
|
|
|
21815
22557
|
/**
|
|
21816
22558
|
* Whether to run browser in headless mode. More details for
|
|
21817
22559
|
* [Chromium](https://developers.google.com/web/updates/2017/04/headless-chrome) and
|
|
21818
|
-
* [Firefox](https://hacks.mozilla.org/2017/12/using-headless-mode-in-firefox/). Defaults to `true
|
|
21819
|
-
* [`devtools`](https://playwright.dev/docs/api/class-browsertype#browser-type-launch-option-devtools) option is
|
|
21820
|
-
* `true`.
|
|
22560
|
+
* [Firefox](https://hacks.mozilla.org/2017/12/using-headless-mode-in-firefox/). Defaults to `true`.
|
|
21821
22561
|
*/
|
|
21822
22562
|
headless?: boolean;
|
|
21823
22563
|
|
|
@@ -21889,6 +22629,12 @@ export interface ConnectOverCDPOptions {
|
|
|
21889
22629
|
*/
|
|
21890
22630
|
headers?: { [key: string]: string; };
|
|
21891
22631
|
|
|
22632
|
+
/**
|
|
22633
|
+
* Tells Playwright that it runs on the same host as the CDP server. It will enable certain optimizations that rely
|
|
22634
|
+
* upon the file system being the same between Playwright and the Browser.
|
|
22635
|
+
*/
|
|
22636
|
+
isLocal?: boolean;
|
|
22637
|
+
|
|
21892
22638
|
/**
|
|
21893
22639
|
* Logger sink for Playwright logging. Optional.
|
|
21894
22640
|
* @deprecated The logs received by the logger are incomplete. Please use tracing instead.
|
|
@@ -22313,9 +23059,10 @@ export interface BrowserContextOptions {
|
|
|
22313
23059
|
*/
|
|
22314
23060
|
recordVideo?: {
|
|
22315
23061
|
/**
|
|
22316
|
-
* 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).
|
|
22317
23064
|
*/
|
|
22318
|
-
dir
|
|
23065
|
+
dir?: string;
|
|
22319
23066
|
|
|
22320
23067
|
/**
|
|
22321
23068
|
* Optional dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to
|
|
@@ -22333,6 +23080,26 @@ export interface BrowserContextOptions {
|
|
|
22333
23080
|
*/
|
|
22334
23081
|
height: number;
|
|
22335
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
|
+
};
|
|
22336
23103
|
};
|
|
22337
23104
|
|
|
22338
23105
|
/**
|