Method: Capybara::Node::Actions#click_on

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

#click_link_or_button([locator], **options) ⇒ Capybara::Node::Element

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:



28
29
30
# File 'lib/capybara/node/actions.rb', line 28

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