class Capybara::Selector

def xpath(*allowed_filters, &block)

Returns:
  • (#call) - The block that will be called to generate the XPath expression

Overloads:
  • xpath()
  • xpath(*expression_filters, &block)

Other tags:
    Yieldreturn: - An object that can produce an xpath expression

Other tags:
    Yieldparam: options - The options hash passed to the query
    Yieldparam: locator - The locator string passed to the query

Other tags:
    Yield: - The block to use to generate the XPath expression

Parameters:
  • expression_filters (Array) -- ([]) Names of filters that can be implemented via this expression
def xpath(*allowed_filters, &block)
  if block
    @format, @expression = :xpath, block
    allowed_filters.flatten.each { |ef| expression_filters[ef] = Filters::IdentityExpressionFilter.new(ef) }
  end
  format == :xpath ? @expression : nil
end