dianaManolito Posted February 28, 2007 Share Posted February 28, 2007 hi I cannot manage to press a button in a pop up confirmation box. The confirmation box is generated after making click on a link in a web page ("Are you sure you want to ....? ")My code is :Local $reset $reset=$documentIE.getElementsByTagName("table").item(7).getElementsByTagName("tr").item(1).getElementsByTagName("td").item(4).getElementsByTagName("a").item(0) _IEAction($reset, "click") WinWait("Microsoft Internet Explorer" , "") If Not WinActive("Microsoft Internet Explorer" , "") Then WinActivate("Microsoft Internet Explorer" , "") WinWaitActive("Microsoft Internet Explorer","") EndIf Send("{ENTER}")After the click on the link, the confirmation message appears. Anything after that line (_IEAction($reset, "click")) doesn't work. Entire script is paused until de user makes the choice. i have the following settings :AutoItSetOption("WinTitleMatchMode", 1)AutoItSetOption("WinSearchChildren", 1)The pop up is a simple window, with title "Microsoft Internet Explorer" , the text "are you sure you want to reset the user password?", buttons : OK (button id =1), Cancel (Button ID=2)What am i doing wrong? Link to comment Share on other sites More sharing options...
jefhal Posted February 28, 2007 Share Posted February 28, 2007 (edited) hi I cannot manage to press a button in a pop up confirmation box. The confirmation box is generated after making click on a link in a web page ("Are you sure you want to ....? ")There are a couple of hyperlinks on a Dell website that I have to go to frequently that I can't click on as well. I just use a mouse move to click the object. $realsize = WinGetPos("Dell.com - Login - K-12 Education - Windows Internet Explorer") MouseClick("Left",$realsize[0]+60,$realsize[1]+578) ; 3 and 17 greater than next values MouseClick("Left",$realsize[0]+62,$realsize[1]+565) MouseClick("Left",$realsize[0]+208,$realsize[1]+565) Notice that it does require that you can identify (AutoitInfo) the title of the popup that you are trying to click on. You put that name into the WinGetPos function (above) and adjust the mouse locations according to the actual position of the button. Since Dell likes to move the hyperlink on me, I click on the last three known positions of the hyperlink. Ugly, but it works... Edited February 28, 2007 by jefhal ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format Link to comment Share on other sites More sharing options...
dianaManolito Posted February 28, 2007 Author Share Posted February 28, 2007 no statement is working after i click on that link (THAT IS AFTER THE POP UP APPEARS ), even if the statement is a simple ConsoleWrite ("blah blah blah") ::::::::::::::::::::::: _IEAction($reset, "click") ; ~~~~~~~~~~the confirmation window appears. waiting for user's choice : Ok or Cancel ConsoleWrite ("blah blah blah") ::::::::::::::::::::::: Nothing is displayed. Why is that ? Link to comment Share on other sites More sharing options...
jefhal Posted February 28, 2007 Share Posted February 28, 2007 no statement is working after i click on that link (THAT IS AFTER THE POP UP APPEARS ), even if the statement is a simpleNothing is displayed. Why is that ?Thinking out loud... your main IE window has lost focus and IE is now waiting for a response to the smaller IE popup. Until you respond to the smaller popup, it seems that the main page will do nothing.You might want to try adding an AdLib function to your script that is always looking for a window with the properties of the popup (title, text...) and replies to that window with a controlclick on the OK button on the popup? ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format Link to comment Share on other sites More sharing options...
dianaManolito Posted March 1, 2007 Author Share Posted March 1, 2007 I modified the code like: ...... AdlibEnable("myadlib") Local $reset $reset=$documentIE.getElementsByTagName("table").item(7).getElementsByTagName("tr").item(1).getElementsByTagName("td").item(4).getElementsByTagName("a").item(0) _IEAction($reset, "click") ; pop up appears ...... Func myadlib() If WinActive("Microsoft Internet Explorer" , "") Then send("{ENTER}") else WinActivate("Microsoft Internet Explorer" , "") send("{ENTER}") EndIf EndFunc ................... The link i'm trying to click is : <a id="dgUsers__ctl3_LinkResetPassword" class="navlinkblack" name="LinkResetPassword" onclick="return confirm( 'Are you sure you want to reset user password?');" href="java script:__doPostBack('dgUsers$_ctl3$LinkResetPassword','')"> reset </a> it looks like the script is waiting for something to happen. A Javascript confirm() box comes up that says "Press OK / Cancel". The box does not go away automatically. I'm trying to use AUTOIT to test my applicaiton, and I need to be able to click the OK button in javascript confirmation box. Any help would be appreciated, Diana Link to comment Share on other sites More sharing options...
dianaManolito Posted March 1, 2007 Author Share Posted March 1, 2007 It's working. I used the AdLibEnable , like you suggested, Jefhal. The code looks like : Local $reset $reset=$documentIE.getElementsByTagName("table").item(7).getElementsByTagName("tr").item(1).getElementsByTagName("td").item(4).getElementsByTagName("a").item(0) sleep(1000) _IEAction($reset, "focus") sleep(2000) Send("{ENTER}") sleep(2000) ..... Func myadlib() If ControlFocus("Microsoft Internet Explorer","OK",1) Then ControlClick("Microsoft Internet Explorer", "OK", 1) EndIf EndFunc Thanks, Diana Link to comment Share on other sites More sharing options...
jefhal Posted March 1, 2007 Share Posted March 1, 2007 It's working. I used the AdLibEnable , like you suggested, Jefhal. The code looks like :Glad to be of help guiding you through some of AutoIT's lesser known features... ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format 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