0

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.

Arup Rakshit
  • 116,827
  • 30
  • 260
  • 317

1 Answers1

1

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

zed_0xff
  • 32,417
  • 7
  • 53
  • 72
  • still the same error. And the error is coming with the `button` line. – Arup Rakshit Jan 21 '13 at 20:58
  • ofcourse it will come from `button` line b/c it tries to call a `button_with` methon on a `bizz_hierarchy_form` object **which is NULL**; check your HTML for correct classes, or, maybe there are no forms at all? – zed_0xff Jan 21 '13 at 21:02
  • without form is it possible to click the button? Yes I just checked that before going the `page` there is a intermediate page having form `submit form` after that `login_showSplashForm` will come. But how to go from that intermediate page to `login_showSplashForm` page? – Arup Rakshit Jan 21 '13 at 21:10