One of the options I found is to split all the โprintโ css into a separate file and load it using the link tag using media="print" .
<link rel="stylesheet" type="text/css" href="print.css" media="print">
The value is not to use media query inside a large css file at all.
That way I can change the media="print" attribute during the test to all through executeScript .
Hope this helps someone.
source share