Hi,
I am using Find Strategy in the manner described in http://www.telerik.com/forums/how-to-judge-whether-the-element-exists
However, in a repeated set of runs, sometimes line 175 below fails with the traceback below. Sometimes this exception occurs
in run 10, sometimes in run 6 etc.
> public void SanitizedFunction()
> {
>
> FindStrategy originalStrategy = wpfClient.MainWindow.Find.Strategy;
> wpfClient.MainWindow.Find.Strategy = FindStrategy.WhenNotVisibleReturnNull;
> try
> {
> wpfClient.MainWindow.Window.SetFocus();
> wpfClient.MainWindow.RefreshVisualTrees();
line 175 > var dvGrid = wpfClient.MainWindow.Find.ByAutomationId("RadGridView"); // telerik control with AutomationId added
> if(dvGrid!=null)
> {
> // real work here ...
> }
> else
> {
> Assert.IsTrue(dvGrid!=null,"dvGrid should not be null");
> }
> }
> finally
> {
> wpfClient.MainWindow.Find.Strategy = originalStrategy;
> }
> }
>
The traceback :
> at ArtOfTest.WebAii.Wpf.WpfProxy.ExecuteSLCommand(SilverlightCommand cmd)
> at ArtOfTest.WebAii.Wpf.WpfProxy.GetVisibility(IAutomationPeer peer)
> at ArtOfTest.WebAii.Silverlight.FrameworkElement.get_Visibility()
> at ArtOfTest.WebAii.Silverlight.FrameworkElement.get_IsVisible()
> at Telerik.XamlAutomation.SteelThread.TelerikSteelThread.SanitizedFunction() in TelerikSteelThread.cs: line 175
> at Telerik.XamlAutomation.SteelThread.TelerikSteelThread.Execute(IEnumerable`1 funcs) in TelerikSteelThread.cs: line 268
> at Telerik.XamlAutomation.SteelThread.TelerikSteelThread.OneRunNotamSteelThread() in TelerikSteelThread.cs: line 402
> at Telerik.XamlAutomation.SteelThread.TelerikSteelThread.<TestLoop>b__3(Int32 i) in TelerikSteelThread.cs: line 427
> at Jeppesen.MarineOperations.DotnetUtils.LinqUtils.ForEach(IEnumerable`1 enumeration, Action`1 action) in LinqUtils.cs: line 21
> at Telerik.XamlAutomation.SteelThread.TelerikSteelThread.TestLoop() in TelerikSteelThread.cs: line 424
>
The traceback seems to say that FindByAutomationId fails because dvGrid is not visible, right in the Find itself, so the check
for dvGrid==null is too late, ocassionally.
Any ideas why this is so?
I am using Find Strategy in the manner described in http://www.telerik.com/forums/how-to-judge-whether-the-element-exists
However, in a repeated set of runs, sometimes line 175 below fails with the traceback below. Sometimes this exception occurs
in run 10, sometimes in run 6 etc.
> public void SanitizedFunction()
> {
>
> FindStrategy originalStrategy = wpfClient.MainWindow.Find.Strategy;
> wpfClient.MainWindow.Find.Strategy = FindStrategy.WhenNotVisibleReturnNull;
> try
> {
> wpfClient.MainWindow.Window.SetFocus();
> wpfClient.MainWindow.RefreshVisualTrees();
line 175 > var dvGrid = wpfClient.MainWindow.Find.ByAutomationId("RadGridView"); // telerik control with AutomationId added
> if(dvGrid!=null)
> {
> // real work here ...
> }
> else
> {
> Assert.IsTrue(dvGrid!=null,"dvGrid should not be null");
> }
> }
> finally
> {
> wpfClient.MainWindow.Find.Strategy = originalStrategy;
> }
> }
>
The traceback :
> at ArtOfTest.WebAii.Wpf.WpfProxy.ExecuteSLCommand(SilverlightCommand cmd)
> at ArtOfTest.WebAii.Wpf.WpfProxy.GetVisibility(IAutomationPeer peer)
> at ArtOfTest.WebAii.Silverlight.FrameworkElement.get_Visibility()
> at ArtOfTest.WebAii.Silverlight.FrameworkElement.get_IsVisible()
> at Telerik.XamlAutomation.SteelThread.TelerikSteelThread.SanitizedFunction() in TelerikSteelThread.cs: line 175
> at Telerik.XamlAutomation.SteelThread.TelerikSteelThread.Execute(IEnumerable`1 funcs) in TelerikSteelThread.cs: line 268
> at Telerik.XamlAutomation.SteelThread.TelerikSteelThread.OneRunNotamSteelThread() in TelerikSteelThread.cs: line 402
> at Telerik.XamlAutomation.SteelThread.TelerikSteelThread.<TestLoop>b__3(Int32 i) in TelerikSteelThread.cs: line 427
> at Jeppesen.MarineOperations.DotnetUtils.LinqUtils.ForEach(IEnumerable`1 enumeration, Action`1 action) in LinqUtils.cs: line 21
> at Telerik.XamlAutomation.SteelThread.TelerikSteelThread.TestLoop() in TelerikSteelThread.cs: line 424
>
The traceback seems to say that FindByAutomationId fails because dvGrid is not visible, right in the Find itself, so the check
for dvGrid==null is too late, ocassionally.
Any ideas why this is so?