shakeel Posted January 14, 2020 Posted January 14, 2020 I am testing a desktop application developed in .NET. I am using "Au3Record" to record my testing scenario. The events are recorded successfully. Script is generated. When i re run the script, it skips few events or just simply stuck on few events. e.g. i opened a drop down list and selected an option from list. when i re run the script, the drop down never opens and hence the selection part is also not performed. Then i tried to open a simple PDF document provided in application. The re execution of scripts does not perform this task as well. I am sharing the code for reference purpose: 꿨#region --- Au3Recorder generated code Start (v3.3.9.5 KeyboardLayout=00000409) --- #region --- Internal functions Au3Recorder Start --- Func _Au3RecordSetup() Opt('WinWaitDelay',100) Opt('WinDetectHiddenText',1) Opt('MouseCoordMode',0) Local $aResult = DllCall('User32.dll', 'int', 'GetKeyboardLayoutNameW', 'wstr', '') If $aResult[1] <> '00000409' Then MsgBox(64, 'Warning', 'Recording has been done under a different Keyboard layout' & @CRLF & '(00000409->' & $aResult[1] & ')') EndIf EndFunc Func _WinWaitActivate($title,$text,$timeout=0) WinWait($title,$text,$timeout) If Not WinActive($title,$text) Then WinActivate($title,$text) WinWaitActive($title,$text,$timeout) EndFunc _AU3RecordSetup() #endregion --- Internal functions Au3Recorder End --- Run('D:\Office Related\Projects\LDBERP\Setups\096-Release--03-02-2020\Release\LogisticsERP.exe') _WinWaitActivate("LDB ERP Login","") MouseClick("left",825,310,1) Send("tweigel{TAB}123456") MouseClick("left",909,372,1) _WinWaitActivate("LDB ERP","") MouseClick("left",77,214,1) MouseClick("left",807,122,1) _WinWaitActivate("classname=WindowsForms10.Window.20008.app.0.23ff8f4_r9_ad1","") MouseClick("left",10,12,1) MouseClick("left",15,138,1) MouseClick("left",94,164,1) _WinWaitActivate("LDB ERP","") MouseClick("left",903,166,1) MouseClick("left",342,226,1) MouseClick("left",1227,126,1) _WinWaitActivate("Preview","") MouseMove(1591,20) MouseDown("left") MouseMove(1590,19) MouseUp("left") _WinWaitActivate("LDB ERP","") MouseClick("left",129,152,1) _WinWaitActivate("Logout","") MouseClick("left",45,82,1) #endregion --- Au3Recorder generated code End ---
Moderators JLogan3o13 Posted January 14, 2020 Moderators Posted January 14, 2020 @shakeel you are learning just how unstable the mousemove and mouseclick features are. Below is a much better way: Launch the AutoIt Window Info Tool, found in the same directory where you installed AutoIt Using the tool, hover the cross-hair over the element you would like to interact with (button, input field, etc.) Post the output from the tool here so we can assist further. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Zedna Posted January 14, 2020 Posted January 14, 2020 Generally, the goal is to use rather ControlClick() instead of MouseClick() Resources UDF ResourcesEx UDF AutoIt Forum Search
shakeel Posted January 15, 2020 Author Posted January 15, 2020 Here is the output of Auto info tool: >>>> Window <<<< Title: LDB ERP Class: WindowsForms10.Window.8.app.0.15c71b0_r9_ad1 Position: -8, -8 Size: 1616, 886 Style: 0x17CF0000 ExStyle: 0x00050100 Handle: 0x000B0AFA >>>> Control <<<< Class: WindowsForms10.Window.b.app.0.15c71b0_r9_ad1 Instance: 2 ClassnameNN: WindowsForms10.Window.b.app.0.15c71b0_r9_ad12 Name: shippingOrderStatusDropDown Advanced (Class): [NAME:shippingOrderStatusDropDown] ID: 199046 Text: Position: 764, 77 Size: 100, 20 ControlClick Coords: 50, 14 Style: 0x56010000 ExStyle: 0x00010000 Handle: 0x00030986 >>>> Mouse <<<< Position: 814, 114 Cursor ID: 0 Color: 0xFFFFFF
Nine Posted January 15, 2020 Posted January 15, 2020 The control you showed us is a Combo Box. Take a look at the ControlCommand () function. There is a number of options that allows you to manipulate Drop Down controls. Put something together and come back with the script you have tried. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
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