Using Selenium to Determining The Visibility of Elements for Print media
Posted
by
Tom Howard
on Stack Overflow
See other posts from Stack Overflow
or by Tom Howard
Published on 2014-06-02T02:40:56Z
Indexed on
2014/06/10
15:24 UTC
Read the original article
Hit count: 211
css
|selenium-webdriver
I would like to determine if particular elements on a page are visible when printed as controlled by CSS @media
rules.
Is there a way to do this with Selenium?
I know there is the isDisplayed method, which takes the CSS into account, but there is nothing I can find to tell Selenium which media type to apply.
Is there a way to do this?
Or is there another way to test web pages to make sure the elements you want are printed (and those you don't aren't)?
Update:
For clarity, there are no plans to have a javascript print button. The users will print using the normal print functionality of the browser (Chrome, FF and IE). @media
css rules will be used to control what is shown and hidden. I would like Selenium to pretend it is a printer instead of a screen, so I can test if certain elements will be visible in what would be the printed version of the page.
© Stack Overflow or respective owner