Hi have tried all of these:
document.body.scrollHeight
document.body.offsetHeight
document.documentElement.clientHeight
document.documentElement.scrollHeight
document.documentElement.offsetHeight
These work in a normal browser but in Phantomjs I get the CMD (command-line window) height.. I want to get the height so that I can crop a screenshot later in the code.. and the height of the page must be as it is being viewed on a normal browser
I'm getting 300 pixels and I want to get the full html page height (that varies dependent on the URL)..
Those values provide the expected values as with other browsers. Full example:
Output:
Reasons why it might not be the case for your:
page.evaluate()
. There exists adocument
object outside ofpage.evaluate()
, but it is only a dummy.<body>
may not be scrollable, but only some child element that has all the (scrollable) content. In which case every value is equal to the viewport height.