in a fullpage screenshot, I want to show all of the content, how can I get scrollable elements' content height together efficient?

29 views Asked by At

fullpage screenshot, I need to know content height when I don't know how many elements have scrollbar.

traverse the node tree to find scrollable elements(maybe div or others) with code below, by sum all scrollHeight I can set the selenium webdriver's window size then do screenshot.

if (node.scrollHeight > node.clientHeight) {
  return node;
}

Is there any example or more efficient way to do the fullpage screenshot in selenium?

I've tried html2canvas, with some problems like bg and font difference so gave it up.

1

There are 1 answers

0
PQ Co On

This can be answered by:

How to get screenshot of full webpage using Selenium and Java?

Look for the comment related to AShot if you want a full page screenshot.