Designing a for/while loop to expand varying objects within objects
I'm trying to design a loop that will use the Expand method to open each "+" sign in the posted screenshot. Here are the issues I'm having:
1. I don't know how to teach TC to recognize the "+" sign as an Object. TC recognizes the overall window as an Object (which I'll refer to as WindowObject) but I want to focus specifically on the "+" signs within the window. Is there a way to select an object within an object? So far the closest I've gotten to identifying individual "+" signs is by calling out the window object's row (i.e. The first "+" will expand if I use WindowObject.Expand(0), the second will expand if I include an additional WindowObject.Expand(1) line, etc).
2. While I can successfully expand those "+" signs by specifically referencing each row of WindowObject, I plan on testing 100s of these windows and they all have different numbers of rows. Ideally, I want my loop to be able to break if there are no more "+" signs to expand but I'm struggling to design my loop in a way that won't generate errors. This is what I've come up with so far when attempting to finetune my test in Javascript
var i = 0;
while (i < 3); //The 3 is arbitrary, I just wanted to create a boundary to stop the loop
WindowObject.Expand(i);
i++;
Running that test will successfully expand the three "+" signs in the screenshot but will also terminate on an error indicating that "Row 3 is out of bounds" since there isn't a 4th "+" to expand.
I'm still fairly new to TestComplete so please let me know if there is anything I need to clarify or if I've left out some important information that could resolve this issue.