【UI自动化】Chrome控制台延时点击元素

const sleep = (delay) => new Promise((resolve) => setTimeout(resolve, delay))
async function repeatGreetingsLoop() {
  for (let i = 0; i <= 5; i++) {
        await sleep(1000)
        document.getElementsByClassName("el-switch")[0].click();
        await sleep(1000)
        document.getElementsByClassName("el-switch")[0].click();
        await sleep(1000)
        document.getElementsByClassName("el-button el-button--default el-button--small el-button--primary")[0].click();
    }
}
repeatGreetingsLoop()

 

posted @ 2022-03-31 19:59  淡怀  阅读(359)  评论(0编辑  收藏  举报