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:
parent
18191c3223
commit
542ff66cd4
1 changed files with 4 additions and 1 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue