You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 29, 2024. It is now read-only.
I have a set of tests which rely on browser.switchTo().alert() to accept and dismiss both alerts and dialogs. The tests no longer work on the dialogs. The dialogs remain open, the test is not able to accept or dismiss the dialog, and the test control flow hangs.
// PASSES
it('should handle alerts', function() {
// trigger $location.url('/page2');
element(by.id('navigateAway')).click();
var alertDialog = browser.switchTo().alert();
expect(alertDialog.accept).toBeDefined();
alertDialog.accept();
});
// FAILS
it('should handle dialogs', function() {
// trigger window.onbeforeunload = function() { return 'are you sure?'; }
browser.navigate().refresh();
var alertDialog = browser.switchTo().alert();
expect(alertDialog.accept).toBeDefined(); // fails
alertDialog.accept(); // alertDialog and accept are not defined
});
There is discussion on the interwebs about similar problems where dialogs are not accessible by using browser.switchTo(). There is an open bug on selenium chromedriver here
There are a few related issues on protractor, specifically #308 and #55
I've tried using getAllWindowHandles and this fails too: