Method: Capybara::Session#accept_confirm

Defined in:
lib/capybara/session.rb

#accept_confirm(text, **options) { ... } ⇒ String #accept_confirm(**options) { ... } ⇒ String

Execute the block, accepting a confirm.

Expects a block whose actions will trigger the display modal to appear.

Examples:

accept_confirm do
  click_link('link that triggers appearance of system modal')
end

Overloads:

  • #accept_confirm(text, **options) { ... } ⇒ String

    Parameters:

    • text (String, Regexp)

      Text or regex to match against the text in the modal. If not provided any modal is matched.

    Options Hash (**options):

    • :wait (Numeric)

      Maximum time to wait for the modal to appear after executing the block. Defaults to default_max_wait_time.

    Yields:

    • Block whose actions will trigger the system modal

  • #accept_confirm(**options) { ... } ⇒ String

    Options Hash (**options):

    • :wait (Numeric)

      Maximum time to wait for the modal to appear after executing the block. Defaults to default_max_wait_time.

    Yields:

    • Block whose actions will trigger the system modal

Returns:

  • (String)

    the message shown in the modal

Raises:


666
667
668
# File 'lib/capybara/session.rb', line 666

def accept_confirm(text = nil, **options, &blk)
  accept_modal(:confirm, text, options, &blk)
end