function simulateMouseDown(target, options) {
var event = new MouseEvent('mousedown', options);
target.dispatchEvent(event);
}
function simulateMouseMove(target, options) {
var event = new MouseEvent('mousemove', options);
target.dispatchEvent(event);
}
function simulateMouseUp(target, options) {
var event = new MouseEvent('mouseup', options);
target.dispatchEvent(event);
}
function checkForSliderVerification() {
// 假设滑动验证码有一个特定的class或id
const slider = document.querySelector('.btn_slide');
if (slider) {
simulateMouseDown(slider, {
view: window,
bubbles: true,
cancelable: true
});
simulateMouseMove(slider, {
view: window,
bubbles: true,
cancelable: true
});
simulateMouseUp(slider, {
view: window,
bubbles: true,
cancelable: true
});
#移动滑块
}
}
// 监听页面加载完成
document.addEventListener('DOMContentLoaded', (event) => {
// 每隔一段时间检查是否出现滑动验证码
setInterval(checkForSliderVerification, 2000);
});