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

Looped Data Driven Script with Data Driven Elements

5 Answers 87 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jonathan
Top achievements
Rank 1
Jonathan asked on 25 Jan 2013, 09:04 PM
I recently upgraded to 2012.2.1022.0 for the feature to edit elements and find an element with the data bound strings from excel.  There is more than one row in my excel spreadsheet and the script loops per design. The script is suppose to click on a tag with the innertext string from excel.  However, it seems that on the first iteration, the element is permanently set to the innertext of  the first iteration and never updates to the name of the second iteration.  The script is essentially clicking on the wrong tag everytime.  Is this a limitation of Test Studio?

Thanks,

Jonathan


5 Answers, 1 is accepted

Sort by
0
Jonathan
Top achievements
Rank 1
answered on 25 Jan 2013, 09:17 PM
There also is an id that I'm searching for and these ids are similar such as id = chkRep, chkRep0, chkRep1

So for this element, I am using  id contains chkRep and innertText bound to my data source.
0
Mario
Telerik team
answered on 29 Jan 2013, 05:32 PM
Hello Jonathan,

Thank you for contacting Telerik Support.

I suspect the reason that this same element is being selected on each consecutive iteration after the first is due to insufficient constraints in the find logic. Essentially, Test Studio is filtering out the first element on the page for which the logic will apply and I will explain a common reason for why this could be the same element on each iteration. Please see below:

You mentioned that a number of elements on this page have similar id attributes such as chkRep, chkRep0, etc. When applying the first constraint: 
id 'contains' chkRep

Test Studio has now filtered out the first element with this id simultaneously with all of the other 'similar' elements.  Now we apply your second constraint:
InnerText 'contains' TextData

Please note that the InnerText attribute is defined as the text between the start and end tags of the object. With this in mind, although I cannot say for sure without looking at the DOM structure of this page, I suspect that the value for InnerText at the time of comparison is actually a longer string which simultaneously 'contains' all the individual entries from your data source. If this were the case, then the first filtered element would be selected repeatedly.

To strengthen the find logic, I suggest that we simultaneously data drive the 'id' attribute as well and use the 'exact' comparison similarly to:
id 'exactly' idData
InnerText 'contains' textData

Where idData would be an additional column of id's in your Data source (eg. chkRep, chkRep0, etc).

Please let me know whether my suggestion helps or if you have any additional questions.

Greetings,
Mario
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Jonathan
Top achievements
Rank 1
answered on 29 Jan 2013, 08:28 PM
Data driving the id wouldn't be a good option here.  The name that is associatied with the ID changes as the user enters additional names and the sort is done alphabetically.  So, the ID would change.  What is weird is that when I remove the data driven name and enter the name physically for InnerText or TextContent (tried both), Telerik finds the element and highlights it.  Do you have any other suggestions?  Would a coded step help?  Here is my DOM:
0
Mario
Telerik team
answered on 31 Jan 2013, 09:28 PM
Hi Jonathan,

Thanks for clearing that up about the id attribute in your application, I do agree with you in this case.

The difference in behavior you describe between regular and data driven approaches is intriguing, but I have not been able to produce such an issue on my side, making it difficult for me to provide suggestions. Would it be possible for you to provide me with the resources to reproduce your issue locally?

Please note that now we are communicating in a forum thread which is public available and if you are willing to provide any sensitive information you should open a support ticket where all the information remains private and confidential.

Keeping the above in mind, I would need a copy of your entire project along with the means to run this particular script in its environment either through direct access, or if you app is local/private, a Fiddler trace. This link will provide you with step-by-step instructions for download and use. The trace will allow me to "simulate" your application in order to reproduce the problem locally.

All the best,
Mario
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Jonathan
Top achievements
Rank 1
answered on 01 Feb 2013, 03:33 PM
For security reasons, I can either provide a fiddler trace or try to show you the application by Webex.  I will go ahead and open a private support ticket.  
Tags
General Discussions
Asked by
Jonathan
Top achievements
Rank 1
Answers by
Jonathan
Top achievements
Rank 1
Mario
Telerik team
Share this question
or