From 1656c7071e7a591495ad4dfc5523263a231ccf14 Mon Sep 17 00:00:00 2001 From: Kilian von Pflugk Date: Tue, 19 Oct 2021 01:08:18 +0200 Subject: [PATCH] docs: Page screenshot Example with all TypeScript types (#9549) --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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(); } })();