Jump to content

Recommended Posts

Posted

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_ad15
as 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.

Posted

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

Posted

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

Posted

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...