Launches electron application specified with the executablePath.
Optional options: { Optional acceptWhether to automatically download all the attachments. Defaults to true where all the downloads are accepted.
Optional args?: string[]Additional arguments to pass to the application when launching. You typically pass the main script name here.
Optional bypassCSP?: booleanToggles bypassing page's Content-Security-Policy.
Optional colorEmulates 'prefers-colors-scheme' media feature, supported values are 'light', 'dark', 'no-preference'. See
page.emulateMedia([options]) for more details.
Passing null resets emulation to system defaults. Defaults to 'light'.
Optional cwd?: stringCurrent working directory to launch application from.
Optional env?: { Specifies environment variables that will be visible to Electron. Defaults to process.env.
Optional executableLaunches given Electron application. If not specified, launches the default Electron executable installed in this
package, located at node_modules/.bin/electron.
Optional extraHTTPHeaders?: { An object containing additional HTTP headers to be sent with every request.
Optional geolocation?: { Optional accuracy?: numberNon-negative accuracy value. Defaults to 0.
Latitude between -90 and 90.
Longitude between -180 and 180.
Optional httpCredentials for HTTP authentication.
Optional ignoreHTTPSErrors?: booleanWhether to ignore HTTPS errors when sending network requests. Defaults to false.
Optional locale?: stringSpecify user locale, for example en-GB, de-DE, etc. Locale will affect navigator.language value,
Accept-Language request header value as well as number and date formatting rules.
Optional offline?: booleanWhether to emulate network being offline. Defaults to false.
Optional recordEnables HAR recording for all pages into recordHar.path file.
If not specified, the HAR is not recorded. Make sure to await
browserContext.close() for the HAR to
be saved.
Optional content?: "omit" | "embed" | "attach"Optional setting to control resource content management. If omit is specified, content is not persisted. If
attach is specified, resources are persisted as separate files or entries in the ZIP archive. If embed is
specified, content is stored inline the HAR file as per HAR specification. Defaults to attach for .zip output
files and to embed for all other file extensions.
Optional mode?: "full" | "minimal"When set to minimal, only record information necessary for routing from HAR. This omits sizes, timing, page,
cookies, security and other types of HAR information that are not used when replaying from HAR. Defaults to full.
Optional omitOptional setting to control whether to omit request content from the HAR. Defaults to false. Deprecated, use
content policy instead.
Path on the filesystem to write the HAR file to. If the file name ends with .zip, content: 'attach' is used by
default.
Optional urlA glob or regex pattern to filter requests that are stored in the HAR. When a baseURL via the context options was
provided and the passed URL is a path, it gets merged via the
new URL() constructor.
Optional recordEnables video recording for all pages into recordVideo.dir directory. If not specified videos are not recorded.
Make sure to await
browserContext.close() for videos to
be saved.
Path to the directory to put videos into.
Optional size?: { Optional dimensions of the recorded videos. If not specified the size will be equal to viewport scaled down to
fit into 800x800. If viewport is not configured explicitly the video size defaults to 800x450. Actual picture of
each page will be scaled down if necessary to fit the specified size.
Video frame height.
Video frame width.
Optional timeout?: numberMaximum time in milliseconds to wait for the application to start. Defaults to 30000 (30 seconds). Pass 0 to
disable timeout.
Optional timezoneChanges the timezone of the context. See ICU's metaZones.txt for a list of supported timezone IDs.
Generated using TypeDoc
Playwright has experimental support for Electron automation. You can access electron namespace via:
An example of the Electron automation script would be:
Note that since you don't need Playwright to install web browsers when testing Electron, you can omit browser download via setting the following environment variable when installing Playwright:
Supported Electron versions are: