Method: Capybara::Node::Element#right_click

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

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

Right 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:


184
185
186
187
188
# File 'lib/capybara/node/element.rb', line 184

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