量angular器browser.get()不导致URL与致命错误exception

我正在使用“量angular器页面对象”模型来testing多页单页混合Web服务。 我正在做的工作是首先在一个非angular度的网站上注册一些教师和学生,然后login到每个用户不同的url和做的东西。 我使用的IDE是Webstorm。 注册部分进展顺利,但当它应该导航到loginfunction中的新url。 它扔了致命错误:CALL_AND_RETRY_LAST分配失败 – 进程内存不足我不知道发生了什么,因为loginfunction在前几个testing中工作正常(我删除了其他testing用例的清洁),有什么build议吗? 先谢谢你。

这里是我的代码片断,应该是非常简单的。

describe('saltare registration test', function () { var url,username = 'xxx',password = 'xxx'; describe('instructor and student registration', function () { beforeEach(function () { isAngularSite(false); url = 'https://prod-cn.saltare.pearson-intl.com/batch_reg/batches/'; common.login(url, username, password); }); it('instructor register via saltare', function () { saltare.updateUsers('instructor', 2); }); }); describe('instructor and student setup', function () { beforeEach(function () { isAngularSite(false); url = 'http://www.myieltslab.com/'; password = 'xxx'; }); it('instructor setup personal profile', function () { common.login(url, username, password); } }); }); }); 

这是我的loginfunction:

 var common = function(){ this.login = function(url, username, password){ console.log('in function login:'+url+' '+username+' '+password); //browser.driver.nstrong textavigate().to(url); browser.get(url); browser.driver.manage().window().maximize(); element(common_objects.USERNAME).sendKeys(username); element(common_objects.PASSWORD).sendKeys(password); element(common_objects.SUBMIT).click(); }; } 

这是控制台日志和错误消息

 Using the selenium server at http://localhost:4444/wd/hub [launcher] Running 1 instances of WebDriver Started in function:https://prod-cn.saltare.pearson-intl.com/batch_reg/batches/ xxx xxx in function:https://prod-cn.saltare.pearson-intl.com/batch_reg/batches/ xxx xxx in function:http://www.myieltslab.com/ xxx xxx FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory Process finished with exit code -1073740791 (0xC0000409) 

谷歌说 ,这个错误是由于超过节点(这是512MB),由于使用大型数据文件的默认成员限制? 我没有看到你的代码中看起来太大了(尽pipe我不确定是什么是isAngularSite(false)正在做什么)。

我会尝试运行最后的描述,看看是否自己失败(我猜不是)。 在这一点上,很难说没有看到代码。

如果失败,请尝试增加节点的内存限制:

 node --max-old-space-size=1024 my-node-script.js 

经过多次研究,我最终find了错误的根源和解决方法,对于非angular度来说,如果closuresignoreSynchronization,不要使用element() ,而应该使用Webdriver的browser.driver.findElement() 。 这解决了所有的问题。

这是工作代码,

 var common = function(){ this.login = function(url, username, password){ console.log('in function login:'+url+' '+username+' '+password); browser.driver.get(url); browser.driver.manage().window().maximize(); browser.driver.findElement(common_objects.USERNAME).sendKeys(username); browser.driver.findElement(common_objects.PASSWORD).sendKeys(password); browser.driver.findElement(common_objects.SUBMIT).click(); }; }