以下是我无法将值从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.