Jump to content
Sign in to follow this  
rogergl

Problem with WinWaitActive

Recommended Posts

I'm trying to write some automated GUI test for our Delphi applications. The simplest script looks like this:

Run("e:\querfassen.exe")

WinWaitActive("Daten erfassen")

Send("{DOWN}")

Send("{DOWN}")

MouseClick("left", 760,452, 1)

MouseClick("left", 984,721, 1)

WinWaitActive('Ausgang', ' ')

Send("10.10.2006")

The problem is, that the window with the title 'Ausgang' is a modal window wich WinWaitActive doesn't seem to recognize.

I used the Window Info Tool which displayed alle required informations as expected.

Any ideas what I'm doing wrong ?

Regards

Roger

Share this post


Link to post
Share on other sites

I hate SEND and use it only as a last resort.

ControlSend and ControlClick are much more reliable. Use AutoIt Window Info to discover the controlID information and try something like this:

Run ( "e:\querfassen.exe" )
WinWait ( "Daten erfassen" )
ControlSend ( "Daten erfassen", "", controlID, "{DOWN 2}")
ControlClick ( "Daten erfassen", "", controlID )
ControlClick ( "Daten erfassen", "", controlID )
WinWait ( "Ausgang" )
ControlSend ( "Ausgang", "", controlID, "10.10.2006" )

ControlClick and ControlSend don't depend on a window being active the way Send does!

Edited by JerryD

Share this post


Link to post
Share on other sites

Hi !

Thanks for the answer. But the problem is not the send but the WinWaitActive function. I need no know if the window with the title 'Auftrag' appears within 2 seconds. If it doesn't the GUI test should fail

Regards

Roger

Edited by rogergl

Share this post


Link to post
Share on other sites

Hi !

Thanks for the answer. But the problem is not the send but the WinWaitActive function. I need no know if the window with the title 'Auftrag' appears within 2 seconds. If it doesn't the GUI test should fail

Regards

Roger

WinWaitActive will only come back if the window is ACTIVE (in the foregroung). If you're just interested in whether or not the window appears (active or inactive) within 2 seconds, then use the Timeout parameter
Run ( "e:\querfassen.exe" )
$Ret = WinWait ( "Daten erfassen", "", 2 )
If $Ret = 1 Then
    ControlSend ( "Daten erfassen", "", controlID, "{DOWN 2}")
    ControlClick ( "Daten erfassen", "", controlID )
    ControlClick ( "Daten erfassen", "", controlID )
EndIf
$Ret = WinWait ( "Ausgang", "", 2 )
If $Ret = 1 Then
    ControlSend ( "Ausgang", "", controlID, "10.10.2006" )
EndIf

The parameter is also available for WinWaitActive, but remember that WinWaitActive will only return true if the window is active, and Send will only work on the active window.

Edited by JerryD

Share this post


Link to post
Share on other sites

Hi,

Thanks for your help. It's working now. Part of the problem was, that WinWaitActive doesn't seem to work when some german characters like 'รค' are part of the window title.

Regards

Roger

Share this post


Link to post
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
Sign in to follow this  

×
×
  • Create New...