Answers for "simulate schrool event puppeter"

0

simulate schrool event puppeter

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)
    })
  })
}
Posted by: Guest on December-27-2020
0

simulate schrool event puppeter

page.evaluate(_ => {
  window.scrollBy(0, window.innerHeight);
});
Posted by: Guest on December-27-2020
0

simulate schrool event puppeter

window.scrollBy(0, document.body.scrollHeight);
Posted by: Guest on December-27-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language