wswebcreation / webdriver-image-comparison

MIT License
43 stars 36 forks source link

Full Page scrolling doesn't work out of the box for all websites #107

Closed wswebcreation closed 2 years ago

wswebcreation commented 2 years ago

The project now used this method to automatically scroll.

This is now being done mostly on the HTML element, but there are sites that only scroll on the body element. We need to make the above mentioned method smarter. Here are two websites to use for testing

There is a way to test this

// this was for https://www.insightinvestment.com/cookie-policy/
const htmlNode = document.querySelector('html')
htmlNode.scrollHeight
// 936
htmlNode.clientHeight
// 936
const bodyNode = document.querySelector('body')
bodyNode.scrollHeight
// 7557
bodyNode.clientHeight
// 936

I could determine for the html or body which element needs to be used for scrolling just a simple compare bigger scrollHeight vs clientHeight

wswebcreation commented 2 years ago

Closing this one, will be fixed by https://github.com/wswebcreation/webdriver-image-comparison/pull/110