【发布时间】:2017-08-11 07:40:51
【问题描述】:
我是 CasperJS 的新手。
当我使用withPopup 时,弹出窗口中的页面似乎没有完全加载...
var casper = require('casper').create({
verbose: true,
})
casper.start('https://www.w3schools.com/js/js_examples.asp').then(function(){
this.capture('try1.png');
this.click('#main p a');
})
casper.waitForPopup(0, function() {
this.capture('try2.png');
}, null, 20000);
casper.withPopup(0, function() {
this.waitForSelector('body', function(){
this.capture('try3.png');
})
});
casper.run(function() {
casper.echo('Done.').exit();
});
【问题讨论】:
-
对于初学者
#main p a返回至少 290 个锚元素。其次,单击其中的第一个不会显示弹出窗口,而是重定向到另一个 url!你想在这里做什么? -
我只是想尝试一下withPopup功能,使用click重定向到另一个页面。
标签: javascript casperjs