1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00

Link matching works differently in Selenium, use xpath instead

This commit is contained in:
Jonas Nicklas 2012-01-03 09:43:11 +01:00
parent 18191c3223
commit 542ff66cd4

View file

@ -92,7 +92,10 @@ end
Capybara.add_selector(:link) do Capybara.add_selector(:link) do
xpath { |locator, xpath_options| XPath::HTML.link(locator, xpath_options) } xpath { |locator, xpath_options| XPath::HTML.link(locator, xpath_options) }
failure_message { |node, selector| "no link with title, id or text '#{selector.locator}' found" } failure_message { |node, selector| "no link with title, id or text '#{selector.locator}' found" }
filter(:href) { |node, href| node[:href] == href } filter(:href) do |node, href|
attribute = XPath.attr(:href).equals(href)
node.first(:xpath, "self::a[#{attribute}]")
end
end end
Capybara.add_selector(:button) do Capybara.add_selector(:button) do