Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get to know when the ajax calls are made and done #2

Open
singamcet opened this issue Aug 1, 2017 · 0 comments
Open

get to know when the ajax calls are made and done #2

singamcet opened this issue Aug 1, 2017 · 0 comments
Labels

Comments

@singamcet
Copy link

singamcet commented Aug 1, 2017

how to know when ajax calls are made and done .....then how to check the page is fully loaded or not
am new to nightmare js
my code is here

var Nightmare = require('nightmare');
require('nightmare-webrequest-addon');

var name = "vineeth";
var cancel = false;

var nightmare = Nightmare({
show: true,
switches: {
'proxy-server': 'localhost:3128' , // set the proxy server here ...
'ignore-certificate-errors' : true
},

});

nightmare.on('onBeforeRequest', function(details, callback){
if(details && details.hasOwnProperty("resourceType")){
console.log(details.resourceType)
}
//callback(details);
})

nightmare.onBeforeRequest([ "*.css" ],function(details, callback){
if(details && details.hasOwnProperty("resourceType") && details.resourceType == "image"){
callback({ cancel : true } )
}
else{
callback({ cancel : false } )
}
})

nightmare
.goto('https://www.flipkart.com/zesture-cotton-floral-double-bedsheet/p/itmepqvqyyzznfsn?pid=BDSEPQVQCGMQRY7Y&srno=b_1_2&otracker=hp_reco_Discounts%20for%20You_2_Min%2050%25%20off_vdm%2Fuj4%2F64i_1&lid=LSTBDSEPQVQCGMQRY7YJBFIYW&fm=personalisedRecommendation/discount&iid=513dcd7a-61cb-4633-845f-bff06e73fddd.BDSEPQVQCGMQRY7Y.SEARCH')
// .wait(10000)
.end()
.then(function(ip) { // This will log the Proxy's IP
console.log('proxy IP:', ip);
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants