Skip to content

Instantly share code, notes, and snippets.

@bbugh
Created October 13, 2012 01:04
Show Gist options
  • Select an option

  • Save bbugh/3882746 to your computer and use it in GitHub Desktop.

Select an option

Save bbugh/3882746 to your computer and use it in GitHub Desktop.
Accessing alert box in JavaScript with Capybara/rails/rspec
//Get a reference to the alert using the following:
alert = page.driver.browser.switch_to.alert
// and then hit OK with
page.driver.browser.switch_to.alert.accept
// or dismiss it with
page.driver.browser.switch_to.alert.dismiss
// or get the text with
page.driver.browser.switch_to.alert.text
@benlieb

benlieb commented Jun 27, 2019

Copy link
Copy Markdown

works for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment