jdelaney Posted December 28, 2012 Share Posted December 28, 2012 (edited) Is there a way to suppress/consume an IE confirmation messages? When I click a <label> element on our internal website, a confirmation message is produced asking for confirmation from the user to delete the record. This message is modal, so until I manually close the message, my script is paused. Edit: Or, is there a way to pass an IE dom object to another script, so it may perform the click? like: $sPID = Run(@AutoItExe & ' /AutoIt3ExecuteLine "msgbox(1,1,IsObj ( ' & $oCell & ') )"') Edit: Or (num2), is there a way to translate the 'uniqueid' back to the dom object through the _ie functions? $s = _IEPropertyGet($oCell,"uniqueid") Short reproducer...notice that the msgbox will not display until you close the confirmation: #include <IE.au3> $oIE = _IECreate () $sForm = "<form>" & @CRLF & _ "<input type=""button"" value=""Press to Confirm""" & @CRLF & _ "onclick=""confirm( 'Did you fill out a 27B/6?' )"">" & @CRLF & _ "</form>" _IEBodyWriteHTML($oIE, $sForm) $oDoc = _IEDocGetObj($oIE) $oCol = $oDoc.getElementsByTagName("input") For $oInput In $oCol ConsoleWrite ($oInput.outerhtml & @CRLF) _IEAction ($oInput, "click") ConsoleWrite ("message from webpage was closed" & @CRLF) Next MsgBox(1,1,$sForm) $oIE.quit Edited December 28, 2012 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
jdelaney Posted December 28, 2012 Author Share Posted December 28, 2012 (edited) found a workaround, but not liking it...calling a second script to do the click #include <IE.au3> $bUseWorkaround = True If $CmdLine[0] = 0 Then $oIE = _IECreate() $sForm = "<form>" & @CRLF & _ "<input type=""button"" value=""Press to Confirm""" & @CRLF & _ "onclick=""confirm( 'Did you fill out a 27B/6?' )"">" & @CRLF & _ "</form>" _IEBodyWriteHTML($oIE, $sForm) $hIE = _IEPropertyGet($oIE, "HWND") If Not $bUseWorkaround Then $oDoc = _IEDocGetObj($oIE) $oCol = $oDoc.getElementsByTagName("input") For $oInput In $oCol ConsoleWrite($oInput.outerhtml & @CRLF) _IEAction($oInput, "click") ; this script will be frozen until the message from browser is closed Next Else Run(@AutoItExe & ' ' & @ScriptFullPath & ' ' & $hIE) EndIf MsgBox(1, 1, "no longer stalled for @autoitPID=" & @AutoItPID) $oIE.quit Else $oIE = _IEAttach(HWnd($CmdLine[1]), "HWND") $oDoc = _IEDocGetObj($oIE) $oCol = $oDoc.getElementsByTagName("input") For $oInput In $oCol ConsoleWrite($oInput.outerhtml & @CRLF) _IEAction($oInput, "click") ; this script will be frozen until the message from browser is closed MsgBox(1, 1, "window closed for @autoitPID=" & @AutoItPID) Next EndIf Edited December 28, 2012 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now