Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do i click this button in capybara

Please help me solve this problem with capybara

I have a button like this in capybara:

<input type="submit" value="Verify" name="verify" id="verify" class="button">

I tried with

click_button "verify"

but it gives error:

Failure/Error: find('#verify').click
NoMethodError:
  undefined method `node_name' for nil:NilClass
like image 598
jwall Avatar asked May 16 '12 06:05

jwall


1 Answers

Answer by the author

The problem lies inside the html code:

<div>
<form>
<div>    
</div>
</div>
  <input type="submit" value="Verify" name="verify" id="verify" class="button">
</form>

Because there is one redundant </div>, the <input> was treat outside the form, hence capybara cause those error. After delete the redundant </div>, everything works fine.

like image 176
Mark Huk Avatar answered Oct 15 '22 05:10

Mark Huk