@@ -553,6 +553,8 @@ Protractor.prototype.clearMockModules = function() {
553
553
*/
554
554
Protractor . prototype . get = function ( destination , opt_timeout ) {
555
555
var timeout = opt_timeout || 10 ;
556
+ var self = this ;
557
+
556
558
destination = url . resolve ( this . baseUrl , destination ) ;
557
559
558
560
if ( this . ignoreSynchronization ) {
@@ -562,7 +564,15 @@ Protractor.prototype.get = function(destination, opt_timeout) {
562
564
this . driver . get ( 'about:blank' ) ;
563
565
this . driver . executeScript (
564
566
'window.name = "' + DEFER_LABEL + '" + window.name;' +
565
- 'window.location.href = "' + destination + '"' ) ;
567
+ 'window.location.assign("' + destination + '");' ) ;
568
+
569
+ // At this point, we need to make sure the new url has loaded before
570
+ // we try to execute any asynchronous scripts.
571
+ this . driver . wait ( function ( ) {
572
+ return self . driver . getCurrentUrl ( ) . then ( function ( url ) {
573
+ return url !== 'about:blank' ;
574
+ } ) ;
575
+ } , 300 ) ;
566
576
567
577
var assertAngularOnPage = function ( arr ) {
568
578
var hasAngular = arr [ 0 ] ;
@@ -574,24 +584,10 @@ Protractor.prototype.get = function(destination, opt_timeout) {
574
584
} ;
575
585
576
586
// Make sure the page is an Angular page.
577
- var self = this ;
587
+
578
588
self . driver . executeAsyncScript ( clientSideScripts . testForAngular , timeout ) .
579
589
then ( assertAngularOnPage , function ( err ) {
580
- if ( / r e l o a d d e t e c t e d d u r i n g a s y n c s c r i p t / . test ( err . message ) ) {
581
- // Sometimes IE will fail to run scripts right after a location change.
582
- // Let's try it once more.
583
- self . driver . executeAsyncScript (
584
- clientSideScripts . testForAngular , timeout ) .
585
- then ( assertAngularOnPage , function ( err ) {
586
- if ( / r e l o a d d e t e c t e d d u r i n g a s y n c s c r i p t / . test ( err . message ) ) {
587
- throw 'Persistent async reload interrupt problem: ' + err . message ;
588
- } else {
589
- throw 'Error while running testForAngular: ' + err . message ;
590
- }
591
- } ) ;
592
- } else {
593
- throw 'Error while running testForAngular: ' + err . message ;
594
- }
590
+ throw 'Error while running testForAngular: ' + err . message ;
595
591
} ) ;
596
592
597
593
// At this point, Angular will pause for us, until angular.resumeBootstrap
0 commit comments