Question

The following code should check uIBeautyListItem for 50 milliseconds and move on. But the WaitForControlExist method waits for 20 seconds. I have tried different values and no luck.

Why does the time-out in my code doesn't work.

Int32 int32sec = 50; 
if (uIBeautyListItem.WaitForControlExist(int32sec)) 
{ 
    Mouse.Click(uIBeautyListItem);
}

Method signature from MSDN:

public bool WaitForControlExist(
int millisecondsTimeout
)
Was it helpful?

Solution

Taken directly from the MSDN documentation:

When the wait operation causes an implicit search for the control or, when the application is busy, the actual wait time could be more than the time-out specified.

I suppose, that in your case this operation causes an implicit search for the control, and that's why it takes so much time.
You might want to change the default search timeout:

Playback.PlaybackSettings.SearchTimeout = someValue;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top