Looped Data Driven Script with Data Driven Elements

6 posts, 0 answers
  1. Jonathan
    Jonathan avatar
    23 posts
    Member since:
    Jan 2012

    Posted 25 Jan 2013 Link to this post

    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


  2. Jonathan
    Jonathan avatar
    23 posts
    Member since:
    Jan 2012

    Posted 25 Jan 2013 Link to this post

    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.
  3. Mario
    Admin
    Mario avatar
    8 posts

    Posted 29 Jan 2013 Link to this post

    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
  4. Jonathan
    Jonathan avatar
    23 posts
    Member since:
    Jan 2012

    Posted 29 Jan 2013 Link to this post

    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:
  5. Mario
    Admin
    Mario avatar
    8 posts

    Posted 31 Jan 2013 Link to this post

    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
  6. Jonathan
    Jonathan avatar
    23 posts
    Member since:
    Jan 2012

    Posted 01 Feb 2013 Link to this post

    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.  
Back to Top