找到以下HTML代码:
<input type="hidden" name="TARGET" value="www.example.com"/>
<noscript><input type="submit" value="Resume"/></noscript>
</form>
如何使用机械化单击没有ID和名称的提交按钮?
我已经找到了这种情况的答案,代码如下:
agent = Mechanize.new
#---some more codes are here, the main trick started at below.
button = Login_form.button_with(:name => 'Submit')
loggedin_page = Login_form.submit(button)
loggedin_page=agent.submit(loggedin_page.forms.first, loggedin_page.forms.first.buttons.first)