angularjsseleniumangular-ui-bootstrapprotractorprotractor-net

Protractor and IE11 navigation issue


I am using Protractor.Net and having a weird issue with IE. I believe the issue has something to do with the site bootstrapping but not knowledgeable enough to figure it out. However same code works fine on Chrome and Firefox.

There are two different tests I am executing on same page. My application is non-angular and angualr hybrid. After navigating to the Angular page first test executes without any issue. For testing need I navigate to the same url again and when I am trying to do that it's breaking.The attachments are also available at Imgur Imgur Imgur Imgur

 //Navigate and binds the page

 public TestPage TestPage()
 {
     string url = BaseUrl + "/n/Test/TestPage#/";

     //need to handle asyn script call timeout
     Driver.Manage().Timeouts().SetScriptTimeout(TimeSpan.FromSeconds(10));

     NgWebDriver ngDriver = new NgWebDriver(Driver, "[ng-app='Test']");
     ngDriver.Navigate().GoToUrl(url);

     return new TestPage(ngDriver);
 }



// Resume Angular bootstrap this is in URL setter and  fails here on second iteration
this.jsExecutor.ExecuteScript(ClientSideScripts.ResumeAngularBootstrap,
String.Join(",", this.mockModules.Select(m => m.Name).ToArray()));

Solution

  • I actually found a bug in the project. Setting the following line before in URL property setter solves the issue !

    this.driver.Url = "about:blank";
    
     get
    {
        this.WaitForAngular();
        IHasCapabilities hcDriver = this.driver as IHasCapabilities;
        if (hcDriver != null && hcDriver.Capabilities.BrowserName == "internet explorer")
        {
            // 'this.driver.Url' does not work on IE
           //this.driver.Url = "about:blank"; //this is bug fix
            return this.jsExecutor.ExecuteScript(ClientSideScripts.GetLocationAbsUrl, this.rootElement) as string;
        }
        else
        {
            return this.driver.Url;
        }
    }