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)
})
})
}
page.evaluate(_ => {
window.scrollBy(0, window.innerHeight);
});window.scrollBy(0, document.body.scrollHeight);
Also in JavaScript:
- javascript sum array of objects
- reactjs add border to the table row
- is react context better than redux
- how to get the computer date and time jquery
- output event angular
- To do validation for the textbox , radio button and dropdown using jquery
- js queryselector names
- flutter CircularProgressIndicator
- js trigger click
- scalar
- javascript print
- pass header in ajax
- jquery to set value in select2 dropdown button
- try catch with for loop in javascript
- angularjs dropdown
- heroku failed to run files from static folder in node
- settimeout jquery
- fill checkbox javascript
- nodejs shebang
- javascript split array into chunks
- Trouble setting up sample table. “Could not find matching row model for rowModelType clientSide”
- firstElementChild jquery equivalent
- hello
- react open on different url instead of localhost