MathiasRolf Posted 14 hours ago Share Posted 14 hours ago Hello Folks! we try to automate test cases via the UI of a Windows application implemented with Embarcadero Delphi. We are able to click on a tool button on a toolbar of the main form. This creates a new frame instance on the main form inside a page control. Part of that frame is a TBitBtn on a panel in the left lower corner of the frame. AutoIt Info shows it as "[CLASS:TBitBtn; INSTANCE:4]". We have tried to click on that TBitBtn via ControlClick($hWnd, "", "[CLASS:TBitBtn; INSTANCE:4]", "left", 1, 54, 15) where 54,15 is the relative position on the bit button. But the click never happens. TBitBtn = class(TCustomButton) -> TCustomButton = class(TButtonControl) -> TButtonControl = class(TWinControl) is derived from TWinControls and has a Windows handle. Here is the part of the script: Func _DoTask() ; Run Easy Dairy Run("D:\EasyDairy.exe", "") ; Wait for the Easy Dairy to become active. The classname TfrmEDMain is monitored instead of the window title Local $hWnd = WinWaitActive("[CLASS:TfrmEDMain]", "", 2) ; select Cow toolbar button ControlClick($hWnd, "", "[CLASS:TToolBar; INSTANCE:1]", "left", 1, 160, 34) ; click Add Cow ControlClick($hWnd, "", "[CLASS:TBitBtn; INSTANCE:4]", "left", 1, 54, 15) ; this is where the script can not click the button EndFunc How can I get past this hump? Salut, Mathias Link to comment Share on other sites More sharing options...
argumentum Posted 11 hours ago Share Posted 11 hours ago Maybe you can just add it to the database "Master.mdb" ControlClick("Easy Dairy Desktop 2024", "", "[CLASS:TBitBtn; INSTANCE:3]") worked just fine. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Solution MathiasRolf Posted 10 hours ago Author Solution Share Posted 10 hours ago 22 minutes ago, argumentum said: Maybe you can just add it to the database "Master.mdb" ControlClick("Easy Dairy Desktop 2024", "", "[CLASS:TBitBtn; INSTANCE:3]") worked just fine. Hello Argumentum, Thanks for your reply. We want to run test cases against the current release version using MS Access and a version we are working on, which is a migration to SQLite. We had the idea of doing the same scenarios in both versions with the help of AutoIt and then check that both DBs (at least the changed DB tables) are still identical (the MS Access as well as the SQLite). I experimented on this script a little more and it seems I need to give the control clicks some time to complete before doing the next script action. This code starts the application and fills out the add new cow dialogue: ; start Easy Dairy Run("C:\Easy Dairy Automation Systems\Easy Dairy\EasyDairy.exe", "") ; wait for the main form to show up Local $hWnd = WinWaitActive("[CLASS:TfrmEDMain]", "", 2) ; select Cow toolbar button ControlClick($hWnd, "", "[CLASS:TToolBar; INSTANCE:1]", "left", 1, 160, 34) Sleep(50) ; click Add Cow ControlClick($hWnd, "", "[CLASS:TBitBtn; INSTANCE:4]", "left", 1, 54, 15) Sleep(50) ; enter Cow ID Send("99999") Send("{TAB}{TAB}") ; enter Name Send("Test Cow") Send("{TAB}") ; enter Date of Birth Send("010124") Send("{TAB}") ; enter move to Purchase Date Send("{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}") ; enter Purchase Date Send("010524") Send("{TAB}{TAB}") One step at the time. But that is definitely progress. 🙂 Salut, Mathias argumentum 1 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