Skip to content
Dashboard

Manage Browser Tabs

Open, switch, and close browser tabs for multi-tab workflows.

Lightcone browser sessions support multi-tab management. Open tabs to compare data across sites, fill forms that span multiple pages, or monitor dashboards side by side. Each tab has its own URL and page state, and you can target actions at specific tabs without switching.

from tzafon import Lightcone
client = Lightcone()
session = client.computers.create(kind="browser")
result = client.computers.tabs.list(session.id)
print(result.result) # List of tabs with id, url, title, is_main_tab
import Lightcone from "@tzafon/lightcone";
const client = new Lightcone();
const session = await client.computers.create({ kind: "browser" });
const result = await client.computers.tabs.list(session.id!);
console.log(result.result);
client.computers.tabs.create(session.id, url="https://example.com")
await client.computers.tabs.create(session.id!, { url: "https://example.com" });

The new tab becomes the active (main) tab automatically.

# List tabs to get IDs
tabs_result = client.computers.tabs.list(session.id)
# Switch to a specific tab by ID
client.computers.tabs.switch("tab_abc123", id=session.id)
const tabsResult = await client.computers.tabs.list(session.id!);
await client.computers.tabs.switch("tab_abc123", { id: session.id! });
client.computers.tabs.delete("tab_abc123", id=session.id)
await client.computers.tabs.delete("tab_abc123", { id: session.id! });

Most actions accept a tab_id parameter to target a specific tab without switching:

# Take a screenshot of a background tab
client.computers.screenshot(session.id, tab_id="tab_abc123")
# Type into a background tab
client.computers.type(session.id, text="hello", tab_id="tab_abc123")
await client.computers.screenshot(session.id!, { tab_id: "tab_abc123" });
await client.computers.type(session.id!, { text: "hello", tab_id: "tab_abc123" });
with client.computer.create(kind="browser") as computer:
# Open first page
computer.navigate("https://en.wikipedia.org/wiki/Python_(programming_language)")
computer.wait(2)
# Open second page in a new tab
client.computers.tabs.create(computer.id, url="https://en.wikipedia.org/wiki/JavaScript")
# Wait for load, then screenshot the second tab
computer.wait(2)
result = computer.screenshot()
print(f"Tab 2: {computer.get_screenshot_url(result)}")
# List tabs to get the first tab's ID
tabs = client.computers.tabs.list(computer.id)
# Switch back to the first tab
first_tab = tabs.result # contains tab IDs
const session = await client.computers.create({ kind: "browser" });
const id = session.id!;
try {
// Open first page
await client.computers.navigate(id, {
url: "https://en.wikipedia.org/wiki/Python_(programming_language)",
});
// Open second page in a new tab
await client.computers.tabs.create(id, {
url: "https://en.wikipedia.org/wiki/JavaScript",
});
// Screenshot the second tab (now active)
const result = await client.computers.screenshot(id);
console.log("Tab 2 screenshot:", result.result?.screenshot_url);
// List tabs and switch back
const tabs = await client.computers.tabs.list(id);
console.log("Open tabs:", tabs.result);
} finally {
await client.computers.delete(id);
}
  • Tab IDs come from tabs.list() — always list tabs to discover IDs
  • New tabs become the main tab — actions without tab_id target the main tab
  • Tab list may be eventually consistent — wait briefly after creating a tab before listing
  • Use tab_id on actions to interact with background tabs without switching