SAP — Wait for element
SAP — Wait for element
Section titled “SAP — Wait for element”Type: sap-wait-for-element · Package: SAP Activities v1.0.5
Waits until an element appears on the SAP screen: a field on the next screen, a grid that takes a while to load, a pop-up dialog. If the element does not appear within the time limit, the activity fails.
How it works
Section titled “How it works”Checks every 200 milliseconds whether the element given by selector exists in the session. Before each check it waits for SAP to finish whatever it is processing, so an element from the previous screen doesn’t count as found. As soon as it does, the flow continues. If the timeout (in seconds) passes without it appearing, the activity fails with a timeout error.
It only checks that the element exists; it does not read or change anything.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
selector | selector | — | Element to wait for. Captured selector or SAP id, for example wnd[1] for a pop-up dialog. |
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
session | ZoanSapSession | — | SAP session. Omit it inside the body of an SAP — Attach or SAP — Log on. |
timeout | number | — | Seconds to wait. Empty: the scope’s elementTimeout (30 s unless changed). Decimals allowed, for example 2.5; with 0 it checks only once. |
Output
Section titled “Output”This activity does not return a value.
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
Component '…' did not appear within … s. | The element did not appear in time. Raise timeout if the screen is slow, or use SAP — Element exists if the element is optional. |
'timeout' must be a number of seconds; got '…'. | timeout is not a number or is negative. |
'selector' is required. | The selector arrived empty. |
Plus the errors common to all activities.
Example
Section titled “Example”Wait for the result grid of a heavy report, with more margin than usual:
SAP — Run transaction code = "ZREPORTE01"SAP — Send key key = F8SAP — Wait for element selector = "wnd[0]/usr/cntlGRID1/shellcont/shell" timeout = 120SAP — Read table selector = "wnd[0]/usr/cntlGRID1/shellcont/shell" → output: rowsRelated activities
Section titled “Related activities”- SAP — Element exists — check whether an element is there, without waiting or failing.
- SAP — Attach — where the general
elementTimeoutis set. - SAP — Close modal — close a pop-up dialog that appeared.