【问题标题】:CasperJS : how to call __doPostBackCasperJS:如何调用 __doPostBack
【发布时间】:2013-07-24 09:52:47
【问题描述】:

我正在尝试废弃一个页面: http://fd1-www.leclercdrive.fr/057701/courses/pgeWMEL009_Courses.aspx#RS284323

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

所以我需要模拟点击“Fruits et légumes”按钮来访问我想要的页面。在代码中,它做了一个回发

这是我与casperjs 一起使用的代码:

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','2@@284323');
});


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

casper.run();

我仍然被重定向到错误的页面

【问题讨论】:

    标签: web-scraping web-crawler phantomjs casperjs dopostback


    【解决方案1】:

    对 __doPostBack 的调用不正确('objLienReceptdionEvenement' 中的额外“d”)

    应该是

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

    【讨论】:

    猜你喜欢
    • 2014-02-18
    • 1970-01-01
    • 2014-02-20
    • 2011-04-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-09-08
    • 2014-12-25
    相关资源
    最近更新 更多