Tampermonkey などの処理で、確認ダイアログ(アラートメッセージ)がポップアップしてきた場合、確認ボタンをJavascript側でクリックするという処理ができない。
調べたところ、その場合は、confirm メソッドをオーバーライドすることで
確認ダイアログをポップアップさせずに、ボタンをクリックさせたことにすることが可能となる。
var realConfirm=window.confirm; window.confirm=function(){ window.confirm=realConfirm; return true; };
参考記事

How to automatically click a confirm box?
My script clicks an image on a site. The image has an anchor href and an onclick href, but the onclick href has a confir...

jquery automatically click message alert - Code Examples & Solutions
var realConfirm=window.confirm;window.confirm=function(){ window.confirm=realConfirm; return true;};