AngularJS量角器 - 使用Ng-Click绑定在页面上查找元素 [英] AngularJS Protractor - Finding an Element on a Page Using Ng-Click Binding

查看:99
本文介绍了AngularJS量角器 - 使用Ng-Click绑定在页面上查找元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的页面上有一个按钮,如下所示:

I have a button on a page that looks like:

<button ng-click="myFunction()" ng-show="flag">
    Submit
</button>

该元素没有ID。

有没有办法使用绑定到Ng-Click的函数找到这个元素?或者我是否必须为此元素分配ID以使用Jasmine / Protractor找到它?

Is there a way to find this element using the function bound to Ng-Click? Or do I have to assign an ID to this element to locate it using Jasmine / Protractor?

推荐答案

我浏览了Protractor API并没有找到任何与通过 ng-click 查找元素相关的内容。我确实找到了

I went through the Protractor API and didn't find anything related to finding an element through ng-click. I did find

元素(by.buttonText(提交));

不太一样,但在我的环境中完成工作。

Not quite the same, but does the job in my environment.

这篇关于AngularJS量角器 - 使用Ng-Click绑定在页面上查找元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆