Get attribute
Read an attribute of an element, e.g. href or value.
Command in the Browser toolkit · id ooa.browser/get_attribute · 7 inputs (1 required), 2 outputs
Inputs
| Input | Type | Required | Default | What it is |
|---|---|---|---|---|
| Captured object | Dictionary | No | The captured object from Capture or Pick in OneAgentStudio: the element's properties to match (each with use and a match rule: equals, not_equals, contains, starts_with, ends_with, wildcard or regex), search_by (properties, css or xpath), index and iframes. Used instead of the selector when given. | |
| Selector | String | No | Element selector, used when no captured object is given: CSS (#id, .class), text="Sign in", role=button[name="Save"] or xpath=//input[@name='q']. | |
| Attribute | String | Yes | Attribute name; use value for input fields. | |
| Wait up to (milliseconds) | Number | No | 30000 | How long to wait for the element, in milliseconds. |
| Session | String | No | browser | Session name. |
| Window | Dictionary | No | Which window to act in. Leave empty to use the session's current tab. {"source": "browser", "title": "Invoice * - Shop", "title_match": "wildcard", "url": "...", "url_match": "contains", "browser": "edge"} switches to the first open tab whose title and/or address matches (also in attached browsers, and in one listening on port 9222); {"source": "variable", "variable": "session name"} uses that browser session; {"source": "application", "title": "..."} names a desktop window, which works only when it is a window of an attached browser. Matches: wildcard (default for the title), contains (default for the address), equals or regex; text matches ignore case. Values may use variables. | |
| If not found | String | No | error | When the element is not there in time: error stops with an error; continue leaves the result empty, sets found to false and carries on. |
Outputs
| Output | Type | What it is |
|---|---|---|
| value | String | Attribute value, empty when missing. |
| found | Boolean | False when the element was not there in time (if_not_found = continue). |