Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rails capybara - how to detect js clicking on a li (not a link or a button)

I have a js submit button that is a input element within an li. So it is not a link or a button and presumably this is why the click_on isn't working right - I get

Failure/Error: click_on 'user_submit_action'  
Capybara::ElementNotFound:
   no link or button 'user_submit_action' found

Code...

</fieldset>
      <fieldset class="actions"><ol>
       <li class="action input_action" id="user_submit_action"><input class="a1" name="commit" type="submit" value="Create User" /></li>
</ol></fieldset></form>  </div>
</div>
like image 892
Michael Durrant Avatar asked Dec 27 '22 20:12

Michael Durrant


1 Answers

Like this ?

find("#user_submit_action").find("input").click

You can see the doc : http://rubydoc.info/github/jnicklas/capybara/master/Capybara/Node/Finders.

like image 176
Dougui Avatar answered Dec 30 '22 07:12

Dougui