Dismisses the currently displayed alert dialog.

For confirm() and prompt() dialogs, this is equivalent to clicking the 'Cancel' button.
For alert() dialogs, this is equivalent to clicking the 'OK' button.

Usage

                    .alerts.dismiss([callback])
                

Example

module.exports = {
  'dismiss open alert': function (browser) {
    browser
      .alerts.dismiss(function () {
        console.log('alert dismissed successfully');
      });
  },

  'dismiss open alert with ES6 async/await': async function (browser) {
    await browser.alerts.dismiss();
  }
};

Parameters

Name Type description
callback
Optional
function

Optional callback function to be called when the command finishes.

See also

W3C WebDriver spec