Reputation: 12861
I see a lot of documentation and examples of people using xpath with capybara but for some reason I don't find anything on how to do the simplest thing... click a (button|link|whatever) identified by an xpath selector. How does one accomplish a step definition like:
Given /^I click the element identified by xpath "([^"]*)"$/ do |xpath_selector|
click_button(xpath_selector)
end
Upvotes: 0
Views: 1180
Reputation: 6642
If you want to manually specify the xpath selector and click the element no matter what it is (button, link, div, etc), try:
page.find(:xpath, xpath_selector).click
Upvotes: 1