简体   繁体   中英

How can I listen for an alert popup and then automatically click ok when it pops up in javascript?

I would like to write a quick script that listens out for any alert popup, and then selects the 'OK' option once the alert pops up. However, I can't find any tutorials or documentation on listening for alerts. Is it possible to do this in Javascript?

You can't close three of javascript popups: alert(), prompt() and confirm() as they block JavaScript execution on page. Only user can close them or answer them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM