While Browserbase helps with anti-bot mechanisms,
scraping, and reliable file downloads among other features, some scenarios
remain challenging to fully automate for technical or data-privacy reasons.
Live Views can be useful for:
Debugging and observability - watch everything happening live, or share with users or coworkers
Human in the loop - instantly take control or provide input
handle iframes - loaded content might be external or could change without notice, potentially leading to error conditions without human intervention
delegate credentials - give control to the end user
Embedding - use within an application (both desktop and mobile)
We recommend listening to the Playwright new tab event (or equivalent in other libraries) to trigger a request to get new live view urls when needed.
Copy
Ask AI
// Open a new tab and navigate to googleconst newTab = await defaultContext.newPage();newTab.goto("https://www.google.com");// Get the live view links after the new tab is opened - then access the second tabconst liveViewLinks = await bb.sessions.debug(session.id);const allTabs = liveViewLinks.pages;const secondTabLiveViewLink = allTabs[1].debuggerFullscreenUrl;console.log(`🔍 Second Tab Live View Link: ${secondTabLiveViewLink}`);
const liveViewLinks = await bb.sessions.debug(session.id);const liveViewLink = liveViewLinks.debuggerUrl;console.log(`🔍 Live View Link - with borders: ${liveViewLink}`);
Often bugs from a rendering headless browser - some bugs may be amenable to directly adjusting css styling, for example through page.evaluate().
Lost Connection
If the live view loses its connection to the browser, the iframe will post a message to the window warning you of the new state.
JavaScript
Copy
Ask AI
window.addEventListener("message", function (event) { if (event.data === "browserbase-disconnected") { console.log("Message received from iframe:", event.data); // Handle the disconnection logic / new state }});
Assistant
Responses are generated using AI and may contain mistakes.