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

WPF Find.ByAutomationID times out

1 Answer 60 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
daniel asked on 25 Aug 2015, 04:34 PM

OK, absolute noob with Testing Framework. First thing I'm trying to do is find a checkbox control on our WPF UI:

System.Diagnostics.Process[] appProcess = proc.GetProcessesByName("OurAppHost");
WpfApplication wpfApp = Manager.ConnectToApplication(appProcess[0]);
CheckBox chkClientExists;
chkClientExists = wpfApp.MainWindow.Find.ByAutomationId<CheckBox>"Existing_Client_Checkbox");

Running in debug mode, that last line fails with "Wait for condition has timed out" error. Looks like:

System.TimeoutException was unhandled
  Message=Wait for condition has timed out
       at ArtOfTest.Common.WaitSync.CheckResult(WaitSync wait, String extraExceptionInfo, Object target)
       at ArtOfTest.Common.WaitSync.For[T](Predicate`1 predicate, T target, Boolean invertCondition, Int32 timeout, WaitResultType errorResultType)
       at ArtOfTest.WebAii.Silverlight.VisualWait.ForExistsInternal(Int32 timeout, Boolean invertCondition)
       at ArtOfTest.WebAii.Silverlight.VisualWait.ForExists(Int32 timeout)
       at ArtOfTest.WebAii.Silverlight.VisualWait.ForVisible(Int32 timeout)
       at ArtOfTest.WebAii.Silverlight.VisualFind.ReturnOrThrow(FrameworkElement e, String throwMessage)
       at ArtOfTest.WebAii.Silverlight.VisualFind.ByAutomationId(String id, String xamlTag)
       at ArtOfTest.WebAii.Silverlight.VisualFind.ByAutomationId[T](String id)

But if then, while execution is suspended, I copy and paste that line into the Immediate window and execute it there, it returns the checkbox instantly and I'm able to examine all its properties and its children in Locals and Watch.

I have no trouble locating this control in OOB Coded UI  by AutomationID, but it's a custom control and there are no properties visible to Coded UI by which we can determine its state. That seems to be determined by child elements (XAML Ellipses apparently) that Coded UI is unable to see. Testing Framework IS able to see them, IF I can get the parent, and I don't seem to be able to get the parent for some reason. At least not in executing code.



1 Answer, 1 is accepted

Sort by
Telerik team
answered on 28 Aug 2015, 10:41 AM
Hello Daniel,

In order to investigate and assist any further we will need the wfp application you are using and the test/project you are using if possible.

Do you think you can provide this information?

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