HTML網頁根據座標模擬滑鼠點選

我脑壳疼胸口闷發表於2024-05-20

let target = document.querySelector(".geetest_item_img");
let eventObj = document.createEvent('MouseEvents');
//初始化滑鼠點選事件 https://developer.mozilla.org/zh-CN/docs/Web/API/MouseEvent/initMouseEvent
eventObj.initMouseEvent('click',true,true,window,1,350,685,350,540);


target.dispatchEvent(eventObj);

相關文章