import { Page } from "https://deno.land/x/puppeteer@14.1.1/vendor/puppeteer-core/puppeteer/common/Page.js";
Emulates given device metrics and user agent. This method is a shortcut for
calling two methods: Page.setUserAgent and Page.setViewport
To aid emulation, Puppeteer provides a list of device descriptors that can
be obtained via the Puppeteer.devices page.emulate
will resize
the page. A lot of websites don't expect phones to change size, so you
should emulate before navigating to the page.
Examples
Example 1
Example 1
const puppeteer = require('puppeteer');
const iPhone = puppeteer.devices['iPhone 6'];
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.emulate(iPhone);
await page.goto('https://www.google.com');
// other actions...
await browser.close();
})();
Parameters
options: { viewport: Viewport; userAgent: string; }