2022-07-05 13:41:43 +00:00
---
sidebar_label: Page.emulate
---
# Page.emulate() method
2022-10-10 13:30:12 +00:00
Emulates a given device's metrics and user agent.
To aid emulation, Puppeteer provides a list of known devices that can be via [KnownDevices ](./puppeteer.knowndevices.md ).
2022-07-05 13:41:43 +00:00
2022-10-24 07:07:05 +00:00
#### Signature:
2022-07-05 13:41:43 +00:00
```typescript
class Page {
2022-10-10 13:30:12 +00:00
emulate(device: Device): Promise< void > ;
2022-07-05 13:41:43 +00:00
}
```
## Parameters
2022-10-10 13:30:12 +00:00
| Parameter | Type | Description |
| --------- | ------------------------------- | ----------- |
| device | [Device ](./puppeteer.device.md ) | |
2022-07-05 13:41:43 +00:00
**Returns:**
Promise< void>
## Remarks
2023-11-28 12:07:53 +00:00
This method is a shortcut for calling two methods: [Page.setUserAgent() ](./puppeteer.page.setuseragent.md ) and [Page.setViewport() ](./puppeteer.page.setviewport.md ).
2022-10-10 13:30:12 +00:00
This method will resize the page. A lot of websites don't expect phones to change size, so you should emulate before navigating to the page.
2022-07-05 13:41:43 +00:00
## Example
```ts
2022-10-10 13:30:12 +00:00
import {KnownDevices} from 'puppeteer';
const iPhone = KnownDevices['iPhone 6'];
2022-07-05 13:41:43 +00:00
(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();
})();
```