gpt4 book ai didi

protractor - 将目标移出边界 : Failed to read the 'localStorage' property from 'Window' : Access is denied for this document. build

转载 作者:行者123 更新时间:2023-12-05 07:33:16 26 4
gpt4 key购买 nike

afterAll 中抛出了一个错误build 05-Jun-2018 14:32:03 [INFO] AfterAll Failed:将目标移出边界:无法从“Window”读取“localStorage”属性:拒绝访问此文档。build 05-Jun-2018 14:32:03 [INFO]( session 信息:headless chrome=66.0.3359.139)build 05-Jun-2018 14:32:03 [INFO](驱动程序信息:chromedriver=2.36.540471(9c759b81a907e70363c6312294d30b6ccccc2752),平台=Linux 3.10.0-693.21.1.el7.x86_64 x86>_64)

最佳答案

添加try catch。

function lsTest(){
var test = 'test';
try {
localStorage.setItem(test, test);
localStorage.removeItem(test);
return true;
} catch(e) {
return false;
}
}

if(lsTest() === true){
console.log('presente');
}else{
console.log('assente');
}

这将解决问题。

关于protractor - 将目标移出边界 : Failed to read the 'localStorage' property from 'Window' : Access is denied for this document. build,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50702835/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com