Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Commit

Permalink
fix(navigation): ignore unknown JS errors when looking for the URL
Browse files Browse the repository at this point in the history
This should address #841

Ignoring the error and trying again has worked for all of my test cases,
and the error has never occurred more than once in a row.
  • Loading branch information
juliemr committed May 22, 2014
1 parent d05324e commit 0500b2c
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions lib/protractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -907,9 +907,21 @@ Protractor.prototype.get = function(destination, opt_timeout) {
// At this point, we need to make sure the new url has loaded before
// we try to execute any asynchronous scripts.
this.driver.wait(function() {
return self.driver.executeScript('return window.location.href;').then(function(url) {
return url !== 'about:blank';
});
return self.driver.executeScript('return window.location.href;').
then(function(url) {
return url !== 'about:blank';
}, function(err) {
if (err.code == 13) {
// Ignore the error, and continue trying. This is because IE
// driver sometimes (~1%) will throw an unknown error from this
// execution. See https://github.com/angular/protractor/issues/841
// This shouldn't mask errors because it will fail with the timeout
// anyway.
return false;
} else {
throw err;
}
});
}, timeout * 1000, 'Timed out waiting for page to load');

var assertAngularOnPage = function(arr) {
Expand Down

1 comment on commit 0500b2c

@elgalu
Copy link
Contributor

@elgalu elgalu commented on 0500b2c May 22, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!!

Please sign in to comment.