Ask a Question

Index of Window is sometimes changing.

New Contributor

Index of Window is sometimes changing.


I have a problem with the index of the Window Object. Sometimes it is changing from Index 2, to Index 3.

For example:

var  p1;

var  w1;

p1 = Sys.Process("ntvdm");

w1 = p1.Window("ThunderForm", "Retoure", 3); <- Index 3 does sometimes work and sometimes Index needs to be 2...

Is the reason for the Problem the program which i am testing or am i doing something wrong?

I hope you can help me, Thanks!

Greets Clever

Esteemed Contributor

Basically, what the index means is that there are more windows than just one that have the same class and caption.  So, each time you run your tests, it's opening another instance of the same form.

Now, if this is expected, then you might need to use something like a FindChild or some such thing to search for the form using some other parameters other than just name and caption.  The index essentially references, IIRC, the order in which the form was created so using some other parameters you can narrow down to your specific requested form.

Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
New Contributor

Thank you for your help!

I will try this.
Showing results for 
Search instead for 
Did you mean: