Dynamic Elements dependent on Excel

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

    Posted 14 Dec 2012 Link to this post

    The only way of knowing how many iterations the script will need to performed is by looking at how many rows are contained in the spreadsheet.  Fortunately, Telerik will automatically play the script over for all the rows in excel.  However, the element changes for any subsequent row because there is a link on the web form to add a new row.  So, say that the element initially is FirstNameTextBox.  The subsequent element after clicking the add row would be FirstNameTextBox0 and then FirstNameTextBox1. 

    Since there can be several lines in the excel spreadsheet depending on what the user puts in, I won't know how many elements I will need to record unless I record several assuming they won't reach that max limit.  So, is there a way to search for these elements without having them in the element repository and making them dynamic in code? Say that FirstNameTextbox7 isn't in the element repository, but it exists in the dom.  Will it recognize something like below during playback?

    Such as.

    object count = 0;

    Pages.Webform.FirstNameTextbox&count.text = data["FirstName"];

    count = count + 1;
  2. Cody
    Admin
    Cody avatar
    3354 posts

    Posted 14 Dec 2012 Link to this post

    Hello Jonathan,

    Let me start with a clarification. The names you see displayed in Elements Explorer, e.g. FirstNameTextBox, FirstNameTextBox0, FirstNameTextBox1, are the "friendly names". These are just names for us humans to read and identify one element from another. This name is not actually used during the test execution for finding the element. What does matter is what is the Find Expression for that element. This is what Test Studio uses to try and locate the correct element on the current page. We look for some unique attribute applied to all of the elements that are there e.g. the ID=CTL100_MainLink, src=\nextbutton.jpg, href=\page2.aspx, etc.

    Without having direct access to your application, i don't know what it would take to easily automate entering data into the correctly row. It may be that you can always use the element FirstNameTextBox. Or we may need to resort to a few lines of code to find "the last row" and enter the data into there.

    If you can give us more information, such as what does the HTML look like at the time the text needs to be entered, then we can help you figure out how to data drive this scenario properly.

    Regards,
    Cody
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
Back to Top