I just find it weird how the Autoit script freezes whenever a Javascript dialog appears. No other programming language I know has this issue. I've tried all these and I still can't get it to work. This is what the AutoIt Window says $TrashCan is the button that is found on the IE page that triggers a javascript alert
_IEAction($TrashCan, "click")
ConsoleWrite("DONE") Is my code, ConsoleWrite never happens until I manually click the close button
But we are talking about this kind of issue: some better example:
; Open a browser with the basic example page, insert an
; event script into the head of the document that creates
; a JavaScript alert when someone clicks on the document
#include <IE.au3>
Local $oIE = _IE_Example("basic")
_IEHeadInsertEventScript($oIE, "document", "onclick", "alert('Someone clicked the document!');")
AdlibRegister('CloseAlert', 1000)