量角器和IE11导航问题

时间:2015-01-30 21:47:42

标签: angularjs selenium angular-ui-bootstrap protractor protractor-net

我正在使用Protractor.Net并且在IE上遇到了一个奇怪的问题。我相信这个问题与网站引导有关,但知识不足以弄明白。但是,相同的代码在ChromeFirefox上正常工作。

我在同一页面上执行了两个不同的测试。我的申请是non-angularangualr混合。导航到Angular页面后,第一次测试执行没有任何问题。对于测试需要,我再次导航到相同的url,当我尝试这样做时,它正在破坏。附件也可以在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()));

1 个答案:

答案 0 :(得分:1)

我实际上在项目中发现了一个错误。在URL属性设置器中设置以下行解决了问题!

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;
    }
}