Skip to content

Instantly share code, notes, and snippets.

@qant
Created May 12, 2020 15:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qant/9f3ae6724f2fcb00a30c9bf329401099 to your computer and use it in GitHub Desktop.
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
//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