self.getDocumentCount().then(function (text) {
var stringArray = text.split("(");
count = stringArray[0].trim();
}).then(function () {
self.logger.info("Document text : " + count, self);
});
self.logger.info("Checking the count again : " + count, self);
I am not able to get value outside promise . ie the last count variable in code snippet
I am using protractor+javascript+jasmine
Have you tried this?
var tempObject = {}
it('should get count', function() {
getDocumentCount(strDoc);
});
it('should display count', function() {
console.log(tempObject.Count);
});
function = getDocumentCount(text) {
var stringArray = text.split("(");
tempObject.Count = stringArray[0].trim();
})
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.