Jump to content

winwait can not find the web popup window


Recommended Posts

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 by temp00
Link to comment
Share on other sites

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

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

@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 finish

The 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

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 finish

The 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

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 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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...