devtools
Version:
A Chrome DevTools protocol binding that maps WebDriver commands into Chrome DevTools commands using Puppeteer
15 lines (14 loc) • 423 B
JavaScript
/**
* The Accept Alert command accepts a simple dialog if present, otherwise error.
*
* @alias browser.acceptAlert
* @see https://w3c.github.io/webdriver/#dfn-accept-alert
*/
export default async function acceptAlert() {
if (!this.activeDialog) {
throw new Error('no such alert');
}
await this.activeDialog.accept(this.activeDialog.defaultValue());
delete this.activeDialog;
return null;
}