apparition icon indicating copy to clipboard operation
apparition copied to clipboard

use scrollWidth and scrollHeight for full page screenshot saves.

Open jubishop opened this issue 3 years ago • 3 comments

I noticed that the bottom of my screenshots were getting cut off...it wasn't expanding quite far enough. When I switched to cuprite, however, it would work and capture the entire viewport properly. I studied the difference and cuprite is using scrollWidth and scrollHeight at https://github.com/rubycdp/ferrum/blob/3253bf1d028945b434ffb8e3d42636342ebf15bc/lib/ferrum/page/screenshot.rb#L66

jubishop avatar Dec 05 '21 17:12 jubishop

based on my understanding from articles like https://medium.com/@jbbpatel94/difference-between-offsetheight-clientheight-and-scrollheight-cfea5c196937 this makes sense that it should be scrollHeight..

jubishop avatar Dec 05 '21 17:12 jubishop

I also noticed adding options[:captureBeyondViewport] = true was necessary to always get the full screenshot. gotten from https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-captureScreenshot

jubishop avatar Dec 15 '21 06:12 jubishop

Been running this a 3-4 months in a big codebase, and it works a charm. Anything else needed for this to be merged?

olleolleolle avatar Oct 31 '22 14:10 olleolleolle