FillanTroop Posted October 1, 2014 Posted October 1, 2014 Hi guys, My situation is: I am trying to navigate to some page, which immediately displays popup asking for domain credentials. And exactly in that moment script freezes and no luck to find a solution. second example from help >> _IEAction does not work for some reason. Maybe its because there is no page loaded at the moment and therefore I can't use _IEAction focus or _IEGetObjectByName first. Can I ask how you guys are handling this kind of events? I am going to make some automation that will use Excel soon and I expect there will be several situations like that. Is the only solution to run external script that will handle the Popup? If processexists("iexplore.exe") Then Local $Ierun = WinActivate ("Internet Explorer") Sleep (300) Global $IEVIM = _IEAttach ("", "instance",1) Local $hWnd = _IEPropertyGet($IEVIM, "hwnd") Local $oSubmit = _IEGetObjByID ($IEVIM, "40960") ;THIS IS ACTUALLY THE IE TOOLBAR! THERE IS NO OBJECT INSIDE OF THE PAGE :( _IEAction($oSubmit, "focus") _IENavigate ($IEVIM, "http://somedomainapp.com/system.aspx?path=%2fexp") Sleep (3000) WinWait("Windows Security", "", 3) ControlSend("Windows Security", "Cancel", "[CLASS:Edit; INSTANCE:1]", "myPWD") ControlSend("Windows Security", "", "[CLASS:Edit; INSTANCE:2]", "domain\mememe") ControlSend("Windows Security", "", "[CLASS:Edit; INSTANCE:1]", "myPWD") ControlClick("Windows Security", "", "[CLASS:Button; TEXT:OK; Instance:1;]") Sleep (1500) Else Global $IEHUB = _IECreate ("http://somedomainapp.com/system.aspx?path=%2fexp") Sleep (1500) Call ("Login") EndIf Any ideas? Hints? Heeeeelp? :-) Thank you! Filip
Solution jdelaney Posted October 1, 2014 Solution Posted October 1, 2014 The page will never fully load with that message box, I assume. Switch the wait param on _ienavigate to 0. 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.
FillanTroop Posted October 1, 2014 Author Posted October 1, 2014 GENIUS!!!! Thanks a lot! It works! I thought that the script actually execute the command and goes to another line, not that it actually waits for the result. And just for myself to know. Is it true what I found about Pop-ups in general? That sometimes i will need to run external script or there is always a way like the one you just showed to me?
jdelaney Posted October 1, 2014 Posted October 1, 2014 Yes, if a similar message box is present after _ieaction($osomething,"click"), then the _ieaction will not return until after the message box is closed. There are workarounds: _IEaction($oSomething,"focus") And then, controlsend {enter} at the browser. 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.
FillanTroop Posted October 2, 2014 Author Posted October 2, 2014 Great! Thank you again, now it makes perfect sense to me.
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