rogergl Posted December 17, 2007 Share Posted December 17, 2007 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 Link to comment Share on other sites More sharing options...
JerryD Posted December 17, 2007 Share Posted December 17, 2007 (edited) 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 December 17, 2007 by JerryD Link to comment Share on other sites More sharing options...
rogergl Posted December 17, 2007 Author Share Posted December 17, 2007 (edited) 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 December 17, 2007 by rogergl Link to comment Share on other sites More sharing options...
JerryD Posted December 17, 2007 Share Posted December 17, 2007 (edited) 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 RogerWinWaitActive 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 parameterRun ( "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 December 17, 2007 by JerryD Link to comment Share on other sites More sharing options...
rogergl Posted December 18, 2007 Author Share Posted December 18, 2007 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 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