Shantanu: The reason I asked about number of rows and columns was to find a method to uniquely identify the table. Below are three possibilities that I can see. The URL has a table that I tested against. Once you have the unique table, you can use descriptive programming to continue the testing.
''// http://relevantcodes.com/get-rowcolumn-of-an-object-in-a-webtable/ browserName = "Get.*" pageTitle = "Get.*" numColumns = 5 Three possibilities: 1) Execute the code to find the names of all the tables. Are the names of the other tables constant? If the other names are constant, you can determine the required table name by elimination. Set oDesc = description.Create oDesc("micclass").Value = "WebTable" Set FindTables = Browser("name:="&browserName).Page("title:="&browserName).childobjects(oDesc) For i = 0 to FindTables.count - 1 print FindTables(i).GetROProperty("name") Next 2) If the unknown table is the only table with two columns, find the name by using childobjects and finding the table with two columns. Set oDesc = description.Create oDesc("micclass").Value = "WebTable" Set FindTables = Browser("name:="&browserName).Page("title:="&browserName).childobjects(oDesc) For i = 0 to FindTables.count - 1 If FindTables(i).GetROProperty("cols") = numColumns Then print FindTables(i).GetROProperty("name") End If Next 3) If neither of the above methods work, find which table has two columns and in the second column there is a webcheckbox. Look at "outerHTML" and/or "type". The code below prints the "outerHTML" for all the webelements in the table(s) that have a maximum columns. Set oDesc = description.Create oDesc("micclass").Value = "WebTable" Set oDesc_2 = description.Create oDesc_2("micclass").Value = "WebElement" Set FindTables = Browser("name:="&browserName).Page("title:="&browserName).childobjects(oDesc) For i = 0 to FindTables.count - 1 If FindTables(i).GetROProperty("cols") = numColumns Then print FindTables(i).GetROProperty("name") Set FindWebElements = Browser("name:="&browserName).Page("title:="&browserName).WebTable("cols:="&numColumns).childObjects(oDesc_2) print "number of webelements = " & FindWebElements.count For j = 0 to FindWebElements.count - 1 print FindWebElements.item(j).GetROProperty("outerHTML") Next End If Next hth, Parke -- -- You received this message because you are subscribed to the Google "QTP - HP Quick Test Professional - Automated Software Testing" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/MercuryQTP?hl=en --- You received this message because you are subscribed to the Google Groups "QTP - HP Quick Test Professional - Automated Software Testing" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
