Attach Browser
Attach Browser
Section titled “Attach Browser”Type: browser-attach · Package: Browser v1.0.9 · Output: ZoanPageSession
Reuses a browser session you already have open, instead of opening a new one with Open Browser. Useful when a session was created earlier (in another part of the playbook, or in a sub-playbook you passed it to) and you want to keep working with it, or when several sections of the flow share the same browser.
How it works
Section titled “How it works”It receives a page session (ZoanPageSession) stored in a variable. If you give it a body, the activities inside inherit that session automatically (you don’t need to pass page to each one), just like with Open Browser.
- It doesn’t open or close anything: when the
bodyfinishes the browser stays open. Close it when you’re done with Close Browser. - It works with sessions the playbook already obtained (from Open Browser, New Page, Switch Page or Click with
expectNewTab); it doesn’t connect to a browser the person opened on their own. - After the
body, activities go back to the page they inherited before (if it was inside anotherbody).
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
page | ZoanPageSession | — | The variable with the page session to pick up, e.g. page. |
Optional parameters
Section titled “Optional parameters”None.
Sub-flows
Section titled “Sub-flows”Optional. Activities to run with this browser session. They inherit the session automatically.
Output
Section titled “Output”- Without
body: returns the sameZoanPageSessionit received. - With
body: it doesn’t return a value.
Example
Section titled “Example”Reuse, in a later section, a browser opened earlier with keepOpen:
Open Browser browser = chrome keepOpen = true → output: page └─ body: Page Navigate url = "https://portal.example.com" ... login ...
// later in the flowAttach Browser page = page └─ body: Extract Structured Data selector = (#movimientos) → output: datos
Close Browser session = pageCommon errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
'page' must be a valid ZoanPageSession object. | The variable is empty or doesn’t hold a page session (for example, the output of Open Browser with body and without keepOpen, which returns nothing). Store the session with keepOpen = true or from Open Browser without body. |
Related activities
Section titled “Related activities”- Open Browser — open the browser you then reuse.
- New Page — open another tab in the same browser.
- Close Browser — close the browser when you’re done.