Method: Capybara::Node::Element#click

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

#click(*modifier_keys, wait: nil, **offset) ⇒ Capybara::Node::Element

Click the Element.

If the driver dynamic pages (JS) and the element is currently non-interactable, this method will continuously retry the action until either the element becomes interactable or the maximum wait time expires.

Both x: and y: must be specified if an offset is wanted, if not specified the click will occur at the middle of the element.

Parameters:

  • *modifier_keys (:alt, :control, :meta, :shift)

    ([]) Keys to be held down when clicking

Parameters:

  • wait (false, Numeric)

    Maximum time to wait for the action to succeed. Defaults to default_max_wait_time.

  • options (Hash)

    a customizable set of options

Options Hash (**options):

  • delay (Float)

    Delay between the mouse down and mouse up events in seconds (0)

Returns:



170
171
172
173
174
# File 'lib/capybara/node/element.rb', line 170

def click(*keys, **options)
  perform_click_action(keys, **options) do |k, opts|
    base.click(k, **opts)
  end
end