1

Closed

FindElementsByName does not work...

description

see the below code --
        AutomationElement rootElement;
        Process appProcess = AutomationHelpers.StartProcess(new ProcessStartInfo("SampleApp.exe"), out rootElement);
 
        AutomationElement inputTextBox = AutomationUtilities.FindElementsById(rootElement, "inputTextBox")[0];
        AutomationElement inputTextBox = AutomationUtilities.FindElementsByName(rootElement, "inputTextBox")[0]; ---> line of failure
 
FindElementsByName() seems to fails
Closed Feb 10, 2011 at 10:47 PM by ivom
Prakash,I am closing this issue as I believe it has been resolved (see Peter's comment).Please reactivate it if that is not the case.Ivo

comments

antalp wrote Dec 26, 2008 at 6:08 PM

Hello Prakash,

I can't be certain without reviewing the corresponding XAML for your scenario, but I think the behavior you are observing pertains to the fact that AutomationElement.NameProperty does not map to a WPF FrameworkElement.Name property. My understanding is that the AutomationElement.Name property actually maps to the "Content" property, which is likely not what you expected to see. This will help to explain the behavior, but I think that you will find that property is less suitable for searching elements, as content properties are not unique, and liable to change as the app runs.

I would strongly recommend getting any apps types you need to test instrumented with Automation ID's as these are invariant with state changes in the app, and there are no obstacles to uniqueness.

I hope that helps,

Peter

wrote Feb 10, 2011 at 10:47 PM

wrote Feb 14, 2013 at 9:08 PM

wrote May 16, 2013 at 11:02 AM