Skip to content

Session Management

client.close()

Closes the browser from the most recent connect_url() call. If no session is active, this is a no-op.

If your client disconnects, you can reconnect to the same browser without creating a new one:

session_id = client.last_session_id
# Later, reconnect:
ws_url = client.reconnect_url(session_id)
browser = p.chromium.connect_over_cdp(ws_url)
const { limit, remaining } = await client.getSessionCount();
console.log(`${remaining}/${limit} sessions available`);

After calling connect_url() / connectUrl():

PropertyPythonNode.jsDescription
Session IDclient.last_session_idclient.sessionIdUnique session identifier
VNC URLclient.last_vnc_urlclient.vncUrlnoVNC URL (when vnc=True)