4
我想存儲在我的塊中的局部變量browser.executeScript的值,但我不能這樣做在所有情況下它顯示爲空。量角器 - 如何將browser.execute腳本的值存儲在varriable中?
我已經嘗試了很多方法至今
browser.executeScript('$("#txtName").css("border-left-color");').then(function (color) {
console.log("This is color" + color);
});
而且這個
function returnColor()
{
var a = browser.executeScript('$("#txtName").css("border-left-color");');
return a;
}
function getColorCode()
{
var a = returnColor().then(function(list){
console.log("Output is ***************" + list);
return list;
});
return a;
}
我使用這個我的規格內的
iit('', function() {
browser.executeScript('$("#txtName").css("border-left-color");').then(function (color) {
console.log("This is color" + color);
});
returnColor();
});
真的會appreaciate也有人能告訴我如何正確地做到這一點?