lib/spreewald/web_steps.rb in spreewald-1.1.1 vs lib/spreewald/web_steps.rb in spreewald-1.1.2
- old
+ new
@@ -492,10 +492,12 @@
end
# Click on some text that might not be a link
When /^I click on "([^\"]+)"$/ do |text|
patiently do
- element = page.find(:xpath, ".//*[contains(text(), \"#{text}\")]")
+ contains_text = %{contains(., \"#{text}\")}
+ # find the innermost selector that matches
+ element = page.find(:xpath, ".//*[#{contains_text} and not (./*[#{contains_text}])]")
element.click
end
end
# Use this step to check external links.