Wait for a child process in CasperJS

后端 未结 2 1017
挽巷
挽巷 2020-12-21 04:37

I have a CasperJS process that loads some page and then it needs to call a go-process to analyze the page and to decide what page should be loaded next. go-process takes a w

2条回答
  •  执笔经年
    2020-12-21 05:08

    casper.then(function(){
      var p = cp.execFile('/path/parse', [], {}, function(error, stdout, stderr) {
        console.log(stdout);
        casper.thenOpen(parsedUrl).then(function(){
          // do something on page
        });
      });
    });
    casper.run(function(){});
    

    From my test, capser.run does not wait for execFile to finish the job. There is no log gets printed from the execFile callback. @Artjom B.

提交回复
热议问题