Created
March 25, 2018 17:21
-
-
Save DCCoder90/0c4da173bad0e00eba9606616e209d3f to your computer and use it in GitHub Desktop.
Scroll to the bottom of an infinite scroll page with NightmareJS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var previousHeight, currentHeight=0; | |
while(previousHeight !== currentHeight) { | |
previousHeight = currentHeight; | |
var currentHeight = yield nightmare.evaluate(function() { | |
return document.body.scrollHeight; | |
}); | |
yield nightmare.scrollTo(currentHeight, 0) | |
.wait(3000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment