在WebdriverIO中确认Chrome导航对话框

时间:2015-12-09 13:42:58

标签: selenium selenium-webdriver automated-tests integration-testing webdriver-io

有没有办法在WebdriverIO中确认以下对话框:

chrome_confirm_navigation

3 个答案:

答案 0 :(得分:0)

这应该有效:

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

答案 1 :(得分:0)

毕竟,alertAccept()调用可以处理这个问题。

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

答案 2 :(得分:0)

如果您无法使用webdriverIO中的alertAccept(),请尝试尝试:

解雇或接受

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.