Cannot navigate with casperjs evaluate and __doPostBack function

时间秒杀一切 提交于 2019-12-04 12:09:04

I was able to navigate the pagination by changing

casper.evaluate(function() {
    __doPostBack('RptPagerDos$ctl08$lnkPage2','');
});

To this:

casper.then(
    function(){
        casper.evaluate(   function() {
            var insertHTML='<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" /><input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" /><input type="hidden" name="__LASTFOCUS" id="__LASTFOCUS" value="" />';
            $("#Form1 .aspNetHidden").html(insertHTML);

            $("#Form1 .aspNetHidden #__EVENTTARGET").val('RptPagerDos$ctl04$lnkPage2');


            $("#Form1").submit();

        });
    }
);

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)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!