#5096·puppeteer

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.

  1. Create a new page:
    javascript
    const page = await browser.newPage()
  2. Emulate the hover media query:
    javascript
    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:

javascript
window.matchMedia('(hover: hover)').matches

Meanwhile 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.