Forum Discussion

SamuraiJack's avatar
SamuraiJack
Contributor
16 years ago

Best way to grab data from a specific cell in a dynamic table, Tree model?

Besides using this: http://www.automatedqa.com/support/viewarticle/?aid=6826



Is there a way to verify a property exists and grab the data from say Row 1, Column 4 from the table without having to reparse the table each time?



the table always has 4 columns, and I can iterate through the rows using a FOR loop.  I'd want to know if Cell 0,4 contains the textnode property then grab.  It seems there's no easy way to do it through name mapping because not every table has more than one row.



Thanks

13 Replies

  • AlexKaras's avatar
    AlexKaras
    Community Hero
    Hi Mike,



    Are you talking about recording made for Keyword test or the recorded script code?

    In the latter case you need to manually edit the recorded code.

    In the former case, you also need to edit the recorded test:), but (as for me) it requires more actions. This is what I ended-up with:

    1. Create a variable for the recorded test (e.g. vObj);

    2. Add the Call Object Method operation to the test and set its object field to Aliases.Sys.iexplore. Select the WaitAliasChild method from the subsequent wizard page and set the ChildName parameter to panelCommercialpolicylist. Set the WaitTime parameter to the number of milliseconds you like to wait and complete the wizard by pressing the Finnish button;

    3. Save the obtained object to the variable: Add the Set Variable Value operation, select the vObj variable, press Next button and select Last Operation Result option for the Mode field. Press Finish to complete the wizard;

    4. Add the If...Then operation. Press the ellipsis button for the Value1 field and select the Code Expression option for the Mode field. Press the ellipsis button for the Value field, select the vObj variable for the expression, press OK to close the Edit Expression dialog and add '.Exists' (without quotes) to the value entered into the Value field. Press OK button to close the Edit Value dialog. Select Equals for the Condition field. Press the ellipsis button for the Value2 field, select Constant for Mode and Boolean for Type fields. Select either True or False for the Value field as needed and press OK twise to close all dialog windows.

    5. Proceed further in the test as needed.
  • Hi Alex,



    While following up on your other post in another thread, I saw you had replied here as well.  While attempting to follow the steps you outlined here, however, I ran into an issue.



    What I'm trying to do is create a variable which will contain a date value going back one week from the current date.  So I added a String variable to the script.



    Next, from Test Actions, I dragged over "Call Object Method" and in the popup I clicked "Select Variable ...", picked the variable I'd created, and clicked OK.



    Then when I click next, I get an error reading:



    "Unable to continue.  The specified expression does not return an existing object, or that object does not contain any methods or properties."



    All I can do at this point is cancel the operation.



    If it helps, the values for the variable are:



    Name: IndentureDate

    Type: String

    Default Value: 01/15/2014

    Description: (blank)



    Thanks for any help you can provide.



    Mike



  • AlexKaras's avatar
    AlexKaras
    Community Hero
    Hi Mike,



    If I got your question correctly and assuming that you already assigned a string value to the IndentureDate variable and need it to contain the string result, I would do the following (untested, so the code might require correction):

    -- Use the 'Set Variable Value';

    -- Set the Mode field to 'Code Expression';

    -- Enter the following into the Value field:

    aqConvert.DateTimeToFormatStr(aqDateTime.AddDays(aqConvert.strToDate(IndentureDate), -7), '%m/%d/%Y')



    Does this help?