Howt o fix protractor that suddenly started to crash when notifications

I have a project that has been working well for a long time. Recently (a couple of weeks) system tests have failed.

After much research, we came to the conclusion that the protractor cannot identify and close the warning.

The code that was used to work

exports.removeFaq = function( index ){
    console.log('deleting item at',index);
    exports.getContent(index).$( '[ng-click="removeFAQ($index)"]').click();
    browser.sleep(2000);
    browser.switchTo().alert().accept();
    return browser.sleep(2000);
};

now throws errors:

WebDriverError: unknown error: cannot determine loading status
from unexpected alert open
  (Session info: chrome=52.0.2743.116)
  (Driver info: chromedriver=2.21.371461 (633e689b520b25f3e264a2ede6b74ccc23cb636a),platform=Linux 4.2.0-38-generic x86_64) (WARNING: The server did not provide any stacktrace information)

and (using the element explorer):

> browser.switchTo().alert().accept();
UnexpectedAlertOpenError: unexpected alert open: {Alert text : are you sure you want to remove this helper content?}
  (Session info: chrome=52.0.2743.116)
  (Driver info: chromedriver=2.21.371461 (633e689b520b25f3e264a2ede6b74ccc23cb636a),platform=Linux 4.2.0-38-generic x86_64) (WARNING: The server did not provide any stacktrace information)

We tried - waitinginstead of sleeping. - sleep for a long period - ignoring angular.

nothing matters.

how can i fix this?

+4
source share
2 answers

. , 2.21. (2.23), , , .

webdriver-manager update --chrome , zip selenium. .

, . , .

3.x
node_modules/protractor/config.json , webdriver-manager update

4.x
./node_modules/protractor/node_modules/webdriver-manager/config.json.

+2

, 2000ms ? . . , ,

  //wait maximum up to lets 5s before giving up
  browser.wait(protractor.ExpectedConditions.alertIsPresent(), 5000); 
  browser.switchTo().alert().accept();
+1

Source: https://habr.com/ru/post/1650748/


All Articles