Created
May 12, 2020 15:16
-
-
Save qant/9f3ae6724f2fcb00a30c9bf329401099 to your computer and use it in GitHub Desktop.
Check url on iphone 11 pro with playwright (like puppeteer) in 3 browser
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//npm | |
const playwright = require("playwright"); | |
const vp = { width: 375, height: 812 }; | |
(async () => { | |
for (const browserType of ["webkit", "chromium", "firefox"]) { | |
const browser = await playwright[browserType].launch(); | |
const context = await browser.newContext({ | |
devices: ["iPhone 11 Pro"], | |
viewport: vp, | |
}); | |
const page = await context.newPage(); | |
await page.goto("https://lusarealty.com/"); | |
await page.screenshot({ | |
path: `iphonepro-${browserType}.jpg`, | |
type: "jpeg", | |
fullPage: true, | |
quality: 90, | |
}); | |
page.once("load", () => console.log(`Page in ${browserType} loaded!`)); | |
await browser.close(); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment