Forum Discussion

weijiang's avatar
weijiang
Occasional Contributor
8 years ago

Failed to recognize the new childcount

I tried to retrieve an element's ChildCount, it originally is 9. Then I called Touch(), it will expands and show up a sub menu. By using ObjectSpy, its ChildCount becomes 17. However I can't get the number 17 using neither script nor keyword test. Is there a way to force TC to read the new object?

 

Original:

a

b

c

 

After touch:

a

b

>b1

>b2

>b3

c

 

Script:


var x = new definitions.Category_List_Page();
Log.Message(x.numOfCategories);
var cat = definitions.get_CLP_subCatItem(2);
cat.Touch();
Delay(6000);
var y = new definitions.Category_List_Page();
Log.Message(y.numOfCategories);

 

The only workaround I can use, is probably recognize each status of the list (by expanding each sub item) to be different objects:

1) default page with no sub items expanded/touched

2) page1 with item 1 touched

3) page2 with item 2 touched

......

But this sounds silly.

4 Replies

  • Marsha_R's avatar
    Marsha_R
    Champion Level 3

    Do you need the actual ChildCount number or could you use FindChild to get the object you need?

    • weijiang's avatar
      weijiang
      Occasional Contributor

      I need to verify expected number of items get expanded, for example, I click "b", there supposed to be 3 items expanded under b, so the ChildCount need to be +3.

      • Marsha_R's avatar
        Marsha_R
        Champion Level 3

        Could you post a screenshot of the Object Spy screen that includes the path and the child count?