Skip to content

Instantly share code, notes, and snippets.

@illicitonion
Created August 1, 2011 13:20
Show Gist options
  • Save illicitonion/1118107 to your computer and use it in GitHub Desktop.
Save illicitonion/1118107 to your computer and use it in GitHub Desktop.
FirefoxDriver.prototype.dismissAlert = function(respond) {
webdriver.modals.dismissAlert(this);
respond.send();
};
FirefoxDriver.prototype.dismissAlert.preconditions = [ webdriver.preconditions.alertPresent ];
/**
* Guard to ensure that no modal dialog is open.
*
* @param {!Object} driver A WebDriver instance.
*/
webdriver.preconditions.alertPresent = function(driver) {
if (driver.modalOpen !== false) {
return new WebDriverError(ErrorCode.NO_SUCH_WINDOW,
'A modal dialog, such as an alert, is not open.');
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment