Close Browser
Closes the specified browser.
Common Properties
- Name - The custom name of the node.
- Color - The custom color of the node.
- Delay Before (sec) - Waits in seconds before executing the node.
- Delay After (sec) - Waits in seconds after executing node.
- Continue On Error - Automation will continue regardless of any error. The default value is false.
info
If ContinueOnError property is true, no error is caught when the project is executed even if a Catch node is used.
Input
- Browser Id - The identifier of the browser to be closed.
Note that using this node ends the browser process completely, the msg.browser_id will be invalid and you will not be able to use Open Link with this msg.browser_id any more or an exception will be thrown.
How It Works
- The node receives the Browser ID and waits for any configured delay before execution
- It validates that the Browser ID is not empty
- It retrieves the WebDriver instance associated with the Browser ID
- The node stops the browser process completely
- It cleans up temporary directories created during the browser session
- It removes the browser driver instance from the internal registry
- The node applies any configured delay after execution
Requirements
- A valid Browser ID from the Open Browser node
- The browser session must still be active and not already closed
- Proper permissions to terminate browser processes
Error Handling
| Error Code | Description |
|---|---|
| Core.Browser.Open.ErrOnCreate | Configuration parsing error during node creation |
| Core.Browser.Open.ErrOnMessage | Error parsing incoming message data |
| Core.Browser.Close.ErrBrowserId | Browser ID is empty or invalid/not found |
| Core.Browser.Close.Err | Failed to stop the browser process |
Usage Examples
Example 1: Simple Browser Session Cleanup
When automating a single task and closing the browser:
1. Use Open Browser to start a browser session (stores browser_id)
2. Perform your automation tasks (navigate, click, extract data, etc.)
3. Use Close Browser with the browser_id to terminate the session
4. Continue with data processing or other non-browser tasks
Example 2: Multiple Browser Sessions
When working with multiple browsers simultaneously:
1. Use Open Browser to create first session (browser_id_1)
2. Use Open Browser to create second session (browser_id_2)
3. Perform tasks in browser_id_1
4. Use Close Browser with browser_id_1 to close first browser
5. Continue working with browser_id_2
6. Use Close Browser with browser_id_2 when done
Example 3: Error Recovery with Browser Cleanup
When handling errors in browser automation:
1. Use Try node to wrap your browser automation
2. Perform browser operations
3. In the Catch block:
- Log the error
- Use Close Browser to clean up the browser session
- Prevent resource leaks from abandoned browser instances
4. Continue with error recovery logic
Usage Notes
- Close Browser terminates the entire browser process, not just a single tab/window
- After closing, the Browser ID becomes invalid and cannot be reused
- All pages, windows, and tabs associated with the browser are closed
- Temporary files and directories created by the browser session are cleaned up
- If the browser was already closed or crashed, the node will return an error
- Use Close Window instead if you only want to close a specific tab/window
- Closing the browser releases all associated system resources (memory, CPU, etc.)
Tips
- Always close browsers when automation is complete to prevent resource leaks
- Use Try-Catch blocks to ensure browsers are closed even if errors occur
- Store the Browser ID in a variable at the flow level for easy access
- For long-running automations, consider closing and reopening browsers periodically
- Monitor system resources if running multiple browser sessions
- Close browsers before robot termination to avoid orphaned browser processes
- Consider using Continue On Error = false to catch closure failures
Related Nodes
- Open Browser - Creates the browser session and Browser ID
- Close Window - Closes a specific window/tab without terminating the browser
- Switch Window - Switches between browser windows before closing