diff --git a/lib/capybara/selector.rb b/lib/capybara/selector.rb index faf067524..e2a790de6 100644 --- a/lib/capybara/selector.rb +++ b/lib/capybara/selector.rb @@ -90,11 +90,10 @@ def filter(name, &block) end Capybara.add_selector(:link) do - xpath { |locator, xpath_options| XPath::HTML.link(locator, xpath_options) } + xpath { |locator| XPath::HTML.link(locator) } failure_message { |node, selector| "no link with title, id or text '#{selector.locator}' found" } filter(:href) do |node, href| - attribute = XPath.attr(:href).equals(href) - node.first(:xpath, "self::a[#{attribute}]") + node.first(:xpath, XPath.axis(:self)[XPath.attr(:href).equals(href)]) end end @@ -104,26 +103,26 @@ def filter(name, &block) end Capybara.add_selector(:fillable_field) do - xpath { |locator, xpath_options| XPath::HTML.fillable_field(locator, xpath_options) } + xpath { |locator| XPath::HTML.fillable_field(locator) } failure_message { |node, selector| "no text field, text area or password field with id, name, or label '#{selector.locator}' found" } end Capybara.add_selector(:radio_button) do - xpath { |locator, xpath_options| XPath::HTML.radio_button(locator, xpath_options) } + xpath { |locator| XPath::HTML.radio_button(locator) } failure_message { |node, selector| "no radio button with id, name, or label '#{selector.locator}' found" } filter(:checked) { |node, value| not(value ^ node.checked?) } filter(:unchecked) { |node, value| (value ^ node.checked?) } end Capybara.add_selector(:checkbox) do - xpath { |locator, xpath_options| XPath::HTML.checkbox(locator, xpath_options) } + xpath { |locator| XPath::HTML.checkbox(locator) } failure_message { |node, selector| "no checkbox with id, name, or label '#{selector.locator}' found" } filter(:checked) { |node, value| not(value ^ node.checked?) } filter(:unchecked) { |node, value| (value ^ node.checked?) } end Capybara.add_selector(:select) do - xpath { |locator, xpath_options| XPath::HTML.select(locator, xpath_options) } + xpath { |locator| XPath::HTML.select(locator) } failure_message { |node, selector| "no select box with id, name, or label '#{selector.locator}' found" } filter(:options) { |node, options| options.all? { |option| node.first(:option, option) } } filter(:selected) do |node, selected| @@ -142,7 +141,7 @@ def filter(name, &block) end Capybara.add_selector(:file_field) do - xpath { |locator, xpath_options| XPath::HTML.file_field(locator, xpath_options) } + xpath { |locator| XPath::HTML.file_field(locator) } failure_message { |node, selector| "no file field with id, name, or label '#{selector.locator}' found" } end @@ -151,5 +150,5 @@ def filter(name, &block) end Capybara.add_selector(:table) do - xpath { |locator, xpath_options| XPath::HTML.table(locator, xpath_options) } + xpath { |locator| XPath::HTML.table(locator) } end diff --git a/xpath b/xpath index 422ff063e..375ec5c79 160000 --- a/xpath +++ b/xpath @@ -1 +1 @@ -Subproject commit 422ff063e2a46869574b764e405c1e5573b14ff2 +Subproject commit 375ec5c79fde418788fc6d37ac64e53c2789eeef