量角器和IE11的导航问题

量角器和IE11的导航问题

本文介绍了量角器和IE11的导航问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用并具有IE浏览器一个奇怪的问题。我相信这个问题有什么做的网站引导,但没有足够的知识来弄明白。但是同样的code正常工作的火狐

有我同一页上执行两个不同的测试。我的应用程序是无棱角 angualr 混合。导航到角页面后第一次测试的执行没有任何问题。为了测试我需要浏览到同一网​​址一次当我尝试这样做,它的breaking.The附件,也可在的


  //浏览并绑定页面 公共TestPage TestPage()
 {
     字符串的URL = BASEURL +/ N /测试/ TestPage#/;     //需要处理ASYN脚本调用超时
     。Driver.Manage()超时()SetScriptTimeout(TimeSpan.FromSeconds(10));     NgWebDriver ngDriver =新NgWebDriver(驱动程序[NG-应用='测试']);
     。ngDriver.Navigate()GoToUrl(URL);     返回新TestPage(ngDriver);
 }//恢复角引导这是URL setter和失败在这里第二次迭代
this.jsExecutor.ExecuteScript(ClientSideScripts.ResumeAngularBootstrap,
的string.join(,,this.mockModules.Select(M => m.Name).ToArray()));


解决方案

我居然发现在该项目中的错误。在之前设置以下行网址属性setter解决的问题!

  this.driver.Url =有关:空白; 得到
{
    this.WaitForAngular();
    IHasCapabilities hcDriver = this.driver为IHasCapabilities;
    如果(hcDriver = NULL&放大器;!&安培; hcDriver.Capabilities.BrowserName ==Internet Explorer的)
    {
        //'this.driver.Url不能在IE浏览器
       //this.driver.Url =有关:空白; //这是错误修复
        返回this.jsExecutor.ExecuteScript(ClientSideScripts.GetLocationAbsUrl,this.rootElement)的字符串;
    }
    其他
    {
        返回this.driver.Url;
    }
}

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 ImgurImgurImgurImgur

 //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()));
解决方案

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

这篇关于量角器和IE11的导航问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 22:14