2013-07-24 109 views
1

我想放弃的页面: http://fd1-www.leclercdrive.fr/057701/courses/pgeWMEL009_Courses.aspx#RS284323CasperJS:如何调用__doPostBack

但是你可以看到这个链接重定向到 fd1-www.leclercdrive.fr/057701/courses/pgeWMEL009_Courses.aspx 当你第一次访问它。点击“fruits etlégumes”后,你可以直接使用url访问页面

所以我需要模拟点击“Fruits etlégumes”按钮来访问我想要的页面。在代码中,它确实dopostback

这里是我的代码,我用casperj的使用:

var casper = require('casper').create({ 
verbose: true, 
logLevel: "debug" 
}); 


casper.start('http://fd1-www.leclercdrive.fr/057701/courses/pgeWMEL009_Courses.aspx#RS284323'); 

// here i simulate the click on "Fruits et légumes" 
casper.evaluate(function() { 
    __doPostBack('objLienReceptdionEvenement','[email protected]@284323'); 
}); 


casper.then(function() { 
console.log(' new location is ' + this.getCurrentUrl()); 
}); 

casper.run(); 

我还是被重定向到错误页面

回答

1

到__doPostBack调用不正确(额外的'objLienReceptdionEvenement' 'd')

应该

// here i simulate the click on "Fruits et légumes" 
casper.evaluate(function() { 
    __doPostBack('objLienReceptionEvenement','[email protected]@284323'); 
}) 
+0

日是不是为我工作。 OP,你能用这个例子吗?我有同样的问题,无法理解发生了什么事情https://stackoverflow.com/questions/25107976/cannot-navigate-with-casperjs-evaluate-and-dopostback-function – rowasc