Puppeteer: Unsupported media type:
emulateMediaType receives an unsupported media type.
emulateMediaType receives an unsupported media type.
Error message
Unsupported media type:
How this error happens
Media emulation selects screen, print, or no override. A responsive breakpoint such as mobile is not a media type.
The snippets use an open Puppeteer page named page.
await page.emulateMediaType(
"mobile"
);
How to fix
Choose a supported media type. Change the viewport separately if you want to test a small screen.
await page.emulateMediaType(
"screen"
);
await page.setViewport({
width: 390,
height: 844,
});
Things to keep in mind
Pass null to stop emulating a media type.