How to automatically click a confirm box?

后端 未结 1 1174
孤城傲影
孤城傲影 2020-12-13 23:03

My script clicks an image on a site. The image has an anchor href and an onclick href, but the onclick href has a confirm box that pop

相关标签:
1条回答
  • 2020-12-13 23:09

    You can override the confirm method to temporarily silence it and return true. Below example will silence a confirm dialog only once, and only if it's called. Once the silenced dialog is executed, it will restore its original functionality and subsequent call to confirm method will work as normal.

    var realConfirm=window.confirm;
    window.confirm=function(){
      window.confirm=realConfirm;
      return true;
    };
    click(picture element);
    
    0 讨论(0)
提交回复
热议问题