Cua Docs

Export contacts overnight

Extract LinkedIn or X contacts overnight from a logged-in browser session into a clean CSV.

After a networking event, use Cua Driver on the machine where you already have a logged-in browser. The agent inherits that real authenticated session from the browser profile, so there are no credentials in the script and no anti-bot fight. Let it run overnight, then wake up to a CSV.

Log in once

On your own machine, open the browser profile that Cua Driver will drive and log into LinkedIn, X, or both. Do the normal login yourself, including any two-factor prompts. The session persistence is the whole trick: the overnight job starts from a browser that is already authenticated.

Keep the machine awake for the whole run. Disable sleep, leave the browser profile available, and keep the network connection up so the overnight run does not pause.

Install Cua Driver

Install cua-driver on the same machine:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/cua-driver/scripts/install.sh)"

Verify that the CLI is on your PATH:

cua-driver --version

Grant macOS permissions

On macOS, grant Accessibility and Screen Recording. Then verify the driver can see its permission state:

cua-driver call check_permissions

For overnight runs, keep the daemon running instead of depending on a terminal session. See Keep Cua Driver running.

Register it with your agent

Add cua-driver as a stdio MCP server in your agent. For Claude Code:

claude mcp add --transport stdio cua-driver -- cua-driver mcp

For other MCP clients, see Connect Cua Driver to an MCP client.

Give the overnight task

Ask the agent for the exact extraction you want. For LinkedIn, start from the connections page and cap the run with a clear N while you test:

Open the browser to https://www.linkedin.com/mynetwork/invite-connect/connections/ .
 
For each of the first 50 connections:
1. Open the profile.
2. Read first name, last name, role, company, and profile URL.
3. Append one row to ~/contacts.csv.
4. Set met_at to "Google Devfest Toronto" for every row.
 
Use this CSV header:
first,last,role,company,met_at,linkedin
 
If a value is missing, leave that field empty and keep going.

The agent will use page for browser navigation, then click, type_text, and get_window_state to inspect and drive the browser. It may call list_windows first if more than one browser window is open.

Cua Driver does not expose a filesystem write tool. The agent writes ~/contacts.csv by driving an app that can write files, for example a terminal running shell commands or a text editor with the CSV open.

Let it run

Kick off the task before you leave. In the morning, open ~/contacts.csv and spot-check the rows before importing them into a CRM or email tool.

Scale this out

One logged-in browser profile handles one account at a time. To process many accounts, events, or platforms in parallel overnight, move each authenticated session into its own Cua Sandbox cloud desktop. Log in once per sandbox, persist the session in the image, then fan the jobs out.

Use Run sandboxes in parallel to run many desktops at once, Images to bake the logged-in session into an image, and Run an agent in a sandbox for the agent loop.