0

请找到代码的一部分:

button = Login_form.button_with(:name => 'Submit')
loggedin_page = Login_form.submit(button)


bizz_hierarchy_form=loggedin_page.form('login_showSplashForm')
button = bizz_hierarchy_form.button_with(:name => 'btnHome')  #error raised here
# buyer_page = bizz_hierarchy_form.submit(button)
# print buyer_page.title

错误

D:\Ruby script>ruby Test.rb
mechanize.rb:20:in `<main>': undefined method `button_with' for nil:NilClass (No
MethodError)

D:\Ruby script>

html

<td>
<input type="submit" name="btnHome" value="Homepage" class="btnBig"><input type="hidden" name="_synchToken_hom" value="1139cc8dd7d906f1"/>
</td>

请帮我解决错误。

4

1 回答 1

1

看起来form('login_showSplashForm')什么都没有,尝试使用form_with或者也许forms.first

于 2013-01-21T20:55:35.723 回答