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

Usage

                    .alerts.accept([callback])
                

Example

Or run locally with:
git clone https://github.com/nightwatchjs/nightwatch-examples.git
cd nightwatch-examples
npm install
npx nightwatch /api/acceptAlert.js

Parameters

Name Type description
callback
Optional
function

Optional callback function to be called when the command finishes.

See also

W3C WebDriver spec