Users on web page don't distinguish between "button" and "link styled as button".
Is there a way to add check whether a "button or link" is present on page?
For example Capybara has step:
page.should have_button('Click me')
which does not find links styled as buttons.
Best Answer
Updated answer (should matcher is deprecated in RSpec 3.0+):
Before:
Followed from
click_link_or_button
which is defined here: https://github.com/jnicklas/capybara/blob/master/lib/capybara/node/actions.rb#L12It calls a selector
:link_or_button
. This selector is defined here: https://github.com/jnicklas/capybara/blob/master/lib/capybara/selector.rb#L143It calls this method: http://rdoc.info/github/jnicklas/xpath/XPath/HTML#link_or_button-instance_method
So i tried to check the presence of the selector and it worked: