CasperJS:如何调用__doPostBack [英] CasperJS : how to call __doPostBack

查看:110
本文介绍了CasperJS:如何调用__doPostBack的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试抓取页面: http://fd1-www.leclercdrive.fr/057701/courses/pgeWMEL009_Courses .aspx#RS284323

I am trying to scrap a page : http://fd1-www.leclercdrive.fr/057701/courses/pgeWMEL009_Courses.aspx#RS284323

但是您可以看到此链接重定向到 fd1-www.leclercdrive.fr/057701/courses/pgeWMEL009_Courses.aspx 首次访问时.单击水果等"后,您可以直接使用网址访问页面

But as you can see this link redirect to fd1-www.leclercdrive.fr/057701/courses/pgeWMEL009_Courses.aspx when you first access it. after you click on "fruits et légumes" you can access the page using the url directly

因此,我需要模拟单击水果等"按钮来访问所需的页面.在代码中,它执行了dopostback

So I need to simulate a click on the button "Fruits et légumes" to access the page I want. In the code, it does a dopostback

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

Here is my code that I use with 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();

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

I still be redirected to the wrong page

推荐答案

对__doPostBack的调用不正确('objLienReceptdionEvenement'中的'd')

The call to __doPostBack is not correct (extra 'd' in 'objLienReceptdionEvenement')

应该是

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

这篇关于CasperJS:如何调用__doPostBack的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆