temp00 Posted April 27, 2013 Share Posted April 27, 2013 (edited) I'm using AutoIt to handle a login webpage, when "Logout" is clicked, a popup window appears, but winwait() can not find this window #include<IE.au3> Local $IE, $Form1 $IE=_IECreate("http://210.77.16.29/indexE.html", 0,1,1,1); $Form1=_IEFormGetObjByName($IE, "form1") _IELinkClickByText($Form1, "Logout") WinWait("Message from webpage") Msgbox(1, "Info", "Popup window found“) The script just waited and waited... The above code has been tested on Win7 64 and WinXP 32, just not working. Anybody knows why? Edited April 27, 2013 by temp00 Link to comment Share on other sites More sharing options...
temp00 Posted April 28, 2013 Author Share Posted April 28, 2013 OK, I tried tons of methods, and it turned out the whole script would hang after "_IELinkClickByText($Form1, "Logout")" no matter what command following.I've to manually click the popup's "OK" button, then the script will continue.So, any solution? Link to comment Share on other sites More sharing options...
junkew Posted April 28, 2013 Share Posted April 28, 2013 I would say just before you click start a second autoitscript that only handles that specific button to click probably not the most elegant solution but should work FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
Bowmore Posted April 28, 2013 Share Posted April 28, 2013 Have you tried this? It works for me. #include<IE.au3> Local $IE, $Form1 $IE=_IECreate("http://210.77.16.29/indexE.html", 0,1,1,1); _IELoadWait($IE) $Form1=_IEFormGetObjByName($IE, "form1") $ret = _IELinkClickByText($Form1, "Logout") WinWait("Message from we") Msgbox(1, "Info", "Popup window found") "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook Link to comment Share on other sites More sharing options...
junkew Posted April 28, 2013 Share Posted April 28, 2013 or check this thread FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
temp00 Posted May 2, 2013 Author Share Posted May 2, 2013 To Bowmore: I tried your code and no luck. The only difference between your code and mine is the "title" parameter for winwait(). To junkew: I followed that thread, and still no luck. The winwait() function just hung the script. According to my test, I suspect this might be a bug of AutoIt, because the same script occasionally worked (not working for most of the time), My environment is Win7 64+IE10 and WinXP 32+IE8 Link to comment Share on other sites More sharing options...
MouseSpotter Posted May 2, 2013 Share Posted May 2, 2013 @temp00: there is nothing wrong with AutoIt - no single threaded program will be able to catch the popup.If you look at the webpage's link ... it has <a onclick="force_logout();return false;" href="#">The COM object sends the click to the link ... then waits for the click event to finishThe click event lasts until force_logout returns.force_logout waits for the user to answer the message (OK,cancel)So AutoIt also waits.My solution would be to run a second script that waits for the message (maybe just before you do the click) - this clicks the message for you and exits. The click event completes, your above autoit script continues (no need for the WinWait) temp00 1 Link to comment Share on other sites More sharing options...
temp00 Posted May 2, 2013 Author Share Posted May 2, 2013 Great! I'm not familiar with Web coding, thanks MouseSpotter, now I have the answer!@temp00: there is nothing wrong with AutoIt - no single threaded program will be able to catch the popup.If you look at the webpage's link ... it has <a onclick="force_logout();return false;" href="#">The COM object sends the click to the link ... then waits for the click event to finishThe click event lasts until force_logout returns.force_logout waits for the user to answer the message (OK,cancel)So AutoIt also waits.My solution would be to run a second script that waits for the message (maybe just before you do the click) - this clicks the message for you and exits. The click event completes, your above autoit script continues (no need for the WinWait) Link to comment Share on other sites More sharing options...
Bowmore Posted May 2, 2013 Share Posted May 2, 2013 (edited) To Bowmore: I tried your code and no luck. The only difference between your code and mine is the "title" parameter for winwait(). You did not look at my code very closely then. The code I wrote works every time with the URL you supplied. Did you ignore this line? _IELoadWait($IE) Edited May 2, 2013 by Bowmore "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook Link to comment Share on other sites More sharing options...
temp00 Posted May 3, 2013 Author Share Posted May 3, 2013 You did not look at my code very closely then. The code I wrote works every time with the URL you supplied. Did you ignore this line? _IELoadWait($IE) Yes I noticed that line, and it didn't work for me--It's kind of strange that occasionally the code would capture the popup window (this is not stable), so I'm confused~ 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