TabSailTabSail

Performance

Reduce unnecessary browser and page work.

With an initialized client and Playwright's chromium import:

await client.withSession({ timeoutSeconds: 300 }, async (session) => {
  const grant = await client.sessions.connections.create(session.id, { type: "cdp" });
  const browser = await chromium.connectOverCDP(grant.url);
  try {
    const context = browser.contexts()[0];
    const page = context.pages()[0] ?? await context.newPage();
    await page.goto("https://example.com", { waitUntil: "domcontentloaded" });
    await page.getByRole("heading", { name: "Example Domain" }).waitFor();
  } finally {
    await browser.close();
  }
});
PreferWhy
Wait for the specific content you needAvoid arbitrary sleeps and unbounded network-idle waits
Reuse the existing contextPreserve session configuration and cookies
Keep related steps in one browserAvoid repeated startup and sign-in
Retrieve only required outputsReduce screenshots and transfer overhead
Pick an enabled regionTest caller-to-browser and browser-to-site latency

Prepared browsers can reduce startup time, but bursts and custom viewports may require a cold start. Measure creation-to-CDP separately from page actions. No fixed latency or throughput guarantee is published.