Skip to content

Commit 55effdc

Browse files
committed
feat(electron): move experimental Electron API to a separate package
Extract the experimental Electron automation API out of playwright-core into a new @playwright/experimental-electron package. The new package is a pure client built on top of chromium.connectToWorker (Node side) and chromium.connectOverCDP (Chromium side), so playwright-core no longer ships any Electron-specific client/server/dispatcher/protocol code. A few legacy launch options (recordHar, recordVideo, tracesDir, bypassCSP, artifactsDir) cannot be wired through the public surface today; they are documented in packages/playwright-electron/features.md together with the supported workarounds (page.screencast.start, context.tracing.startHar, etc.).
1 parent 5053880 commit 55effdc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1337
-2519
lines changed
Lines changed: 5 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@
22
* since: v1.9
33
* langs: js
44

5-
Playwright has **experimental** support for Electron automation. You can access electron namespace via:
5+
Playwright has **experimental** support for Electron automation, shipped as a
6+
separate package:
67

7-
```js
8-
const { _electron } = require('playwright');
8+
```sh
9+
npm i -D @playwright/experimental-electron
910
```
1011

1112
An example of the Electron automation script would be:
1213

1314
```js
14-
const { _electron: electron } = require('playwright');
15+
import { electron } from '@playwright/experimental-electron';
1516

1617
(async () => {
1718
// Launch Electron app.
@@ -89,59 +90,5 @@ Specifies environment variables that will be visible to Electron. Defaults to `p
8990

9091
Maximum time in milliseconds to wait for the application to start. Defaults to `30000` (30 seconds). Pass `0` to disable timeout.
9192

92-
### option: Electron.launch.acceptdownloads = %%-context-option-acceptdownloads-%%
93-
* since: v1.12
94-
95-
### option: Electron.launch.bypassCSP = %%-context-option-bypasscsp-%%
96-
* since: v1.12
97-
98-
### option: Electron.launch.colorScheme = %%-context-option-colorscheme-%%
99-
* since: v1.12
100-
101-
### option: Electron.launch.extraHTTPHeaders = %%-context-option-extrahttpheaders-%%
102-
* since: v1.12
103-
104-
### option: Electron.launch.geolocation = %%-context-option-geolocation-%%
105-
* since: v1.12
106-
107-
### option: Electron.launch.httpcredentials = %%-context-option-httpcredentials-%%
108-
* since: v1.12
109-
110-
### option: Electron.launch.ignoreHTTPSErrors = %%-context-option-ignorehttpserrors-%%
111-
* since: v1.12
112-
113-
### option: Electron.launch.locale = %%-context-option-locale-%%
114-
* since: v1.12
115-
116-
### option: Electron.launch.offline = %%-context-option-offline-%%
117-
* since: v1.12
118-
119-
### option: Electron.launch.recordhar = %%-context-option-recordhar-%%
120-
* since: v1.12
121-
122-
### option: Electron.launch.recordharpath = %%-context-option-recordhar-path-%%
123-
* since: v1.12
124-
125-
### option: Electron.launch.recordHarOmitContent = %%-context-option-recordhar-omit-content-%%
126-
* since: v1.12
127-
128-
### option: Electron.launch.recordvideo = %%-context-option-recordvideo-%%
129-
* since: v1.12
130-
131-
### option: Electron.launch.recordvideodir = %%-context-option-recordvideo-dir-%%
132-
* since: v1.12
133-
134-
### option: Electron.launch.recordvideosize = %%-context-option-recordvideo-size-%%
135-
* since: v1.12
136-
137-
### option: Electron.launch.timezoneId = %%-context-option-timezoneid-%%
138-
* since: v1.12
139-
140-
### option: Electron.launch.tracesDir = %%-browser-option-tracesdir-%%
141-
* since: v1.36
142-
143-
### option: Electron.launch.artifactsDir = %%-browser-option-artifactsdir-%%
144-
* since: v1.59
145-
14693
### option: Electron.launch.chromiumSandbox = %%-browser-option-chromiumsandbox-%%
14794
* since: v1.59
File renamed without changes.

package-lock.json

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/isomorphic/protocolMetainfo.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ export const methodMetainfo = new Map<string, MethodMetainfo>([
7171
['Worker.waitForEventInfo', { title: 'Wait for event "{info.event}"', snapshot: true, }],
7272
['WebSocket.waitForEventInfo', { title: 'Wait for event "{info.event}"', snapshot: true, }],
7373
['Debugger.waitForEventInfo', { title: 'Wait for event "{info.event}"', snapshot: true, }],
74-
['ElectronApplication.waitForEventInfo', { title: 'Wait for event "{info.event}"', snapshot: true, }],
7574
['AndroidDevice.waitForEventInfo', { title: 'Wait for event "{info.event}"', snapshot: true, }],
7675
['BrowserContext.addCookies', { title: 'Add cookies', group: 'configuration', }],
7776
['BrowserContext.addInitScript', { title: 'Add init script', group: 'configuration', }],
@@ -304,11 +303,6 @@ export const methodMetainfo = new Map<string, MethodMetainfo>([
304303
['WritableStream.close', { internal: true, }],
305304
['CDPSession.send', { title: 'Send CDP command', group: 'configuration', }],
306305
['CDPSession.detach', { title: 'Detach CDP session', group: 'configuration', }],
307-
['Electron.launch', { title: 'Launch electron', }],
308-
['ElectronApplication.browserWindow', { internal: true, }],
309-
['ElectronApplication.evaluateExpression', { title: 'Evaluate', }],
310-
['ElectronApplication.evaluateExpressionHandle', { title: 'Evaluate', }],
311-
['ElectronApplication.updateSubscription', { internal: true, }],
312306
['Android.devices', { internal: true, }],
313307
['AndroidSocket.write', { internal: true, }],
314308
['AndroidSocket.close', { internal: true, }],

0 commit comments

Comments
 (0)