Reputation: 726
I'm trying to get a simple input submit to click using capybara
. The submit button
is actually on a modal. However, trying a few capybara
still not working. Since I'm doing testing, I'm advise to not modify the code base. Adding an id
would solve this easily but I have to do without it.
HTML code
<input type="submit" class="btn btn-primary text-uppercase" value="Create" form="new_tab">
Capybara commands tried
find("input[type=submit][value='Create']").click
find('input[type]="submit"]').click
find('input[class="btn btn-primary text-uppercase"]').click
Upvotes: 17
Views: 12393
Reputation: 1575
Try to use this version:
find('input[name="commit"]').click
It helps me all time.
Upvotes: 21
Reputation: 49870
click_button("Create")
should click it, assuming it is visible on the page. http://www.rubydoc.info/gems/capybara/Capybara%2FNode%2FActions%3Aclick_button
Upvotes: 16