Skip to content

Instantly share code, notes, and snippets.

@ironmaniiith
Created March 1, 2016 18:50
Show Gist options
  • Save ironmaniiith/fa3b40a09e6f93954883 to your computer and use it in GitHub Desktop.
Save ironmaniiith/fa3b40a09e6f93954883 to your computer and use it in GitHub Desktop.
nightmare
var Nightmare = require('nightmare');
var nightmare = Nightmare({ show: false })
nightmare
// .useragent('Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:41.0) Gecko/20100101 Firefox/41.0')
.goto('https://www.practo.com/bangalore/doctor/dr-shankar-kumar-diabetologist-1/')
.wait(5000)
.click("#reviewsNavLink")
.wait(5000)
.evaluate(function(){
var a = document.getElementById('reviewsTab');
var i = setInterval(function(){
var x = a.getElementsByClassName('btn btn-white next-page recommended-next-page');
if(x == undefined || x.length == 0){
clearInterval(i);
}
else{
x[0].click();
}
}, 5000);
})
.wait(5000000)
.then(function (result) {
console.log(result)
})
nightmare.end()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment