无法将值从一个js文件传递到另一个js文件量角器e2e测试

时间:2015-07-14 16:04:40

标签: javascript angularjs protractor pageobjects

以下是我无法将值从GenericUtil.js返回到homepage.js的代码

我正在尝试使用混合驱动框架实现Page对象。

//GenericUtil.js:

var blnFlag;
GenericUtilities = function(){
    this.objClick = function(objLocator){
        element.all(objLocator).then(function(items) {
            if (items.length == 1) {
                element(objLocator).click();
                blnFlag='True';
                console.log("Inside if" + blnFlag);
            }
            else {
                blnFlag='False';
                console.log("inside else" + blnFlag);
            };
        });
        return blnFlag;
    };
};
module.exports = new GenericUtilities();

//home_page.js:

var blnFlag;
var gu = require("../GenericUtilities/GenericUtil.js");
var home_page = function(){
    this.clickContinue = function(){
        blnFlag = gu.objClick(home_page_obj.btnContinue);
        console.log("After return" + blnFlag );
    };
};
module.exports = new home_page();

//The value is being returned as undefined.

0 个答案:

没有答案