---
version: "2026.1.0"
language: "en"
---
# Connect to Session

The **Connect to Session** block is used to attach to an active terminal session during execution. This is required before interacting with mainframe or green screen interfaces using Leapwork's terminal automation capabilities.

**Note:** A terminal session must already be active for this block to connect successfully. You can use desktop building blocks to build a sub-flow that starts the session automatically. Setup steps may vary depending on the terminal type, such as IBM i Access or Rumba+ Desktop.

**The Green Screen Recorder and building blocks are available with Enterprise plans.**

Fully expanded, the **Connect to Session** block shows the following properties:

**Note:** The screenshot on this page uses the **Elegance Design**, introduced in **2025.3**. If you are using an earlier version, your layout may look different.

## Quick-start

1. Drag **Connect to Session** onto the canvas.

2. Specify the basic parameter required for this block to operate: **Terminal session type**.

3. Run the flow when it's ready.

## Building block parameters

### Parameters  
* **Block header**: The green input connector triggers the block to begin execution. The green output connector triggers when a terminal session is successfully connected. You can rename the block title by double-clicking it and typing in a new title.

* **Terminal session type**: Selects which terminal session to connect to. Leapwork supports sessions **A--Z** (uppercase) and lets you switch between sessions within the same flow. **Automatic** connects to the latest active session.

* **Error occurred**: Triggers if **Connect to Session** returns an error during execution, so you can branch your flow.

* **Default timeout**: If the checkbox is not selected, the timeout is **10 seconds** unless changed manually. If the checkbox is selected, the flow's **Default timeout** under **Max. run time** applies.

* **Timeout (sec)**: The maximum time spent trying to connect to the terminal session before giving up. This value is used when **Default timeout** is not selected.

## Resources

| **Topic** | **Description** |
|-----------|----------------|
| [Flows FAQ](https://docs.leapwork.com/faq/latest/leapwork-flow-faq/flows-faq.md) | Common questions about creating, running, and managing flows in Leapwork. |
| [Flows Troubleshooting](https://docs.leapwork.com/troubleshooting/latest/leapwork-flow-troubleshooting/flows-troubleshooting.md) | Guidelines and solutions for identifying and fixing issues that occur when building or running flows in Leapwork.
