2022-07-05 13:41:43 +00:00
---
sidebar_label: Page.emulateMediaType
---
# Page.emulateMediaType() method
2022-10-24 07:07:05 +00:00
#### Signature:
2022-07-05 13:41:43 +00:00
```typescript
class Page {
2023-11-09 12:57:33 +00:00
abstract emulateMediaType(type?: string): Promise< void > ;
2022-07-05 13:41:43 +00:00
}
```
## Parameters
2024-03-20 15:03:14 +00:00
< table > < thead > < tr > < th >
2022-07-05 13:41:43 +00:00
2024-03-20 15:03:14 +00:00
Parameter
< / th > < th >
Type
< / th > < th >
Description
< / th > < / tr > < / thead >
< tbody > < tr > < td >
type
< / td > < td >
string
< / td > < td >
_(Optional)_ Changes the CSS media type of the page. The only allowed values are `screen` , `print` and `null` . Passing `null` disables CSS media emulation.
< / td > < / tr >
< / tbody > < / table >
2022-07-05 13:41:43 +00:00
**Returns:**
Promise< void>
## Example
```ts
await page.evaluate(() => matchMedia('screen').matches);
// → true
await page.evaluate(() => matchMedia('print').matches);
// → false
await page.emulateMediaType('print');
await page.evaluate(() => matchMedia('screen').matches);
// → false
await page.evaluate(() => matchMedia('print').matches);
// → true
await page.emulateMediaType(null);
await page.evaluate(() => matchMedia('screen').matches);
// → true
await page.evaluate(() => matchMedia('print').matches);
// → false
```