Skip to content

Instantly share code, notes, and snippets.

@DCCoder90
Created March 25, 2018 17:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DCCoder90/0c4da173bad0e00eba9606616e209d3f to your computer and use it in GitHub Desktop.
Save DCCoder90/0c4da173bad0e00eba9606616e209d3f to your computer and use it in GitHub Desktop.
Scroll to the bottom of an infinite scroll page with NightmareJS
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