首页 > 解决方案 > javascript setTimeout - 在 chrome 控制台中不起作用

问题描述

我想点击网页上的所有对象。在谷歌浏览器控制台中使用脚本。但我想在每次点击后等待片刻。

以下脚本有效,但一切都会立即发生,不会有任何延迟。如何编写脚本以使延迟起作用?

javascript:var inputs = document.getElementsByClassName('_54k8 _56bs _56bt');
 for(var i=0; i<inputs.length;i++) {
   setTimeout(  inputs[i].click() , 6000);
}
174
ErrorUtils caught an error: "Function.prototype.apply was called on undefined, which is a undefined and no...". Subsequent errors won't be logged; see https://fburl.com/debugjs.

截屏

标签: javascriptgoogle-chromesettimeoutjconsole

解决方案


推荐阅读