我将模板从玉器迁移到哈巴狗,然后所有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");
    });
  });

09-20 23:17