Method: Capybara::Node::Matchers#has_table?

Defined in:
lib/capybara/node/matchers.rb

#has_table?(locator = nil, **options, &optional_filter_block) ⇒ Boolean

Checks if the page or current node has a table with the given id or caption:

page.has_table?('People')

Parameters:

  • locator (String) (defaults to: nil)

    The id or caption of a table

  • options (Hash)

    a customizable set of options

Options Hash (**options):

  • :rows (Array<Array<String>>)

    Text which should be contained in the tables <td> elements organized by row (<td> visibility is not considered)

  • :with_rows (Array<Array<String>>, Array<Hash<String,String>>)

    Partial set of text which should be contained in the tables <td> elements organized by row (<td> visibility is not considered)

  • :cols (Array<Array<String>>)

    Text which should be contained in the tables <td> elements organized by column (<td> visibility is not considered)

  • :with_cols (Array<Array<String>>, Array<Hash<String,String>>)

    Partial set of text which should be contained in the tables <td> elements organized by column (<td> visibility is not considered)

Returns:

  • (Boolean)

    Whether it exists


529
530
531
# File 'lib/capybara/node/matchers.rb', line 529

def has_table?(locator = nil, **options, &optional_filter_block)
  has_selector?(:table, locator, **options, &optional_filter_block)
end