Pregunta

Please find the part of a code:

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

Error

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>

Please help me to resolve the error.

¿Fue útil?

Solución

looks like form('login_showSplashForm') finds nothing, try to use form_with or maybe forms.first

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top