Method: Capybara::Node::DocumentMatchers#has_title?

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

#has_title?(string, **options) ⇒ Boolean #has_title?(regexp, **options) ⇒ Boolean

Checks if the page has the given title.

Overloads:

  • #has_title?(string, **options) ⇒ Boolean

    Parameters:

    • string (String)

      The string that title should include

  • #has_title?(regexp, **options) ⇒ Boolean

    Parameters:

    • regexp (Regexp)

      The regexp that title should match to

Parameters:

  • options (Hash)

    a customizable set of options

Options Hash (**options):

  • :wait (Numeric) — default: Capybara.default_max_wait_time

    Maximum time that Capybara will wait for title to eq/match given string/regexp argument

  • :exact (Boolean) — default: false

    When passed a string should the match be exact or just substring

Returns:

  • (Boolean)


44
45
46
# File 'lib/capybara/node/document_matchers.rb', line 44

def has_title?(title, **options)
  make_predicate(options) { assert_title(title, **options) }
end