mirror of
https://github.com/microsoft/playwright.git
synced 2025-01-05 19:04:43 +03:00
docs: Page screenshot Example with all TypeScript types (#9549)
This commit is contained in:
parent
42b535246f
commit
1656c7071e
@ -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();
|
||||
}
|
||||
})();
|
||||
|
Loading…
Reference in New Issue
Block a user