单击水豚中的编辑按钮?

发布于 2025-01-20 22:13:27 字数 324 浏览 3 评论 0原文

我正在尝试单击这个特定的编辑按钮。我在 ruby​​ 中使用 find 方法来执行此操作,我遇到的问题是它无法找到特定元素。

<i ng-click="grid.appScope.editMOO(row.entity._id)" class="ca ca-pencil-square-o" role="button" tabindex="0"></I>

这是我尝试单击编辑按钮的代码。

find('.ng-click', class: 'ca ca-pencil-square-o').click

I'm trying to click on this specific edit button. I'm using find method in ruby to do so, the problem I'm running into is that It's not able to find the specific element.

<i ng-click="grid.appScope.editMOO(row.entity._id)" class="ca ca-pencil-square-o" role="button" tabindex="0"></I>

Here is my code trying to click on the edit button.

find('.ng-click', class: 'ca ca-pencil-square-o').click

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

春花秋月 2025-01-27 22:13:27

要单击所需的按钮,您可以使用以下任何一个

find('i[ng-click^="grid.appScope.editM"]').click

find('i[ng-click^=grid.appScope.editM]').click

To click on the desired button you can use either of the following Locator Strategies:

find('i[ng-click^="grid.appScope.editM"]').click

or

find('i[ng-click^=grid.appScope.editM]').click
樱娆 2025-01-27 22:13:27

根据ng-click属性的属性不是一个好主意,而是要进行

find('i[role="button"]', class: 'ca-pencil-square-o').click

find('i[role="button"].ca-pencil-square-o').click

注意,如果您想对两个类(例如您最初进行)进行测试,您将数组传递给class选项

find('i[role="button"]', class: ['ca', 'ca-pencil-square-o']).click

,但是检查“ CA”和“ CA-Pencil-square-o”确实没有意义

Depending on the ng-click attribute for this is not a great idea, instead do either of

find('i[role="button"]', class: 'ca-pencil-square-o').click

or

find('i[role="button"].ca-pencil-square-o').click

Note, if you wanted to test for both classes like you were doing originally you pass an array to the class option

find('i[role="button"]', class: ['ca', 'ca-pencil-square-o']).click

but that doesn't really make sense to check for both 'ca' and 'ca-pencil-square-o'

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文