单击 jruby 中的按钮 +迅速
我正在尝试进行一些屏幕抓取,并且已经完成了最后一步。我正在尝试下载一个文件,该文件是通过以下 html 中的按钮访问的:
<button class="pdf ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false">
<span class="ui-button-text">
<span class="icon-32 pdf-32"></span>
<span class="btn-txt"> PDF file </span>
我习惯于单击带有以下 ruby 代码的按钮:
browser.button(:value, "Sign In").click
但是有了这个 .. 似乎没有任何我可以使用的值。有人可以帮我吗?
I'm trying to do some screen scraping, and I've gotten down to this last step. I'm trying to download a file, which is accessed via a button from the following html:
<button class="pdf ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false">
<span class="ui-button-text">
<span class="icon-32 pdf-32"></span>
<span class="btn-txt"> PDF file </span>
I'm used to clicking buttons with the following ruby code:
browser.button(:value, "Sign In").click
But with this .. there doesn't seem to be any value I can use. Can anyone help me out?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我可以想到几种可能性。一是您可以对值进行正则表达式匹配。尝试:
但您不必使用该值,您可以使用唯一标识的属性。在这种情况下,您也许可以使用该类,例如,
如果 pdf 类不是唯一的,您可以添加
:index
来标识要单击哪一个匹配项。I can think of a couple possibilities. One is that you can do a regular expression match on the value. Try:
But you don't have to use the value, you can use a uniquely identifying attribute. In this case, you may be able to use the class, e.g.
If the pdf class is not unique, you can add an
:index
to identify which one of the matches to click.