hzw Posted September 20, 2016 Share Posted September 20, 2016 First time poster here. I am evaluating AutoIt to see if it can be used to test the UI of an application that is developed here (It is quite extended). I have found how to access window controls by using the application "AutoIt Windows Info" to give me a unique identifier. But I am not sure how 'constant' the ClassnameNN will be across different versions (we are using Visual Studio 2013 now, and will probably evaluate 2015 in the future). For example: a checkbox in one of the dialogs is identified with WindowsForms10.BUTTON.app.0.141b42a_r14_ad15as used in:Local $makeDirState = ControlCommand($newSequencehWnd, "", "WindowsForms10.BUTTON.app.0.141b42a_r14_ad15", "IsChecked", "") First: is this a good way to access these controls? Or should I 'navigate' the windows structure? How likely is it that -across builds and IDEs- the name will change (not counting modifications to the control itself)? Because in that case I would have to find another way to find a control. Link to comment Share on other sites More sharing options...
Danyfirex Posted September 20, 2016 Share Posted September 20, 2016 Hello. When I work with Net controls I usually do something like. #include <WinAPI.au3> Local $hWindow = WinGetHandle("Form1") Local $makeDirState = ControlCommand($hWindow, "", _MakeNetClassNN($hWindow, "BUTTON", "5"), "IsChecked", "") Func _MakeNetClassNN($hwnd, $sControlType, $sIndexNN) Local $sStringClass = _WinAPI_GetClassName($hwnd) Local $sStringWin = StringMid($sStringClass, 1, StringInStr($sStringClass, ".")) Return $sStringWin & $sControlType & StringMid($sStringClass, StringInStr($sStringClass, ".app")) & $sIndexNN EndFunc ;==>_MakeNetClassNN Saludos hzw 1 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
junkew Posted September 20, 2016 Share Posted September 20, 2016 https://www.autoitscript.com/wiki/FAQ see faq 31 for some references As you build inhouse with visual studio its worth to look at the IUIAutomation stuff and check with SimpleSpy assuming developers are willing to use nice recognition id's. Other solution can be to use IUIAutomation from VBA / Excel 2010 or use the visual studio stuff that wraps UIAutomationCore.Dll hzw 1 FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
hzw Posted September 23, 2016 Author Share Posted September 23, 2016 Thank you for these replies! It looks like complicated names like that don't belong written out in a series of scripts that will need maintenance. I will try to use the nicer names for the controls (if available) and will use Danyfirex's suggestion for the others. 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