Reputation: 2187
Is there a way how to confirm following dialog in WebdriverIO:
Upvotes: 2
Views: 1348
Reputation: 363
If you are unable to do with alertAccept() in webdriverIO then give this a try :
dismiss or accept it:
browser.execute(() =>{
window.onbeforeunload = function(e) {
e.trigger({ type: 'mousedown', which: 13 });
}
});
// Note: 13 is the key code for enter. And 27 is the key code for escape.
Upvotes: 1
Reputation: 2187
After all, alertAccept() call can handle this.
http://webdriver.io/api/protocol/alertAccept.html
Upvotes: 1
Reputation: 163
This should work :
IWebElement body = driver.FindElement(By.TagName("body")); body.SendKeys(Keys.Enter);
Upvotes: 0