WaitForPopup in CasperJS always gets "wait timeout"

In my page automation script, when I click the link on the label, a new window will open. The link url is generated by complex javascript.

<a class="link_text" href="#" onclick="process('2c913f9e4c7314e1014c74a4a5e02573')">ๅŠž็†ไปปๅŠก </a>

after running the url becomes: https://oa.phicomm.com/workflow/doJob.action?taskVo.processExecutionId=2c913f9e49d0d5280149d12fabd90dd0&taskVo.taskId=10851011

I am trying to use API-casper.waitForPopup after click action.

casper.waitForPopup(/.+/, function(){
    this.echo(this.getTitle());
}, null, 20000);

      

But it failed because the 20000ms timeout timed out. I also tried putting urlstring as a parameter:

casper.waitForPopup(/oa.phicomm.com\/workflow\/doJob\.action\?taskVo\.processExecutionId=2c913f9e49d0d5280149d12fabd90dd0&taskVo\.taskId=9100818/, function{
    this.echo(this.getTitle());
});

      

waiting time. I also capture a screenshot, obviously still on the previous page. I am trying to use the thenOpen method by directly entering the URL. It works. But since I want to automate it, I cannot know the url before I start using the link. I'm new to CasperJS, does anyone know how to solve this problem? Thank.

+3


source to share


1 answer


I had the same problem, do I solve this problem with the first selector or not

casper.[waitForSelector][1]('#example_id', function() {
    this.echo("yes");

});

      

If your selector exists try this



casper.[waitForPopup][1](0, function() {
    this.echo('Popup');
});
casper.withPopup(0, function() {
    this.capture('screen.png');
});  

      

More about waitForPopup

+1


source







All Articles