Get viewport size

1,241 views
Skip to first unread message

Ben White

unread,
Jun 25, 2013, 1:59:04 PM6/25/13
to seleniu...@googlegroups.com
 I'm attempting to work around the limitations of the chromedriver's screenshots that allow it to only take screenies of what is currently in the viewport (instead of the entire page), and was planning on doing this by having the driver take a screenshot and then scroll down by the height of the viewport and take another screenshot. So my question is twofold:
  1. Is there a better way to overcome this limitation
  2. If not, how do I grab the height of the viewport?

Mark Collin

unread,
Jun 26, 2013, 4:08:57 AM6/26/13
to seleniu...@googlegroups.com
To get the viewport size:

((JavascriptExecutor) driver).executeScript("return document.documentElement.clientWidth")
((JavascriptExecutor) driver).executeScript("return document.documentElement.clientHeight")
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/e0674ceb-7472-43b0-bba1-46e36e6fdbfd%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages