2017-04-24 78 views
2

我正在開發一個Angular應用程序,我有一個量角器的問題。 事情是,應用程序必須有這個消​​息時卸載:量角器失敗:意外的警報打開

alert

在量角器測試中,我得到這個錯誤:

- Failed: unexpected alert open: {Alert text : Do you want to leave this site} 
    (Session info: chrome=57.0.2987.133) 
    (Driver info: chromedriver=2.26.436362 (5476ec6bf7ccbada1734a0cdec7d570bb042aa30),platform=Windows NT 10.0.14393 x86_64) 

瀏覽,我發現這個解決方案:

var alertDialog = browser.switchTo().alert(); 
alertDialog.accept(); 

但在這種情況下,我得到這個:

- Failed: unexpected alert open: {Alert text : Do you want to leave this site} 
    (Session info: chrome=57.0.2987.133) 
    (Driver info: chromedriver=2.26.436362 (5476ec6bf7ccbada1734a0cdec7d570bb042aa30),platform=Windows NT 10.0.14393 x86_64) 
- Failed: Error while waiting for Protractor to sync with the page: "window.getAllAngularTestabilities is not a function" 

回答