update snippet
This commit is contained in:
parent
3bf52d0ce7
commit
7abca5f15c
10
README.md
10
README.md
|
|
@ -42,16 +42,14 @@ This code snippet navigates to whatsmyuseragent.org in Chromium, Firefox and Web
|
||||||
const pw = require('playwright');
|
const pw = require('playwright');
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
const browsers = ['chromium', 'firefox', 'webkit'];
|
for (const name of ['chromium', 'firefox', 'webkit']) {
|
||||||
|
const browser = await pw[name].launch();
|
||||||
browsers.forEach(async browserName => {
|
|
||||||
const browser = await pw[browserName].launch();
|
|
||||||
const context = await browser.newContext();
|
const context = await browser.newContext();
|
||||||
const page = await context.newPage('http://whatsmyuseragent.org/');
|
const page = await context.newPage('http://whatsmyuseragent.org/');
|
||||||
|
|
||||||
await page.screenshot({ path: `example-${browserName}.png` });
|
await page.screenshot({ path: `example-${name}.png` });
|
||||||
await browser.close();
|
await browser.close();
|
||||||
});
|
}
|
||||||
})();
|
})();
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue