Get Text
Get Text
Section titled “Get Text”Type: page-get-text · Package: Browser v1.0.9 · Output: string
Reads the visible text of an element (its innerText) and returns it as a string. It’s the key activity for extracting data from a page: a total, a name, a status message, the result of a search.
How it works
Section titled “How it works”It locates the element by its selector, waits for it to exist on the page (up to timeout) and returns its visible text, including that of its child elements. Store the result in an output variable to use it later.
- It returns the text as you see it: it keeps line breaks between blocks and leaves out text hidden with CSS.
- The text isn’t written to the log (it may be business data): the log only says which element it was read from.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
selector | selector | — | The element whose text you want to read. |
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
page | ZoanPageSession | — | The page session. Omit it inside a body; outside, pass the session variable (e.g. page = page). |
timeout | number | 30000 | Maximum time in ms to wait for the element. Empty, 0 or negative: the project settings value or, if none, 30000. |
Output
Section titled “Output”Returns a string with the visible text. If the element exists but has no text (or is hidden), it returns "". Store it in a variable (the Output field).
Example
Section titled “Example”Page Get Text selector = (.saldo-actual) → output: saldoTextoSet Variable name = saldo value = parseDouble(replace(replace(saldoTexto, "$", ""), ",", ""))Log message = "Balance: " + saldoCommon errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
Timeout 30000ms exceeded | The element didn’t appear in time. Check the selector or wait first with Wait For. |
strict mode violation: … resolved to 2 elements | The selector matches several elements. Make it more specific or add an index. To read many values at once, use Extract Structured Data. |
'page' must be a ZoanPageSession. | page is empty outside a body. |
Related activities
Section titled “Related activities”- Get Value — read the value of form fields.
- Get Attribute — read an HTML attribute (href, src…).
- Extract Structured Data — extract a whole table at once.