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(library) fix js example (#17933)
John Hawkinsona62a67fba367
diff --git a/docs/src/library-js.md b/docs/src/library-js.mdindex 3cebaadcb2..1b0ab65842 100644--- a/docs/src/library-js.md+++ b/docs/src/library-js.md@@ -24,6 +24,7 @@ The following is an example of using the Playwright Library directly to launch C```js tab=js-tsimport playwright, { devices } from 'playwright';+import assert from 'node:assert';(async () => {// Setup@@ -35,7 +36,7 @@ import playwright, { devices } from 'playwright';await context.route('**.jpg', route => route.abort());await page.goto('https://example.com/');- assert(await page.title() === 'Example'); // π not a Web First assertion+ assert(await page.title() === 'Example Domain'); // π not a Web First assertion// Teardownawait context.close();@@ -44,19 +45,20 @@ import playwright, { devices } from 'playwright';``````js tab=js-js+const assert = require('node:assert');const playwright = require('playwright');(async () => {// Setupconst browser = await playwright.chromium.launch();- const context = await browser.newContext(devices['iPhone 11']);+ const context = await browser.newContext(playwright.devices['iPhone 11']);const page = await context.newPage();// The actual interesting bitawait context.route('**.jpg', route => route.abort());await page.goto('https://example.com/');- assert(await page.title() === 'Example'); // π not a Web First assertion+ assert(await page.title() === 'Example Domain'); // π not a Web First assertion// Teardownawait context.close();