Using a Remote Browser

Check Browser Status

In this guide, you will check the browser’s status. Checking a browser’s status is helpful if you ever need to verify the exact state of the browser’s pages.

To check a browser’s status, use the BytebotClient.browser.status(sessionId: String) function. It just accepts a string as the input.

The return object will have a few attributes that detail the browser’s activity:

AttributeDescription
sessionIdThe sessionId of the browser, represented as a string
statusThe string representation of the browser’s status
pagesAn array of pages available on the browser session

You can check a browser’s status at any time. For example, you can check it after running an action:

1import { BytebotClient } from "./src/index.ts";
2import "dotenv/config";
3
4const bytebot = new BytebotClient({
5 apiKey: process.env.BYTEBOT_API_KEY,
6});
7
8async function run() {
9 const browser = await bytebot.browser.startSession(
10 "https://developer.chrome.com/"
11 );
12
13 if (browser.sessionId) {
14 const prompt = "click on the Get Started button";
15 const actions = await bytebot.browser.act({
16 sessionId: browser.sessionId,
17 prompt: prompt,
18 });
19 const status = await bytebot.browser.status(browser.sessionId);
20 console.log(status);
21 }
22}
23
24run().catch(console.error);

Next Steps

Now with the fundamentals down, you can move on to creating more complex flows that combine multiple actions and extractions.