Accepts the currently displayed alert dialog. Usually, this is equivalent to clicking on the 'OK' button in the dialog.

Usage

                    .alerts.accept([callback])
                

Example

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

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

Parameters

Name Type description
callback
Optional
function

Optional callback function to be called when the command finishes.

See also

W3C WebDriver spec