use xpath 2.1 features

This commit is contained in:
Thomas Walpole 2017-05-25 15:55:34 -07:00
parent efe48bb685
commit ecfe2b4eb4
2 changed files with 4 additions and 4 deletions

View File

@ -24,7 +24,7 @@ Gem::Specification.new do |s|
s.add_runtime_dependency("mime-types", [">= 2.0"])
s.add_runtime_dependency("rack", [">= 1.6.0"])
s.add_runtime_dependency("rack-test", [">= 0.6.3"])
s.add_runtime_dependency("xpath", [">= 2.0", "< 4.0"])
s.add_runtime_dependency("xpath", [">= 2.1", "< 4.0"])
s.add_runtime_dependency("addressable")
s.add_development_dependency("selenium-webdriver", [">= 3.0", "< 4.0", "!=3.4.1"])

View File

@ -77,7 +77,7 @@ Capybara.add_selector(:field) do
expression_filter(:type) do |expr, type|
type = type.to_s
if ['textarea', 'select'].include?(type)
expr.axis(:self, type.to_sym)
expr.self(type.to_sym)
else
expr[XPath.attr(:type).equals(type)]
end
@ -158,7 +158,7 @@ Capybara.add_selector(:link) do
when Regexp
node[:href].match href
else
node.first(:xpath, XPath.axis(:self)[XPath.attr(:href).equals(href.to_s)], minimum: 0)
node.first(:xpath, XPath.self[XPath.attr(:href).equals(href.to_s)], minimum: 0)
end
end
@ -257,7 +257,7 @@ Capybara.add_selector(:fillable_field) do
expression_filter(:type) do |expr, type|
type = type.to_s
if ['textarea'].include?(type)
expr.axis(:self, type.to_sym)
expr.self(type.to_sym)
else
expr[XPath.attr(:type).equals(type)]
end