javascript - 使用 Casperjs 在 Angularjs 中单击

标签 javascript angularjs phantomjs casperjs

我想使用 casperjs 在 angularjs 中单击。但是,我无法做到这一点。每次我运行时,该网页都会填充一个对话框,所以这就是我需要单击的原因。

这是我尝试点击的内容

<button class="ng-scope" trans="" ng-click="closeDialog(activeDialog, 'okButton');$event.stopPropagation();" ng-if="!activeDialog.yesno">Tamam</button>

这是我在 casperjs 中使用的

casper.then(function () {
this.evaluate(function() {  

    $($(document).find('button[ng-if="!activeDialog.yesno"]')).click();
});

this.wait(3000);

提前致谢

最佳答案

我使用下面的代码解决了这个问题:

casper.waitUntilVisible('.close-j',function(){
   this.click(x("//a[@ng-show='!activeDialog.hideCloseButton']"‌​));
   this.wait(5000);
});

关于javascript - 使用 Casperjs 在 Angularjs 中单击,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41666241/

相关文章:

javascript - 替换和计算数组中的值

linux - FreeBSD Linux 库安装

angularjs - 我遇到了 phantomjs 和 karma 问题

javascript - 在meteor中使用Spiderable会在body标签中显示html之前复制head内容

javascript - 如何知道动态 "iterable"参数中的所有 Promise 何时已解决?

javascript - 使用 AngularJS 和 PHP 将数据保存到数据库

JavaScript 对象 : How to create a working object inclusive encapsulation?

javascript - javascript "resizeTo"函数在 Chrome 和 Opera 中不起作用

ajax - AngularJS 结合 Web 服务响应

javascript - 如何在 Web API 中正确注入(inject) Angular 模块的依赖项?