Wait for the grid to be loaded before clicking a button


I want to Click OK button after the grid is loaded, because the OK button is inactive during the loading of the list.
I tried Element Exists activity for the first line to be present and then click. But it doesn’t wait until the end of loading and tries to click the OK button during the loading session. (Timeout is set to 600000 milliseconds)

What is wrong with the activity I’m using? If it’s not possible with that way, any other suggestions will be appreciated like checking the button if it’s active.





Can you try “Find Element” activity instead of element exist.

element exist is the right approach, but it is fired one time.
You reacted on this with the loop, or the retry scope acitivity is an option.
But some times an element exists, but application is not fully ready.
Have a check if you find something that is triggering when the ok button is active or not and use this for sync

A not nice way only the last, last ressort some members did it with image exists: How to check if button is active or not? - #24 by ppr

Here an analysis in UiExplorer is to do. Click on the inactive button wile loading and explore the properties (left pane). then reindicate or refresh the properties for the active button.

One info would help us, what type for application is it?

1 Like

It’s a VB.NET application, WindowsForms screen. When the button is inactive, UI Explorer couldn’t retrieve its properties until the loading is finished. After loading finishes, Property Explorer (left pane) is filled for example: aastate: focusable etc.

it is risky but then give a try with get attribute in a loop along with try catch. In case of the button is not returning any info while loading, then returning attributes could indicate the load status.

But it is risky as well. Kindly note: I updated my previous post. Have check on last version as well

1 Like

@Jenni_K At least you could try…:slight_smile:

I tried Find Element activity. It also ended up with the same result, it didn’t wait until the loading is finished.

Get Attribute just waited for 10 seconds and couldn’t find the attribute and goes on to next step. I used it in the same Do While loop.

Here is the properties I set:

Yes i was expecting that you will use in loop, plus try catch on get attribute
But do the time out to 5000 seconds,
let delay the next loop with 1,5 seconds
and the loop condition is that a particular attribute has a particular value.

this pattern is just a variation from the retry scope activity

1 Like

Should I put Get Attribute in Try section? And also Do While loop on top of them?
What should I select for the Catch section?

Find starter help here:
SyncLoops.xaml (11.3 KB)

1 Like

The example file you posted really helped a lot. But still there was a little problem for me. Here is what I faced and what I figured out:

I used Get Attribute activity to get aastate of the button in the Try Catch block. In some point of the loading, it took the inactive OK button’s attribute as “unavailable”, not “null” as I expected. So, that means it may somehow take the attribute while loading, and this made the “IsNullOrWhiteSpace” check to fail.

So I changed the loop: do while aastate is ‘unavailable’. When aastate turned out to ‘focusable’ state, I finally use the Click to click the active button! (Click is not shown in the screenshot)

Thank you very much for your help! And if it needs modifications, let me know please.