C#量角器AngularJS IEDriverServer Click()异常“等待页面加载超时". [英] C# Protractor AngularJS IEDriverServer Click() Exception "Timed out waiting for page to load"

查看:105
本文介绍了C#量角器AngularJS IEDriverServer Click()异常“等待页面加载超时".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Protractor来测试我们的AngularJS应用程序(同时使用Chrome和IE驱动程序). IEDriverServer在大多数页面上都可以正常运行,除了这一页之外,在该页面上,几乎所有的Click()事件都将导致等待页面加载超时"例外.

I'm using Protractor to test our AngularJS application (with both Chrome and IE drivers). The IEDriverServer works OK on most pages, except for this one page where pretty much all of the Click() event will result in an exception of "Timed out waiting for page to load."

IE驱动程序选项设置如下:

The IE driver options are set as follows:

var ieOptions = new InternetExplorerOptions
{
    BrowserCommandLineArguments = "-private",
    EnableNativeEvents = false,
    IgnoreZoomLevel = true,
    IntroduceInstabilityByIgnoringProtectedModeSettings = false
};

// No Proxy
var proxy = new Proxy()
{
    Kind = ProxyKind.Direct
};

ieOptions.Proxy = proxy;

另外,IgnoreSynchronization = true.

Also, IgnoreSynchronization = true.

我认为此页面与其他页面之间的区别在于它对Javascript SignalR的使用.我在其他页面的头部没有找到此代码.这是否可能是超时异常的原因,我该怎么做才能使其正常工作?

Edited 1: I think the difference between this page and others is its use of Javascript SignalR. I find this code in its head section that is not in the other pages. Can this be the cause of the timeout exceptions and what can I do to make it work?

<script src="https://localhost:37121/signalr/poll?transport=longPolling&amp;connectionToken=AQAAANCMnd8BFdERjHoAwE%2FCl%2BsBAAAAUwalDb1qVUqsBmCLuURNHwAAAAACAAAAAAADZgAAwAAAABAAAADr9g2GQVKvK1pb%2FivxTu%2BBAAAAAASAAACgAAAAEAAAAB5eAALolT7EtoL1Y9C1xPooAAAA3TnUmbajNM9RIJ8oDRsPGLjavLcB2M10CyoJMXrnpv9H9XzB4bRVLBQAAABrEcirF0pjR5t%2Fst0mWJ0MnJYVlA%3D%3D&amp;messageId=d-9774B3D8-B%2C24%7CC%2C0%7CD%2C0%7CE%2C0&amp;connectionData=%5B%7B%22name%22%3A%22devicehub%22%7D%5D&amp;tid=8&amp;callback=jQuery21103819021041958953_1481549049341&amp;_=1481549049371" async=""></script>

将ImplicitWait,SetPageLoadTimeout和SetScriptTimeout设置为多长时间都没关系.在指定的等待时间过去之后,点击事件将异常返回.

Edit 2: It doesn't matter how long I set the ImplicitWait, SetPageLoadTimeout, and SetScriptTimeout to be. The click events will return with an exception after the specified wait time has elapsed.

推荐答案

我遇到了这个问题,我发现的唯一解决方案是使SignalR与需要IIS8的WebSocket一起使用.在我的情况下,SignalR与Long Polling一起使用,后者使连接长时间保持打开状态.即使您增加超时时间,这也会使您的测试缓慢得令人无法接受.请参阅:带Web套接字的SignalR

I have had this issue and only solution I found was to make SignalR work with WebSockets, which requires IIS8. In my case SignalR was working with Long Polling, which keep a connection open for a long time. Even if you increase the timeout this will make your tests unacceptably slow. See: SignalR w/ Web Sockets

这篇关于C#量角器AngularJS IEDriverServer Click()异常“等待页面加载超时".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆