Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
docs: fix the Electron example
Pavel Feldmanee1bcd760b19
diff --git a/docs/src/api/class-electron.md b/docs/src/api/class-electron.mdindex 6a5489c422..d1c8283217 100644--- a/docs/src/api/class-electron.md+++ b/docs/src/api/class-electron.md@@ -17,12 +17,12 @@ const { _electron: electron } = require('playwright');const electronApp = await electron.launch({ args: ['main.js'] });// Evaluation expression in the Electron context.- const appPath = await electronApp.evaluate(async (electron) => {- // This runs in the main Electron process, |electron| parameter- // here is always the result of the require('electron') in the main- // app script.- return electron.getAppPath();+ const appPath = await electronApp.evaluate(async ({ app }) => {+ // This runs in the main Electron process, parameter here is always+ // the result of the require('electron') in the main app script.+ return app.getAppPath();});+ console.log(appPath);// Get the first window that the app opens, wait if necessary.const window = await electronApp.firstWindow();@@ -34,6 +34,8 @@ const { _electron: electron } = require('playwright');window.on('console', console.log);// Click button.await window.click('text=Click me');+ // Exit app.+ await electronApp.close();})();```diff --git a/docs/src/api/class-electronapplication.md b/docs/src/api/class-electronapplication.mdindex 0b0fd3914c..bc5b3136ef 100644--- a/docs/src/api/class-electronapplication.md+++ b/docs/src/api/class-electronapplication.md@@ -13,12 +13,12 @@ const { _electron: electron } = require('playwright');const electronApp = await electron.launch({ args: ['main.js'] });// Evaluation expression in the Electron context.- const appPath = await electronApp.evaluate(async (electron) => {- // This runs in the main Electron process, |electron| parameter- // here is always the result of the require('electron') in the main- // app script.- return electron.getAppPath();+ const appPath = await electronApp.evaluate(async ({ app }) => {+ // This runs in the main Electron process, parameter here is always+ // the result of the require('electron') in the main app script.+ return app.getAppPath();});+ console.log(appPath);// Get the first window that the app opens, wait if necessary.const window = await electronApp.firstWindow();@@ -30,6 +30,8 @@ const { _electron: electron } = require('playwright');window.on('console', console.log);// Click button.await window.click('text=Click me');+ // Exit app.+ await electronApp.close();})();```