How to test @media print with protractor or selenium?

后端 未结 1 534
有刺的猬
有刺的猬 2021-01-23 02:13

I\'ve implemented an print functionallity at my site, and I would like to test it via protractor / selenium.

There is any method to \"apply\" the styles that are under <

相关标签:
1条回答
  • 2021-01-23 02:29

    One option that I've found is to split all the "print" css into a separate file, and load it via link tag with media="print".

    <link rel="stylesheet" type="text/css" href="print.css" media="print">
    

    Meaning not to use media query inside large css file at all.

    That way will allow me to change the media="print" attribute during test to all via executeScript.

    Hope it will help someone.

    0 讨论(0)
提交回复
热议问题