page.emulateMediaFeatures([{ name: 'hover', value: 'hover' }]) throws error
Author: lehniCreated Oct 29, 2019Updated Sep 26, 2026
Labelsupstreamgood first issueconfirmedP3feature
Steps to reproduce
Tell us about your environment:
- Puppeteer version: 2.0.0, Headless
- Platform / OS version: Ubuntu 18.04.3 LTS
- URLs (if applicable):
- Node.js version: v10.16.3
What steps will reproduce the problem?
Please include code that reproduces the issue.
- Create a new page:
const page = await browser.newPage() - Emulate the hover media query:
await page.emulateMediaFeatures([{ name: 'hover', value: 'hover' }])
What is the expected result?
The feature should be emulated.
What happens instead?
The exception Unsupported media feature: hover is thrown
Context
When running Puppeteer headlessly on Linux, the result of the following media query is false:
window.matchMedia('(hover: hover)').matchesMeanwhile on a Mac, the same query returns true.
I would like to test media queries in our e2e tests, and not being able to control this behavior prevents this from being possible.
Source: puppeteer/puppeteer