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

Test run unable to find drop down

3 Answers 71 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Tomer
Top achievements
Rank 1
Tomer asked on 08 Mar 2016, 12:55 PM

Hi,

I have recorded a test, as one of the test steps are clicking on a drop down menu.

I changed opened a feature in our UI which causes it to change a bit (some tabs added). After the change, the tests failed and from what I could see is that the button ID changed.

It tries this:

Pages.Kenshoo.FrameMainViewIframe.Button1490BtnIconElSpan.Click(false);

After I opened the feature on the test server, seems like the button id changed (1490).

Any way to run this using a regex to capture the id?

 

Error:

 

Pages.Kenshoo.FrameMainViewIframe.Button1490BtnIconElSpan.Click(false);

 

Exception thrown executing coded step: '[WebTest_CodedStep] : Click 'Button1486BtnIconElSpan''.
InnerException:
ArtOfTest.Common.Exceptions.FindElementException: Element Not found!
FindExpression used: 
[id 'Exact' button-1486-btnIconEl] AND [tagname 'Exact' span]

   at ArtOfTest.Common.WaitSync.CheckResult(WaitSync wait, String extraExceptionInfo, Object target)
   at ArtOfTest.Common.WaitSync.For[T,V](Func`3 func, T target, V custom, Boolean invertCondition, Int32 timeout, WaitResultType errorResultType)
   at ArtOfTest.WebAii.Synchronization.Wait.ForCondition(Func`3 condition, Boolean invertCondition, Object custom, Int32 timeout, WaitResultType errorResultType)
   at ArtOfTest.WebAii.Synchronization.Wait.ForExists(Int32 timeout, Boolean refreshElement)
   at ArtOfTest.WebAii.TestTemplates.HtmlElementContainer.GetElement(HtmlFindExpression expr, Boolean waitOnElement, Int32 timeout)
   at ArtOfTest.WebAii.TestTemplates.ElementContainer`2.Get(TFindExpression expr, Boolean waitOnElement, Int32 timeout)
   at ArtOfTest.WebAii.TestTemplates.HtmlElementContainer.Get(HtmlFindExpression expr)
   at ArtOfTest.WebAii.TestTemplates.HtmlElementContainer.Get[TControl](HtmlFindExpression expr)
   at ArtOfTest.WebAii.TestTemplates.HtmlElementContainer.Get[TControl](String[] clauses)
   at TestProject1.Pages.KenshooPage.FrameMainViewIframeFrame.get_Button1486BtnIconElSpan() in c:\Users\tomeri\Documents\Test Studio Projects\TestProject1\Pages.g.cs:line 115
   at TestProject1.WebTest.WebTest_CodedStep() in c:\Users\tomeri\Documents\Test Studio Projects\TestProject1\WebTest.tstest.cs:line 53

3 Answers, 1 is accepted

Sort by
0
Sailaja
Top achievements
Rank 1
answered on 08 Mar 2016, 02:01 PM

Hi Tomer,

I have a question here. Is there any other unique attribute to identify Button element (ex: Button Name).

Generally Id is always dynamically created and so we cannot rely on that. If your developers use Unique Id for each element then we rely on Id. 

So I suggest to add an unique attribute to identify the Button element.

Regards,

Sailaja

 

0
Tomer
Top achievements
Rank 1
answered on 10 Mar 2016, 06:55 AM

Unfortunately, no.

I will take this with our dev team.

 

Thanks!

0
Elena
Telerik team
answered on 11 Mar 2016, 12:43 PM
Hello Tomer,

Thank you for contacting us. 

@ Sailaja: Thank you for your reply. 

As far as I can see from the details you shared the only changing part of your button ID is the numeric part. You could change the criteria how the button ID is searched - instead of using exact match for the whole ID you could use starts with/ends with (see the attached screenshot). 
 
In addition to Sailaja's suggestion I could add that a possible unique attribute that you could use is the actual text content of each drop-down menu elements.  

Another helpful thing to do to sort out where the issue comes from, could be if you record the failing test step again and check its behavior by playback. 

In case this is not applicable in your case, please share further details on your issue. Please provide us the failing step details - in order to do so double click the red X on the failing step and export the details. Here is a short video demonstration (no audio) on how to provide the appropriate information for investigation.

Looking forward to hearing from you. 

Regards,
Elena Tsvetkova
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Tags
General Discussions
Asked by
Tomer
Top achievements
Rank 1
Answers by
Sailaja
Top achievements
Rank 1
Tomer
Top achievements
Rank 1
Elena
Telerik team
Share this question
or