Unexpected Alert Open Error. “browser.switchTo().a

2019-04-10 00:21发布

问题:

How to handle this error in chrome browser using protractor.

Chrome driver through's following error: UnexpectedAlertOpenError: unexpected alert open: {Alert text : There are unsaved data, please save before you leave, otherwise your changes get lost!} I have used "browser.switchTo().alert().accept();" but this is not working, works fine in firefox. Please help me, help is greatly appreciated.

回答1:

today, after struggling with this new problem for the past week or so, we found that the problem was fixed by using the latest Protractor version. Changing the package.json to "protractor": "*" did the job.