Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
CasperJs测试可以';t找到css选择器(从jade迁移到pug后测试中断)_Css_Bootstrap 4_Pug_Casperjs - Fatal编程技术网

CasperJs测试可以';t找到css选择器(从jade迁移到pug后测试中断)

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

我将我的模板从jade迁移到pug,然后所有casperJs测试都会失败。大多数错误与未找到的css选择器有关。下面是我的代码示例:

casperJs测试:

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");
    });
  });