diff --git a/lib/capybara/selector.rb b/lib/capybara/selector.rb index be9c34de..394381c4 100644 --- a/lib/capybara/selector.rb +++ b/lib/capybara/selector.rb @@ -100,6 +100,10 @@ Capybara.add_selector(:field) do xpath { |locator, options| XPath::HTML.field(locator) } end +Capybara.add_selector(:fieldset) do + xpath { |locator, options| XPath::HTML.fieldset(locator) } +end + Capybara.add_selector(:link_or_button) do xpath { |locator, options| XPath::HTML.link_or_button(locator) } failure_message { |node, selector| "no link or button '#{selector.locator}' found" } diff --git a/lib/capybara/session.rb b/lib/capybara/session.rb index 0222312f..a9dfb82e 100644 --- a/lib/capybara/session.rb +++ b/lib/capybara/session.rb @@ -203,7 +203,7 @@ module Capybara # @param [String] locator Id or legend of the fieldset # def within_fieldset(locator) - within :xpath, XPath::HTML.fieldset(locator) do + within :fieldset, locator do yield end end @@ -215,7 +215,7 @@ module Capybara # @param [String] locator Id or caption of the table # def within_table(locator) - within :xpath, XPath::HTML.table(locator) do + within :table, locator do yield end end