Angularjs   发布时间:2022-04-20  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了angularjs – 加载角度SPA时的org.openqa.selenium.TimeoutException大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在使用 chimp.js,它增强了webdriver.io的一些纤维魔力,以便代码可以同步方式定义.这是代码
var c = require('./config');

module.exports = function () {
    this.When(/^I try to login with wrong credentials$/,function () {
        browser.SETVALue(userNameField,wrongUser);
        browser.SETVALue(passwordField,wrongpassword);
        browser.click('button[value="Login"]');
    });
    this.When(/^I try to login with the correct credentials$/,c.username);
        browser.SETVALue(passwordField,c.password);
        console.log('before pressig the button');
        browser.click('button[value="Login"]');
        console.log('logged in');
    });
};

第一次执行时很好.第二个也工作时,我只是没有看到

在控制台上.两者都在同一个网站上运行,并且都点击了同一个按钮.在第二种情况下,登录成功后,浏览器将重定向到角度SPA.这里的一切都正确加载,但就是这样.回调永远不会发生.

用–debug –log =命令运行测试我看到这是最后一行(在超时之前)

[1;30m[01:30:18]: [0m [0;35mCOMMAND [0mPOST      "/wd/hub/session/7c334efe-2417-4184-b43c-082ba4441291/element/11/click"

将日志级别切换为详细,并等待〜5min我收到以下错误

[chimp][SELEnium.stderr] 01:36:59.561 DEBUG - Executed: [0560aaa14e4cf874afd72336c19e299b,clickElement {id=0.6384125368203968-3}]

[chimp][SELEnium.stderr] 01:37:02.449 WARN - Exception thrown
org.openqa.SELEnium.TimeoutException: timeout: Timed out receiving message from renderer: 10.000
  (Session info: chrome=47.0.2526.73)
  (Driver info: chromedriver=2.19.346063 (38b35413bd4a486d436a9749e090454bc9ff6708),platform=Mac OS X 10.11.0 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 310.12 seconds
Build info: version: '2.47.1',revision: '411b314',time: '2015-07-30 03:03:16'
System info: host: '<host_name>',ip: '<IP_ADDRESS>',os.name: 'Mac OS X',os.arch: 'x86_64',os.version: '10.11',java.version: '1.8.0_20'
Driver info: org.openqa.SELEnium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false,rotatable=false,mobileEmulationEnabled=false,chrome={userDataDir=/var/folders/nc/3cdxbvwj44j_gk1qj24mbr5w0000gn/T/.org.chromium.Chromium.1n3kHD},takesHeapSnapshot=true,databaseEnabled=false,handleSALErts=true,hasTouchScreen=false,version=47.0.2526.73,platform=MAC,browserConnectionEnabled=false,nativeEvents=true,acceptSslCerts=true,LOCATIOnContextEnabled=true,webStorageEnabled=true,browserName=chrome,takesScreenshot=true,javascriptEnabled=true,cssSELEctorsEnabled=truE}]
Session ID: 0560aaa14e4cf874afd72336c19e299b
  at sun.reflect.NativeConstructOraccessorImpl.newInstance0(Native Method)
  at sun.reflect.NativeConstructOraccessorImpl.newInstance(NativeConstructOraccessorImpl.java:62)
  at sun.reflect.DelegaTingConstructOraccessorImpl.newInstance(DelegaTingConstructOraccessorImpl.java:45)
  at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
  at org.openqa.SELEnium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
  at org.openqa.SELEnium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
  at org.openqa.SELEnium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:595)
  at org.openqa.SELEnium.remote.RemoteWebElement.execute(RemoteWebElement.java:273)
  at org.openqa.SELEnium.remote.RemoteWebElement.click(RemoteWebElement.java:84)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegaTingMethodAccessorImpl.invoke(DelegaTingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:483)
  at org.openqa.SELEnium.support.events.EventFiringWebDriver$EventFiringWebElement$1.invoke(EventFiringWebDriver.java:332)
  at com.sun.proxy.$Proxy3.click(UnkNown sourcE)
  at org.openqa.SELEnium.support.events.EventFiringWebDriver$EventFiringWebElement.click(EventFiringWebDriver.java:345)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegaTingMethodAccessorImpl.invoke(DelegaTingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:483)
  at org.openqa.SELEnium.remote.server.KNownElements$1.invoke(KNownElements.java:64)
  at com.sun.proxy.$Proxy2.click(UnkNown sourcE)
  at org.openqa.SELEnium.remote.server.handler.ClickElement.call(ClickElement.java:30)
  at org.openqa.SELEnium.remote.server.handler.ClickElement.call(ClickElement.java:1)
  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  at org.openqa.SELEnium.remote.server.DefaultSession$1.run(DefaultSession.java:176)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  at java.lang.Thread.run(Thread.java:745)

[chimp][SELEnium.stderr] 01:37:02.458 WARN - Exception: timeout: Timed out receiving message from renderer: 10.000
  (Session info: chrome=47.0.2526.73)
  (Driver info: chromedriver=2.19.346063 (38b35413bd4a486d436a9749e090454bc9ff6708),cssSELEctorsEnabled=truE}]
Session ID: 0560aaa14e4cf874afd72336c19e299b

[chimp][SELEnium.stderr] 01:37:02.471 DEBUG - Finished: POST /session/e103e58b-7ac9-4c8d-8f65-1f60295231d9/element/11/click

对于要加载的SPA的第一页,要初始化的数据,…(铬停止显示页面正在加载)平均需要3-7秒.超时设置为10秒,所以我想增加它,通过

@H_613_1@module.exports = function () { this.beforeScenario(function () { browser.timeout('script',60 * 1000); browser.timeout('page load',60 * 1000); }); };

但这也没有帮助.知道我能做什么/尝试?

只是为了再次澄清 – 登录页面一个简单的静态服务器端呈现HTMl.用户登录后,会将其重定向到SPA,该SPA基于Angular 1.4.按下具有错误凭据的登录按钮可能会起作用,因为我没有被重定向到SPA,而是返回到登录页面.

所有测试都在Chrome OS中运行,在Mac OS X El Capitan上运行

更新:

现在它工作了一次.之后我注意到,当我重新加载网站时,脚本会继续运行,以防它被卡住.

这里的页面以这种方式工作:

访问/页面并初始化角度
> ui-router路由到#/ defaultroute
>控制器初始化并下载一些初始数据
>新控制器在Ng-repeat中初始化并下载更多数据

所以是的,它有相当多的数据下载并等待整个页面显示出来.也许这会给chimp.js或webdriver.io带来麻烦?

当然,从browser.click切换(…); to browser.key([‘Enter’]);也不起作用.卡住和重新加载浏览器的相同问题修复了它.似乎silenium可能没有得到页面实际完成加载.这就是重新加载页面的原因.知道怎么解决这个问题吗?

便说一句,我也提出了一个问题:https://github.com/xolvio/chimp/issues/165

更新2:

在Firefox和PhantomJS中它起作用,Safari根本不运行.

也许在这一点上我只想知道错误在哪里,如果它是一个已知的bug,…

@H_301_55@ 我将采取什么措施来缩小问题范围:

>单独运行单个失败测试(确保其他测试不会以某种方式影响)>通过按钮单击直接访问失败测试最终(重定向)URl.例如(smth like browser.get(‘#/ defaultroute’));>检查角度页面是否不进行轮询(连续setTimeout,interval),这可能被视为未加载/同步的页面(怀疑它是因为它适用于刷新)

大佬总结

以上是大佬教程为你收集整理的angularjs – 加载角度SPA时的org.openqa.selenium.TimeoutException全部内容,希望文章能够帮你解决angularjs – 加载角度SPA时的org.openqa.selenium.TimeoutException所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。