This is a migrated thread and some comments may be shown as answers.

Is it possible to get the AutomationProperties.ItemStatus from a WPF application

1 Answer 26 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Max
Top achievements
Rank 1
Max asked on 30 Sep 2015, 11:54 AM

I am trying to get the AutomationProperties.ItemStatus using the Telerik Test framework and it does not seem to exist anywhere. Is the only way around it to do the following? Surely there is a way directly from Telerik framework?

Get the handle from the Telerik framework and then use the System.Windows.Automation framework as follows...

var wpfHandle = customTelerikFrameworkElement.wpfWindow.Window.Handle

System.Windows.Automation.AutomationElement.FromHandle(this.wpfWindow.Window.Handle);                 

var root = System.Windows.AutomationAutomationElement.RootElement;                 

var image = root.FindFirst(TreeScope.Descendants, new System.Windows.Automation.PropertyCondition(System.Windows.Automation.AutomationElement.AutomationIdProperty, indicatorImage.AutomationId));

var props = image.GetSupportedProperties();                 

var prop = props.FirstOrDefault(p => p.ProgrammaticName == "AutomationElementIdentifiers.ItemStatusProperty");

var statusPropertyValue = image.GetCurrentPropertyValue(prop);

1 Answer, 1 is accepted

Sort by
0
Ivaylo
Telerik team
answered on 05 Oct 2015, 11:15 AM
Hello Max,

I don't think you can get  the AutomationProperties.ItemStatus using the Testing framework.

Thank you for your understanding.

Regards,
Ivaylo
Telerik
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
Tags
General Discussions
Asked by
Max
Top achievements
Rank 1
Answers by
Ivaylo
Telerik team
Share this question
or