When i try to get combobox Text appears exception:
ArtOfTest.Common.Exceptions.FindElementException : Unable to find the specified element: Unable to find the element of type: textblock
at ArtOfTest.WebAii.Silverlight.SilverlightProxy.ExecuteSLCommand(SilverlightCommand cmd)
at ArtOfTest.WebAii.Silverlight.SilverlightProxy.GetProperty(AutomationProperty property, IAutomationPeer peer)
at ArtOfTest.WebAii.Silverlight.AutomationObject`1.GetProperty(AutomationProperty property)
at ArtOfTest.WebAii.Silverlight.UI.TextBlock.get_Text()
at ArtOfTest.WebAii.Silverlight.FrameworkElement.get_Text()
at ArtOfTest.WebAii.Silverlight.SilverlightProxy.GetProperty(AutomationProperty property, IAutomationPeer peer)
at ArtOfTest.WebAii.Silverlight.AutomationObject`1.GetProperty(AutomationProperty property)
at ArtOfTest.WebAii.Silverlight.UI.TextBlock.get_Text()
at ArtOfTest.WebAii.Silverlight.FrameworkElement.get_Text()
if (!box.Text.Equals(value)) // <- Here appears exception
{
box.OpenDropDown(false);
box.Refresh();
ComboBoxItem item = box.Items.FirstOrDefault(i => i.Text.Trim().Contains(value.TrimValue()));
Stopwatch watch = Stopwatch.StartNew();
while (item == null && watch.ElapsedMilliseconds <
30000
)
{
box.Refresh();
item
=
box
.Items.FirstOrDefault(i => i.Text.Trim().Contains(value.TrimValue()));
}
watch.Stop();
if (item != null)
{
item.IsSelected = true;
box.IsDropDownOpen = false;
return true;
}
box.IsDropDownOpen = false;
return false;
}
return true;