When I try to navigate the pagination on sites with links where href is a __doPostBack function call, I never achieve the page change.
I am not sure what I am missing, so after a few hours of messing around I decided to see if someone here can give me a clue. This is my code (uber-simplified to show the use case).
var casper = require('casper').create({
verbose: true,
logLevel: "debug"
});
casper.start('http://www.gallito.com.uy/inmuebles/venta');
// here i simulate the click on a link in the pagination list
casper.evaluate(function() {
__doPostBack('RptPagerDos$ctl08$lnkPage2','');
});
casper.then(function() {
console.log(' new location is ' + this.getCurrentUrl());
var i=casper.evaluate(function(){
return $(".aspNetDisabled").text();
});
console.log(i);
});
casper.run();
I tried with casper's click() and a simple jQuery click on evaluate, but that does not work because the href is a call to the __doPostBack function.
I am using casperjs 1.1.0-beta3 and phantomjs 1.9.7. I checked for similar issues and I saw this post CasperJS : how to call __doPostBack but the solution there does not work for me, and apparently it did not work for the OP either.
Thanks in advance. Please let me know if you need any more details.
I was able to navigate the pagination by changing
To this:
I noticed that even trying to submit the form directly was a problem, it looks like for some reason, it was not finding the elements it needed (i tried casper's fill() function and got crashes because the form inputs were not present)