Sio*_*n C 6 javascript selenium google-chrome chromium qjsengine
我试图愚弄这个特定的代码:
<!DOCTYPE html>
<html>
<body>
<p>Click anywhere in the document (the right frame) to get focus. If you click outside the document, it will lose focus.</p>
<p id="demo"></p>
<script>
setInterval("myFunction()", 1);
function myFunction() {
var x = document.getElementById("demo");
if (document.hasFocus()) {
x.innerHTML = "The document has focus.";
} else {
x.innerHTML = "The document DOES NOT have focus.";
}
}
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
因此,即使我不是 Chrome 中的前台应用程序,它也会返回 True。我想到的解决方案:
以某种方式使用硒?
在 chrome JS 引擎或铬中编译新的 hasFocus() 方法?总是返回 True。
尝试这个
document.__proto__.hasFocus = function() {return true}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
349 次 |
最近记录: |