Skip to content

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

docs: Page screenshot Example with all TypeScript types (#9549)

Kilian von Pflugk1656c7071e7a
diff --git a/README.md b/README.md
index 700b2c2837..ea6b577abf 100644
--- a/README.md
+++ b/README.md
@@ -48,12 +48,12 @@ This code snippet navigates to whatsmyuseragent.org in Chromium, Firefox and Web
const playwright = require('playwright');
(async () => {
- for (const browserType of ['chromium', 'firefox', 'webkit']) {
- const browser = await playwright[browserType].launch();
+ for (const browserType of [playwright.chromium, playwright.firefox, playwright.webkit]) {
+ const browser = await browserType.launch();
const context = await browser.newContext();
const page = await context.newPage();
await page.goto('http://whatsmyuseragent.org/');
- await page.screenshot({ path: `example-${browserType}.png` });
+ await page.screenshot({ path: `example-${browserType.name()}.png` });
await browser.close();
}
})();