simulate schrool event puppeter

JavaScript
const autoScroll = async (page) => {
  await page.evaluate(async () => {
    await new Promise((resolve, reject) => {
      let totalHeight = 0
      let distance = 100
      let timer = setInterval(() => {
        let scrollHeight = document.body.scrollHeight
        window.scrollBy(0, distance)
        totalHeight += distance
        if(totalHeight >= scrollHeight){
          clearInterval(timer)
          resolve()
        }
      }, 100)
    })
  })
}
page.evaluate(_ => {
  window.scrollBy(0, window.innerHeight);
});window.scrollBy(0, document.body.scrollHeight);

Source

Also in JavaScript: