Method: Capybara::Node::Actions#click_link_or_button

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

Finds a button or link and clicks it. See #click_button and #click_link for what locator will match against for each type of element.

If the driver is capable of executing JavaScript, this method will wait for a set amount of time and continuously retry finding the element until either the element is found or the time expires. The length of time this method will wait is controlled through default_max_wait_time.

Parameters:

Options Hash (**options):

  • wait (false, true, Numeric)

    Maximum time to wait for matching element to appear. Defaults to default_max_wait_time.

Returns:



25
26
27
# File 'lib/capybara/node/actions.rb', line 25

def click_link_or_button(locator = nil, **options)
  find(:link_or_button, locator, **options).click
end