Wait for page element


Typical situation for (web)UI automation is a need to synchronize pages flow with “robot” workflow. Typical implementation is a wait for answer after search or other actions which results in page change.

There are in activities some tools like a “timeout”, “wait for ready”, “minResults” and hints like OpenRPA - FAQ — BPA/OpenIAP Docs 1.0.5 documentation

but they are mainly static and all seems to be not enough for that task.
The most effective in many cases is just a long “timeout”, but this have a drastic impact on the performance.

I tried to use “check-that-an-element-exists”, but it is effective when element really exists. I need to check “check-that-an-element-does-not-exists” and wait for its appearance. It needs a repetitive run of get_element activity.

I tried to use construction with “while” like on the screen, but I am not able to define (type?) element returned by nm.get_element.

Kind regards,

you can use this logic

while item=0
get element (property elements= tabitems)
item=tabitems.count (this will assign number of elements found in get elements)

This way you can implement wait for element


This is exactly what I mentioned to do…
My problem is, that I am not familiar with data/objects model of this environment and do not know type of variable, which I have to declare for “while” and “elements” parameter.

Kind regards,

You don’t need loop for that.
Get Element will try and get the element if it was not found it will re try until the value in Timeout has passed.
If instead want check that an item goes away, use Get Element to find it, and then use


to wait for it to disappear

I used this approach always when I expected quite long and unpredictable time of operation (even 15s - mainly “search”). However, I observe different behaviour, workflow always wait up to the “timeout” value and when it passed, try to do next step, if the element appeared.

This prompted me to consider the loop.

Kind regards,

PS. Sorry for the fork… Could you tell me how to declare variable for “elements” parameter? When I create one of NMElement type I got the compile error “Cannot convert value of type OpenRPA.NM.NMElement to one dimension array of OpenRPA.NM.NMElement elements”. Message is not exactly in that I presented as OS is not english and openRPA speaks to me in my native language… :\

Delete the variable, go to the field, and type the name you want for a variable then pres Ctrl+K to auto create one of the correct type. Elements is the RESULT of the get element, this variable will contain all the found results once you get past the Get Element ( NEVER use that inside an Get Element ! )

1 Like

It seems to be changed, when I set “wait for ready” and/or “wait for tab” (not sure, which is more important) parameter to true.

Kind regards,

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.