page.emulateMediaFeatures([{ name: 'hover', value: 'hover' }]) throws error
See original GitHub issueSteps 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)').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.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:7
- Comments:6
Top Results From Across the Web
page.emulateMediaFeatures([{ name: 'hover', value ... - GitHub
emulateMediaFeatures([{ name: 'hover', value: 'hover' }]) throws error #5096 ... The exception Unsupported media feature: hover is thrown.
Read more >page.hover() having no effect - Stack Overflow
I used a Docker container (because I'm not comfortable with essentially disabling the security sandbox by using the liberal permissions ...
Read more >Puppeteer documentation - DevDocs
Puppeteer methods might throw errors if they are unable to fulfill a request. ... and then uses page.mouse to hover over the center...
Read more >Page class - Puppeteer
mouse to hover over the center of the element. If there's no element matching selector , the method throws an error. isClosed(), Indicates...
Read more >Build a Link Previewer with Puppeteer & Serverless Functions
emulateMediaFeatures ([ {name: 'prefers-color-scheme', value:'dark'} ]) // navigate to target URL and get page details and screenshot try{ ... } ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Me too 👍 Support for
pointer
would be nice too e.g.@media (hover: hover) and (pointer: fine)
If some of the values are actually supported by CDP, we can open them up in Puppeteer.