我试图将browser.executeScript的值存储在我的块中的局部变量中但是在所有情况下我都无法将其显示为null.
到目前为止,我已尝试过很多方法
browser.executeScript('$("#txtName").css("border-left-color");').then(function (color) {
console.log("This is color" + color);
});
Run Code Online (Sandbox Code Playgroud)
还有这个
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;
}
Run Code Online (Sandbox Code Playgroud)
我在我的规范中使用这个
iit('', function() {
browser.executeScript('$("#txtName").css("border-left-color");').then(function (color) {
console.log("This is color" + color);
});
returnColor();
});
Run Code Online (Sandbox Code Playgroud)
真的会告诉我有人可以告诉我如何正确地做到这一点吗?