CasperJs测试可以';t找到css选择器(从jade迁移到pug后测试中断)
我将我的模板从jade迁移到pug,然后所有casperJs测试都会失败。大多数错误与未找到的css选择器有关。下面是我的代码示例: casperJs测试:CasperJs测试可以';t找到css选择器(从jade迁移到pug后测试中断),css,bootstrap-4,pug,casperjs,Css,Bootstrap 4,Pug,Casperjs,我将我的模板从jade迁移到pug,然后所有casperJs测试都会失败。大多数错误与未找到的css选择器有关。下面是我的代码示例: casperJs测试: casper.thenOpen("http://localhost:8080/activites/E5555", function() { this.wait(5000, function() { this.click("a.open-user-dialog"); }); }); 这里是元素的哈巴狗: p
casper.thenOpen("http://localhost:8080/activites/E5555", function() {
this.wait(5000, function() {
this.click("a.open-user-dialog");
});
});
这里是元素的哈巴狗:
p
i.fa-icon-plus.fa-icon-success
strong: a.open-user-dialog(href="#user-dialog", data-toggle="modal") Add user
测试结果如下:
FAIL无法在不存在的选择器上调度mousedown事件:a.open-user-dialog
我将感谢任何帮助 我终于明白了,答案如下: 我放置了
casper.wait(2000,function(){})代码>在加载页面之前,它修复了问题
casper.wait(2000, function(){});
casper.thenOpen("http://localhost:8080/activites/E5555", function() {
this.wait(5000, function() {
this.click("a.open-user-dialog");
});
});