In my protractor app, I have the below method which is supposed to return boolean
value, depending if it finds the element or not.
async getTheValueOfEntery(entery: string) {
var value = await element(by.xpath(entery))
.isPresent().then((isExist) => {
isExist;
});
return value;
}
But, the problem is, it always rerturns undefined
, although i am sure, it should return true
.
So, what is wrong in my method?
Update:
Indeed, i need to have a chain of calling, fat functions, so the most complete version of my function is as below:
async getTheValueOfEntery(entery: string) {
var value = await element(by.xpath(entery))
.isPresent().then((isExist, entery: string) => {
isExist ? element(by.xpath(entery)).getText() : 0;
});
return value;
}
But, i am not able to pass entery:string
to the second lambda.