I am trying to automate testing an application written in C++.
I use UI Automation: http://msdn.microsoft.com/en-us/library/ms747327.aspx
I used UIAVerify to find automationIds of some elements but some elements are showing as disabled(grayed-out) in the tool.
Does it mean interactions for some elements are not automatable? How to automate interaction for an element which does not have a AutomationId value?
EDIT : I am trying to use automation to click on a control that has ControlType.Custom and has Name property set for it. Is there a way to do this? I tried these two ways, both fail:
method 1:
//using framework white
var button = window.Get(SearchCriteria.ByControlType(ControlType.Custom).AndByText ("<Name Property>"));
method 2:
//using Automation Framework
aeCtrl = aeParentPanel.FindFirst(TreeScope.Children,
new PropertyCondition(AutomationElement.NameProperty, "<Name Property>"));
From the “How To Use UI Verify” Word .doc file that’s linked to from the UIA Verify page on
codeplex:What this basically means is that these elements are ‘chrome’ items, they are things like menu bars or scrollbars, rather than content such as list items. They are still there and can be tested.
—
Not every element has an
AutomationID. It’s really up to the developer to set these as appropriate for use in testing. In some cases, they come from the underlying framework: for example, forWin32controls, theControl ID– if present – is used to generate theAutomationID. InWPF, you have to set the deverloper has to assign it via theAutomationProperties.AutomationIdAttached Property.Typically its only set for controls in dialogs, and is used to distinguish between them. Items within a control – eg. items within a list box – are usually identified by their
Nameinstead (orValue, for other controls). This is especially the case with items that are generated from an external source – such as a list containing filenames – since there’s no reasonable wayAutomationIDscould be assigned in advance there.