Farality Posted May 10, 2018 Posted May 10, 2018 I want to automate it with a hidden windows . Here is my scripts . I'm new to AutoIT and trying to test a function on the windowsform C#. string _title = $"Form1"; string _class = $"WindowsForms10.Window.8.app.0.141b42a_r10_ad1"; string _titleClass = $"[TITLE:{_title};CLASS:{_class}]"; IntPtr _hwnd = AutoIt.AutoItX.WinGetHandle($"{_titleClass}"); IntPtr _ctrHandle = AutoIt.AutoItX.ControlGetHandle(_hwnd, ""); string _ctrId = $"[Class:WindowsForms10.BUTTON.app.0.141b42a_r10_ad1;Instance:1]"; //AutoIt.AutoItX.ControlClick(_hwnd,"",$"{_ctrlId}"); /// Doesn't work ///AutoIt.AutoItX.ControlClick(_hwnd, _ctrHandle, "left", 1, 318, 144); /// Doesn't work AutoIt.AutoItX.ControlClick(_titleClass,"","[Class:Button;Name:button2]","left",1); ///////// Doesn't work AutoIt.AutoItX.ControlSetText(_titleClass, "", "[NAME:textBox1]", "Text was changed by ControlSetText"); /////// Worked ! PS. If the button2 is clicked then the messagebox will be pop up.
junkew Posted May 13, 2018 Posted May 13, 2018 Maybe have a sleep statement after clicking. How are you sure it did not click? Alternatives are to move mousecursor to x y and send a click FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets
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