lib/capybara_monkey.rb in superbara-0.13.2 vs lib/capybara_monkey.rb in superbara-0.14.0
- old
+ new
@@ -1,21 +1,20 @@
class Capybara::Selenium::Node < Capybara::Driver::Node
def path
path = find_xpath(XPath.ancestor_or_self).reverse
result = []
+ default_ns = path.last[:namespaceURI]
while (node = path.shift)
parent = path.first
selector = node.tag_name
+ if node[:namespaceURI] != default_ns
+ selector = XPath.child.where((XPath.local_name == selector) & (XPath.namespace_uri == node[:namespaceURI])).to_s
+ selector
+ end
+
if parent
siblings = parent.find_xpath(selector)
-
- #MONKEY START https://github.com/teamcapybara/capybara/issues/2048
- if selector == "svg" && siblings.size == 0
- siblings = parent.find_xpath "//*[local-name() = 'svg']"
- end
- #MONKEY END
-
selector += "[#{siblings.index(node) + 1}]" unless siblings.size == 1
end
result.push selector
end