safariwatir:如何选择匿名按钮

发布于 2024-08-22 16:17:44 字数 180 浏览 6 评论 0原文

我在 OSX Snow leopard 上使用 watir 和 ruby​​ 1.8.7 进行 safari。

我想单击一个按钮,这是页面中唯一一个既没有 id 也没有名称的按钮。它只有 onckick 属性和标签内的文本。

如何做到这一点?有没有办法列出页面上的所有按钮,并获取第一个(也是唯一一个)按钮? 谢谢

I'm using watir for safari with ruby 1.8.7 on OSX Snow leopard.

I want to click a button, the only one in the page, that has neither id nor name. It only has an onckick property and the text within the tag..

How to do that? Is there a way to list all buttons on the page, and get the first (and only) one?
thanks

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

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

发布评论

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

评论(1

不醒的梦 2024-08-29 16:17:44

如果您发布了按钮的 html,我可以提供更多帮助。

像这样的事情可以做到这一点:

browser.button(:index, 1).click

browser.button(:value, "Google Search").click

与您的问题无关,但 Watir 问题的最佳位置是 瓦提尔将军

I could help more if you have posted html of the button.

Something like this could do it:

browser.button(:index, 1).click

or

browser.button(:value, "Google Search").click

Not related to your question, but the best place for Watir questions is watir-general.

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