Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

docs(library) fix js example (#17933)

John Hawkinsona62a67fba367
diff --git a/docs/src/library-js.md b/docs/src/library-js.md
index 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-ts
import 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
// Teardown
await 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 () => {
// Setup
const 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 bit
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
// Teardown
await context.close();