Skip to content

Instantly share code, notes, and snippets.

@xn
Forked from leshill/gist:870866
Created Mar 17, 2011
Embed
What would you like to do?
# Add this to more_web_steps.rb
# Selenium docs: http://code.google.com/p/selenium/wiki/RubyBindings#Javascript_Alert/Confirm today!
When /^I (accept|dismiss) the "([^"]*)" alert$/ do |action, text|
window = page.driver.browser.window_handle
alert = page.driver.browser.switch_to.alert
alert.text.should == text
alert.send(action)
page.driver.browser.switch_to.window window
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment