Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Launch headless Chrome with an input type that supports hover

I am using puppeteer to make e2e tests. It seems that headless chrome doesn't support the @media (hover: hover) media query (see this issue on puppeteer github).

It seems likely that Chrome assumes the default input method for headless doesn't support hovering.

Does anyone know of a Chrome launch flag or some Javascript to get around this, please?

like image 987
tarling Avatar asked Dec 06 '25 19:12

tarling


1 Answers

It seems that for now the only way to get the @media (hover: hover) media query in puppeteer is to run it with headless : false.

However you can emulate headless mode with Xvfb. There are a couple on examples of how to do that in the Puppeteer-with-xvfb repository.

like image 122
Vaviloff Avatar answered Dec 08 '25 17:12

Vaviloff



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!