Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/378.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 量角器浏览器.get()未导航到url,出现致命错误异常_Javascript_Angularjs_Node.js_Selenium Webdriver_Protractor - Fatal编程技术网

Javascript 量角器浏览器.get()未导航到url,出现致命错误异常

Javascript 量角器浏览器.get()未导航到url,出现致命错误异常,javascript,angularjs,node.js,selenium-webdriver,protractor,Javascript,Angularjs,Node.js,Selenium Webdriver,Protractor,我正在使用量角器页面对象模型测试一个多页面单页面混合web服务。我正在做的工作是首先在一个非角度的网站上注册一些教师和学生,然后与每个用户登录到一个不同的url并做一些事情。我使用的IDE是Webstorm。注册部分进行得很顺利,但它应该在登录函数中导航到新的url。它抛出了致命错误:调用和重试上次分配失败-进程内存不足我不知道发生了什么,因为登录功能在前几次测试中工作正常(为了清洁,我删除了其他测试用例),有什么建议吗?先谢谢你 这是我的代码片段,应该很简单 describe('sal

我正在使用量角器页面对象模型测试一个多页面单页面混合web服务。我正在做的工作是首先在一个非角度的网站上注册一些教师和学生,然后与每个用户登录到一个不同的url并做一些事情。我使用的IDE是Webstorm。注册部分进行得很顺利,但它应该在登录函数中导航到新的url。它抛出了致命错误:调用和重试上次分配失败-进程内存不足我不知道发生了什么,因为登录功能在前几次测试中工作正常(为了清洁,我删除了其他测试用例),有什么建议吗?先谢谢你

这是我的代码片段,应该很简单

    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);
                    }
                });
            });
        });
这是我的登录功能:

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)造成的吗?我没有在您的代码中看到任何看起来太大的内容(尽管我不确定
isangularite(false)
在做什么)

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

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

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

经过进一步研究,我最终找到了错误的根本原因和解决方案,即,对于非角度,如果将ignoreSynchronization设置为off,则不要使用
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();
    };
}

谢谢你的回复
isAngularSite
不执行任何操作,只将同步设置为关闭
global.isAngularSite=函数(标志){browser.ignoreSynchronization=!flag;},我自己运行了第二个descripe,似乎运行得很好。我试图一个接一个地将节点的内存限制从1 GB增加到8 GB,在某个点(5或6 GB)错误被更改为
致命错误:无效数组长度分配失败-进程内存不足
,除此之外,它仍然抛出相同的异常。还有其他想法吗?如果你想看的话,我很愿意给你看原始代码我现在没主意了。。。测试运行时一定有什么东西在影响你的记忆?!?对不起,我帮不上忙了。