📜  自动点击脚本 - Html 代码示例

📅  最后修改于: 2022-03-11 14:53:23.330000             🧑  作者: Mango

代码示例1
var clickMe = document.getElementById('clickMe');

clickMe.addEventListener('click', function() {
  console.log('I was clicked');
}, true);

setTimeout(function() {
  var event = new MouseEvent('click'),
    canceled = !clickMe.dispatchEvent(event);

  if (canceled) {
    console.log('Click event was canceled');
  }
}, 5000);