Ask a Question

wItemCount and WaitProperty

SOLVED
paarmann-ara
Contributor

wItemCount and WaitProperty

I have Qustion about WaitProperty!

I want know, may I use a Secound Parameter of WaitProperty like a boolian or how can I?

 

like:

Object.WaitProperty(wItemCount, wItemCount > 0)

14 REPLIES 14
RUDOLF_BOTHMA
Community Hero

As far as I know, there is no way to do this.  You should however be able to just put in a basic for loop and test the property directly:

 

var itemsFound = fasle;
for(var I=0;i<100;i++){
if(Object.wItemsCount >0)
itemsFound  = true;
break;
Delay(1000);
Object.Refresh(); //Might be required, but not guaranteed } if(!itemsFound){ Log.Error("No items found in allotted time"); }

-------------------------------------------------
Standard syntax disclaimers apply
Regards,

Many thanks for your reply.

I want to use this method to solve a error (window handel exsist but window not). that's not help me 😞

This is a error:

The window with the 0x00010800 handle exists but did not respond during the auto-wait timeout (150 ms)

This error raised because ListView.wItemCount is not ready.

 

In that case, you could use the .Exists rather than trying to use a property of the object which may or may not exist

e.g.

 

var objtectExists=false;
var counter = 0;

while(counter<100 && !objectExists)
{
counter++;
if(Object.Exists)
{
objectExists = true;
break;
}else
{
Delay(100);
ObjectParent.Refresh(); ObjectParent.FindChild("objectname"); //Or similar find method
// } }

 

 


-------------------------------------------------
Standard syntax disclaimers apply
Regards,

Unfortunatly, I have already check a Object, she is exsist but wItemCount is None 😞

I have changed a Auto-wait to 5000, still I get None on  wItemCount

Have you checked this manually?  Is wItemCount ever something besides zero?  Maybe that's the wrong property for you to be checking.

This is a error:

The window with the 0x00010800 handle exists but did not respond during the auto-wait timeout (150 ms)

This error raised because ListView.wItemCount is not ready.


This could perhaps mean that TCs pointer to the object still exists, but that the item it was pointing to was destroyed, recreated or disposed in some way.  If this is the case, the pointer ha changed and you will have to refresh your object and fetch again.  TC will never find the property even though it thinks it can see it, since that is an old handle


-------------------------------------------------
Standard syntax disclaimers apply
Regards,

What @RUDOLF_BOTHMA  sounds like the best case.  This is especially the case if you have assigned an object to a variable at one point in the project and then navigated away or refreshed the screen or something. Everytime you close a window and re-open, you destroy and create object handles.  So, if you're persisting an object via variable, you need to refresh it everytime the application recreates the object.  Using WaitChild or WaitAliasChild liberally throughout your code is key to this.  I try to NEVER store on-screen objects in global variables and keep them scoped to the local function and/or procedure.  


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

Ja, I have already check it. It's None Type

cancel
Showing results for 
Search instead for 
Did you mean: