Ladislav M
Ladislav M

Reputation: 2187

Confirm Chrome navigation dialog in WebdriverIO

Is there a way how to confirm following dialog in WebdriverIO:

chrome_confirm_navigation

Upvotes: 2

Views: 1348

Answers (3)

T Gurung
T Gurung

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

Ladislav M
Ladislav M

Reputation: 2187

After all, alertAccept() call can handle this.

http://webdriver.io/api/protocol/alertAccept.html

Upvotes: 1

Goran
Goran

Reputation: 163

This should work :

IWebElement body = driver.FindElement(By.TagName("body")); body.SendKeys(Keys.Enter);

Upvotes: 0

Related Questions