let time = null
time = setInterval(() => {
if (new Date('2019-04-25 10:00:00').getTime() <= new Date().getTime()) {
clearInterval(time)
if (document.querySelectorAll('.item-holder')[0].querySelector('.td-inner').children[0].innerText === '勾选商品') {
document.querySelectorAll('.J_CheckBoxItem')[0].click()
document.querySelectorAll('.J_CheckBoxItem')[1].click()
setTimeout(() => {
document.querySelector('.submit-btn').click()
}, 500)
}
}else{
window.location.reload()
}
}, 500)
本文介绍了一种使用JavaScript实现的定时任务,该任务检查特定日期是否已过,如果未过则重新加载页面,如果已过则执行点击事件并提交表单。此策略用于自动化网页操作,如抢购或秒杀活动。

被折叠的 条评论
为什么被折叠?



