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

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("mime-types", [">= 2.0"])
s.add_runtime_dependency("rack", [">= 1.6.0"]) s.add_runtime_dependency("rack", [">= 1.6.0"])
s.add_runtime_dependency("rack-test", [">= 0.6.3"]) 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_runtime_dependency("addressable")
s.add_development_dependency("selenium-webdriver", [">= 3.0", "< 4.0", "!=3.4.1"]) 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| expression_filter(:type) do |expr, type|
type = type.to_s type = type.to_s
if ['textarea', 'select'].include?(type) if ['textarea', 'select'].include?(type)
expr.axis(:self, type.to_sym) expr.self(type.to_sym)
else else
expr[XPath.attr(:type).equals(type)] expr[XPath.attr(:type).equals(type)]
end end
@ -158,7 +158,7 @@ Capybara.add_selector(:link) do
when Regexp when Regexp
node[:href].match href node[:href].match href
else 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
end end
@ -257,7 +257,7 @@ Capybara.add_selector(:fillable_field) do
expression_filter(:type) do |expr, type| expression_filter(:type) do |expr, type|
type = type.to_s type = type.to_s
if ['textarea'].include?(type) if ['textarea'].include?(type)
expr.axis(:self, type.to_sym) expr.self(type.to_sym)
else else
expr[XPath.attr(:type).equals(type)] expr[XPath.attr(:type).equals(type)]
end end