使用Ruby Mechanize单击按钮 [英] Clicking a button with Ruby Mechanize

查看:78
本文介绍了使用Ruby Mechanize单击按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个特别困难的表格,我试图单击搜索按钮,但似乎无法执行.这是页面源中表单的代码:

I have a particularly difficult form that I am trying to click the search button and can't seem to do it. Here is the code for the form from the page source:

<input type="image" name="" src="http://images.example.com/WOKRS53B4/images/search.gif" align="absmiddle" border="0" onclick="return check_form_inputs('UA_GeneralSearch_input_form','search');" title="Search" alt="Search" class="">

我正在尝试执行标准的机械化点击操作:

I am trying to do the standard mechanize click action:

login_page = agent.click(homepage.link_with(:text => "Search"))

这是因为按钮使用了javascript吗?如果是这样,有什么建议吗?

Is this because the button uses javascript? If so, any suggestions?

推荐答案

它不是链接,而是按钮.您需要做的是查找表单(例如,使用form_with),然后查找ImageButton和submit.

It is not a link, it is a button. What you need to do is look for the form (for example, with form_with) and then look for the ImageButton and submit it.

这篇关于使用Ruby Mechanize单击按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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