約束を解決したら、範囲外の値を渡すことができません。 こちらのコードを確認してください。範囲外の約束で解決された値にアクセスする方法
var FullName;
async.series([
function(callback) {
var name = element(by.css('.xyz')).getText().then(function(text) {
console.log("print name" + text);
FullName = text;
console.log("Able to print successfully" + FullName);
});
console.log("Unable to print the name outside" + FullName);
callback();
},
function(callback) {
//I want to retrieve the FullName value to this function.
//but unable to bring the value to this function
console.log("Unable to print the name on the second function too" + FullName)
callback();
}
], function(err) {
done();
})
と同等です:[どのように私は非同期呼び出しからの応答を返さない](https://stackoverflow.com/questions/14220321/how-do-i非同期呼び出しからの応答)。 – jfriend00
'async'ライブラリと約束を混ぜるのは、一般的に混乱です。あなたの基礎となる操作が既に(ここにあるように見える)約束を使用している場合は、非同期ライブラリではなく、フロー制御用の約束を使用してください。 – jfriend00