Testing nested HTML tables

When QA Wizard Pro performs a GetControlFromTable statement during playback, tables are searched recursively. Parent tables are searched first followed by any nested tables. In some rare cases, QA Wizard Pro may not locate a control in a nested table because the same control is located in the same cell in the parent table and nested table.

If a control in a nested table cell has the same property and value as a control in the parent table but has different row and column indexes than the parent table, QA Wizard Pro can usually locate the correct control in the nested table.

If a parent table cell and nested table cell both include a control with the same property, value, row index, and column index, you need to use nested GetControlFromTable statements to locate the nested table and then locate the control in the nested table.

Note: Use Text View to create nested GetControlFromTable statements.

For example, the Items table includes a nested table in the fourth column. You want to click a button with a Text property value of Buy in the first row and fourth column of the nested table. The parent table includes a button with the Text property of Buy, but it is in the second row and second column. In this case, you can use a single GetControlFromTable statement in the Click statement to locate the control.

Window("Cart").Button(Window("Cart").HTMLTable("Items").GetControlFromTable("Button", 1, 4, "Text", "Buy")).Click()

If the parent table and nested table both include buttons with a Text property value of Buy in the first row and fourth column, the button in the parent table is clicked because QA Wizard Pro finds it before the button in the nested table. To locate the button in the nested table, you need to use nested GetControlFromTable statements. For example:

Window("Cart").Button(Window("Cart").HTMLTable(Window("Cart").HTMLTable("Items").GetControlFromTable("HTMLTable", 2, 2)).GetControlFromTable("Button", 1, 4, "Text", "Buy")).Click()

The inner GetControlFromTable statement searches for an HTMLTable control in the second row and second column of the Items table in the Cart window. This is the nested table. The outer GetControlFromTable statement searches for a Button control with a Text property of Buy in the first row and fourth column of the HTML table located by the inner GetControlFromTable statement. The Click action is performed on this control.