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

Combobox.Text throws exception

3 Answers 94 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Asta
Top achievements
Rank 1
Asta asked on 11 Feb 2013, 01:43 PM
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()

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;

3 Answers, 1 is accepted

Sort by
0
Boyan Boev
Telerik team
answered on 12 Feb 2013, 02:39 PM
Hi Asta,

The error message seems to suggest that Test Studio was unable to find an element that it was looking for. We have a standard error message for this kind of thing. I'm not sure why you got this error message instead. But you should still be able to follow our troubleshooting guide in order to get this resolved. Please check out these articles:

- Change How an Element Is Found

- Unable to locate element failures
You can try to add a WaitForExists to the element you are looking for. It may appear slowly causing the step to fail.

If the issue persists please send us a screen shot of the DOM tree and provide us please with a bigger code snippet (i.e. the part with the find expression).

Hope to hear from you soon.
 

All the best,
Boyan Boev
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Sarika
Top achievements
Rank 1
answered on 04 Nov 2014, 12:54 PM
My Test cases are getting failed for Combo box,its giving error saying its not able to locate the element, Attaching error log reference.
Please help me to figure out what could be error cause?
0
Boyan Boev
Telerik team
answered on 07 Nov 2014, 12:30 PM
Hi Sarika,

Thank you for contacting us.

It seems that you were not able to attach the log file. 

In order to help you best please:

1. Re-attach the log.

2. Send us the code you are using for selecting the combo box.

3. Please send us a screen shot of the DOM tree where the combo box is.

Looking forward to hearing from you.

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