Breaking Changes
The v2 SDK is more flexible, easier to use, and has a more consistent API. It is also a lot more modular, meaning the majority of function calls have changed frombrowserbase.$thing$Do() to browserbase.$thing.$do(). For example:
Deleted Methods
load, loadUrl, and screenshot have been fully removed in the v2 SDK. You can use the following example instead that encapsulates the same functionality using Playwright:
Updates to Common Workflows
Create Session
This is how you would create a session with the v1 SDK:create method on sessions:
Get Connect URL
In the v1 SDK, you could runbrowserbase.getConnectUrl() to create a new session and retrieve its connect url, or browserbase.getConnectUrl({ sessionId: someSession.id }) to retrieve the connect url for an existing session.
bb.sessions.create(). Getting the connect url for an existing session is no longer supported.
Complete Session
v1 allowed you to complete a session by callingbrowserbase.completeSession():
REQUEST_RELEASE:
Reference for other methods
These methods have been rewritten for modularity and flexibility. As mentioned above, the pattern here is that the method has been renamed frombrowserbase.$thing$Do() to bb.$thing.$do().
List Sessions
Get Session
Get Session Recording
Get Session Downloads
Note: The parameterretryInterval is no longer supported. You can configure retries with the following syntax on initialization: