Method: Capybara::Node::Matchers#has_link?

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

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

Checks if the page or current node has a link with the given text or id.

Parameters:

  • locator (String) (defaults to: nil)

    The text or id of a link to check for

  • options (Hash)

    a customizable set of options

Options Hash (**options):

  • :href (String, Regexp)

    The value the href attribute must be

Returns:

  • (Boolean)

    Whether it exists



359
360
361
# File 'lib/capybara/node/matchers.rb', line 359

def has_link?(locator = nil, **options, &optional_filter_block)
  has_selector?(:link, locator, **options, &optional_filter_block)
end