找到以下 HTML 代码:
<input type="hidden" name="TARGET" value="www.example.com"/>
<noscript><input type="submit" value="Resume"/></noscript>
</form>
如何使用mechanize点击没有id和name的提交按钮?
找到以下 HTML 代码:
<input type="hidden" name="TARGET" value="www.example.com"/>
<noscript><input type="submit" value="Resume"/></noscript>
</form>
如何使用mechanize点击没有id和name的提交按钮?
我已经找到了此类场景的答案,代码如下:
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)