cancel
Showing results for 
Search instead for 
Did you mean: 

wItemCount and WaitProperty

SOLVED
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)

3 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Community Leader

Re: wItemCount and WaitProperty

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,

View solution in original post

Community Hero

Re: wItemCount and WaitProperty

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
[Community Expert Group]
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
Extensions available

View solution in original post

Community Leader

Re: wItemCount and WaitProperty


@tristaanogre wrote:

I try to NEVER store on-screen objects in global variables 


I recall doing it in the really early days of my TC development.  In the end I always had to refresh & refetch the object everytime, so there was no gain in doing it this way - even a bit of a perfromance loss.  Wait methods in local scope or at least within the local functions where the most reliable and efficient


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

View solution in original post

14 REPLIES 14
Community Leader

Re: wItemCount and WaitProperty

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,
Contributor

Re: wItemCount and WaitProperty

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 :-(

Contributor

Re: wItemCount and WaitProperty

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.

 

Community Leader

Re: wItemCount and WaitProperty

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,
Contributor

Re: wItemCount and WaitProperty

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

Community Hero

Re: wItemCount and WaitProperty

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

Highlighted
Community Leader

Re: wItemCount and WaitProperty

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,

View solution in original post

Community Hero

Re: wItemCount and WaitProperty

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
[Community Expert Group]
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
Extensions available

View solution in original post

Contributor

Re: wItemCount and WaitProperty

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