Close Browser
Close Browser
Section titled “Close Browser”Type: browser-close · Package: Browser v1.0.9
Closes the browser and frees its resources. It is the activity you finish a web automation with when you used Open Browser without body (Option B of the session model), or with keepOpen = true.
How it works
Section titled “How it works”It receives any page session of that browser and closes the whole browser, with all its tabs (including the ones the website opened itself):
- It ends the browser process that Open Browser started.
- It deletes the temporary profile Chrome or Edge was opened with. With
userDataDir, the person’s profile is not touched. - If the browser was already closed (the person closed it, or it closed on its own), it doesn’t fail: it leaves a warning in the log and continues.
After this, no session of that browser can be used again.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
session | ZoanPageSession | — | Any page session of the browser to close (from Open Browser, Attach Browser, New Page, Switch Page or Click with expectNewTab). |
Optional parameters
Section titled “Optional parameters”None.
Output
Section titled “Output”This activity does not return a value.
Example
Section titled “Example”Open Browser browser = chrome → output: pagePage Navigate page = page url = "https://example.com"... work ...Close Browser session = pageCommon errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
'session' must be a valid ZoanPageSession or ZoanBrowserSession with a browser reference. | The variable is empty or doesn’t hold a browser session. Pass the output of Open Browser (or of another activity that returns a ZoanPageSession). |
Related activities
Section titled “Related activities”- Open Browser — open the session you close here.
- Close Page — close just one tab, not the whole browser.
- Try / Catch — close in the
finallyso no browsers are left open.