@browserbasehq/sdk 1.1.1 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +30 -30
- package/dist/index.js +18 -18
- package/dist/integrations/ai-sdk.js +1 -1
- package/package.json +1 -1
- package/src/index.ts +45 -44
- package/src/integrations/ai-sdk.ts +1 -1
- package/test/lib.test.ts +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -39,53 +39,53 @@ export type Session = {
|
|
|
39
39
|
startedAt: string;
|
|
40
40
|
endedAt: string;
|
|
41
41
|
projectId: string;
|
|
42
|
-
status
|
|
43
|
-
taskId
|
|
44
|
-
proxyBytes
|
|
45
|
-
expiresAt
|
|
46
|
-
avg_cpu_usage
|
|
47
|
-
memory_usage
|
|
48
|
-
details
|
|
49
|
-
logs
|
|
42
|
+
status?: 'NEW' | 'CREATED' | 'ERROR' | 'RUNNING' | 'REQUEST_RELEASE' | 'RELEASING' | 'COMPLETED';
|
|
43
|
+
taskId?: string;
|
|
44
|
+
proxyBytes?: number;
|
|
45
|
+
expiresAt?: string;
|
|
46
|
+
avg_cpu_usage?: number;
|
|
47
|
+
memory_usage?: number;
|
|
48
|
+
details?: string;
|
|
49
|
+
logs?: string;
|
|
50
50
|
};
|
|
51
51
|
export type UpdateSessionOptions = {
|
|
52
52
|
projectId?: string;
|
|
53
53
|
status: Session['status'];
|
|
54
54
|
};
|
|
55
55
|
export type SessionRecording = {
|
|
56
|
-
type
|
|
57
|
-
timestamp
|
|
58
|
-
data
|
|
56
|
+
type?: number;
|
|
57
|
+
timestamp?: number;
|
|
58
|
+
data?: object;
|
|
59
59
|
};
|
|
60
60
|
export type SessionLog = {
|
|
61
|
-
sessionId
|
|
61
|
+
sessionId?: string;
|
|
62
62
|
id: string;
|
|
63
|
-
timestamp
|
|
64
|
-
method
|
|
65
|
-
request
|
|
66
|
-
timestamp
|
|
67
|
-
params
|
|
68
|
-
rawBody
|
|
63
|
+
timestamp?: string;
|
|
64
|
+
method?: string;
|
|
65
|
+
request?: {
|
|
66
|
+
timestamp?: string;
|
|
67
|
+
params?: object;
|
|
68
|
+
rawBody?: string;
|
|
69
69
|
};
|
|
70
|
-
response
|
|
71
|
-
timestamp
|
|
72
|
-
result
|
|
73
|
-
rawBody
|
|
70
|
+
response?: {
|
|
71
|
+
timestamp?: string;
|
|
72
|
+
result?: object;
|
|
73
|
+
rawBody?: string;
|
|
74
74
|
};
|
|
75
|
-
pageId
|
|
75
|
+
pageId?: string;
|
|
76
76
|
};
|
|
77
77
|
export type DebugConnectionURLs = {
|
|
78
|
-
debuggerFullscreenUrl
|
|
79
|
-
debuggerUrl
|
|
80
|
-
wsUrl
|
|
78
|
+
debuggerFullscreenUrl?: string;
|
|
79
|
+
debuggerUrl?: string;
|
|
80
|
+
wsUrl?: string;
|
|
81
81
|
};
|
|
82
82
|
export default class Browserbase {
|
|
83
83
|
private apiKey;
|
|
84
84
|
private projectId;
|
|
85
|
-
private
|
|
85
|
+
private baseAPIURL;
|
|
86
86
|
private baseConnectURL;
|
|
87
87
|
constructor(options?: ClientOptions);
|
|
88
|
-
|
|
88
|
+
connectURL({ sessionId, proxy }?: ConnectOptions): string;
|
|
89
89
|
listSessions(): Promise<Session[]>;
|
|
90
90
|
createSession(options?: CreateSessionOptions): Promise<Session>;
|
|
91
91
|
getSession(sessionId: string): Promise<Session>;
|
|
@@ -95,8 +95,8 @@ export default class Browserbase {
|
|
|
95
95
|
getSessionDownloads(sessionId: string, filePath: string, retryInterval?: number, retryCount?: number): Promise<void>;
|
|
96
96
|
getDebugConnectionURLs(sessionId: string): Promise<DebugConnectionURLs>;
|
|
97
97
|
load(url: string | string[], options?: LoadOptions): Promise<string> | AsyncGenerator<string, any, unknown>;
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
loadURL(url: string, options?: LoadOptions): Promise<string>;
|
|
99
|
+
loadURLs(urls: string[], options?: LoadOptions): AsyncGenerator<string>;
|
|
100
100
|
screenshot(url: string, options?: ScreenshotOptions): Promise<Buffer>;
|
|
101
101
|
}
|
|
102
102
|
export { Browserbase };
|
package/dist/index.js
CHANGED
|
@@ -3,20 +3,20 @@ import fs from 'fs/promises';
|
|
|
3
3
|
export default class Browserbase {
|
|
4
4
|
apiKey;
|
|
5
5
|
projectId;
|
|
6
|
-
|
|
6
|
+
baseAPIURL;
|
|
7
7
|
baseConnectURL;
|
|
8
8
|
constructor(options = {}) {
|
|
9
9
|
this.apiKey = options.apiKey || process.env.BROWSERBASE_API_KEY;
|
|
10
10
|
this.projectId = options.projectId || process.env.BROWSERBASE_PROJECT_ID;
|
|
11
|
-
this.
|
|
11
|
+
this.baseAPIURL = options.baseURL || 'https://www.browserbase.com';
|
|
12
12
|
this.baseConnectURL =
|
|
13
13
|
options.baseConnectURL || 'wss://connect.browserbase.com';
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
connectURL({ sessionId, proxy = false } = {}) {
|
|
16
16
|
return `${this.baseConnectURL}?apiKey=${this.apiKey}${sessionId ? `&sessionId=${sessionId}` : ''}${proxy ? `&enableProxy=true` : ''}`;
|
|
17
17
|
}
|
|
18
18
|
async listSessions() {
|
|
19
|
-
const response = await fetch(`${this.
|
|
19
|
+
const response = await fetch(`${this.baseAPIURL}/v1/sessions`, {
|
|
20
20
|
headers: {
|
|
21
21
|
'x-bb-api-key': this.apiKey,
|
|
22
22
|
'Content-Type': 'application/json',
|
|
@@ -25,7 +25,7 @@ export default class Browserbase {
|
|
|
25
25
|
return await response.json();
|
|
26
26
|
}
|
|
27
27
|
async createSession(options) {
|
|
28
|
-
const response = await fetch(`${this.
|
|
28
|
+
const response = await fetch(`${this.baseAPIURL}/v1/sessions`, {
|
|
29
29
|
method: 'POST',
|
|
30
30
|
headers: {
|
|
31
31
|
'x-bb-api-key': this.apiKey,
|
|
@@ -36,7 +36,7 @@ export default class Browserbase {
|
|
|
36
36
|
return await response.json();
|
|
37
37
|
}
|
|
38
38
|
async getSession(sessionId) {
|
|
39
|
-
const response = await fetch(`${this.
|
|
39
|
+
const response = await fetch(`${this.baseAPIURL}/v1/sessions/${sessionId}`, {
|
|
40
40
|
headers: {
|
|
41
41
|
'x-bb-api-key': this.apiKey,
|
|
42
42
|
'Content-Type': 'application/json',
|
|
@@ -45,7 +45,7 @@ export default class Browserbase {
|
|
|
45
45
|
return await response.json();
|
|
46
46
|
}
|
|
47
47
|
async updateSession(sessionId, options) {
|
|
48
|
-
const response = await fetch(`${this.
|
|
48
|
+
const response = await fetch(`${this.baseAPIURL}/v1/sessions/${sessionId}`, {
|
|
49
49
|
method: 'POST',
|
|
50
50
|
headers: {
|
|
51
51
|
'x-bb-api-key': this.apiKey,
|
|
@@ -56,7 +56,7 @@ export default class Browserbase {
|
|
|
56
56
|
return await response.json();
|
|
57
57
|
}
|
|
58
58
|
async getSessionRecording(sessionId) {
|
|
59
|
-
const response = await fetch(`${this.
|
|
59
|
+
const response = await fetch(`${this.baseAPIURL}/v1/sessions/${sessionId}/recording`, {
|
|
60
60
|
headers: {
|
|
61
61
|
'x-bb-api-key': this.apiKey,
|
|
62
62
|
'Content-Type': 'application/json',
|
|
@@ -65,7 +65,7 @@ export default class Browserbase {
|
|
|
65
65
|
return await response.json();
|
|
66
66
|
}
|
|
67
67
|
async getSessionLogs(sessionId) {
|
|
68
|
-
const response = await fetch(`${this.
|
|
68
|
+
const response = await fetch(`${this.baseAPIURL}/v1/sessions/${sessionId}/logs`, {
|
|
69
69
|
headers: {
|
|
70
70
|
'x-bb-api-key': this.apiKey,
|
|
71
71
|
'Content-Type': 'application/json',
|
|
@@ -76,7 +76,7 @@ export default class Browserbase {
|
|
|
76
76
|
async getSessionDownloads(sessionId, filePath, retryInterval = 2000, retryCount = 2) {
|
|
77
77
|
return new Promise((resolve, reject) => {
|
|
78
78
|
const fetchDownload = async () => {
|
|
79
|
-
const response = await fetch(`${this.
|
|
79
|
+
const response = await fetch(`${this.baseAPIURL}/v1/sessions/${sessionId}/downloads`, {
|
|
80
80
|
method: 'GET',
|
|
81
81
|
headers: {
|
|
82
82
|
'x-bb-api-key': this.apiKey,
|
|
@@ -100,7 +100,7 @@ export default class Browserbase {
|
|
|
100
100
|
});
|
|
101
101
|
}
|
|
102
102
|
async getDebugConnectionURLs(sessionId) {
|
|
103
|
-
const response = await fetch(`${this.
|
|
103
|
+
const response = await fetch(`${this.baseAPIURL}/v1/sessions/${sessionId}/debug`, {
|
|
104
104
|
method: 'GET',
|
|
105
105
|
headers: {
|
|
106
106
|
'x-bb-api-key': this.apiKey,
|
|
@@ -112,20 +112,20 @@ export default class Browserbase {
|
|
|
112
112
|
}
|
|
113
113
|
load(url, options = {}) {
|
|
114
114
|
if (typeof url === 'string') {
|
|
115
|
-
return this.
|
|
115
|
+
return this.loadURL(url, options);
|
|
116
116
|
}
|
|
117
117
|
else if (Array.isArray(url)) {
|
|
118
|
-
return this.
|
|
118
|
+
return this.loadURLs(url, options);
|
|
119
119
|
}
|
|
120
120
|
else {
|
|
121
121
|
throw new TypeError('Input must be a URL string or array of URLs');
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
-
async
|
|
124
|
+
async loadURL(url, options = {}) {
|
|
125
125
|
if (!url) {
|
|
126
126
|
throw new Error('Page URL was not provided');
|
|
127
127
|
}
|
|
128
|
-
const browser = await chromium.connectOverCDP(this.
|
|
128
|
+
const browser = await chromium.connectOverCDP(this.connectURL({ sessionId: options.sessionId, proxy: options.proxy }));
|
|
129
129
|
const defaultContext = browser.contexts()[0];
|
|
130
130
|
const page = defaultContext.pages()[0];
|
|
131
131
|
await page.goto(url);
|
|
@@ -142,11 +142,11 @@ export default class Browserbase {
|
|
|
142
142
|
await browser.close();
|
|
143
143
|
return html;
|
|
144
144
|
}
|
|
145
|
-
async *
|
|
145
|
+
async *loadURLs(urls, options = {}) {
|
|
146
146
|
if (!urls.length) {
|
|
147
147
|
throw new Error('Page URLs were not provided');
|
|
148
148
|
}
|
|
149
|
-
const browser = await chromium.connectOverCDP(this.
|
|
149
|
+
const browser = await chromium.connectOverCDP(this.connectURL({ sessionId: options.sessionId, proxy: options.proxy }));
|
|
150
150
|
const defaultContext = browser.contexts()[0];
|
|
151
151
|
const page = defaultContext.pages()[0];
|
|
152
152
|
for (const url of urls) {
|
|
@@ -169,7 +169,7 @@ export default class Browserbase {
|
|
|
169
169
|
if (!url) {
|
|
170
170
|
throw new Error('Page URL was not provided');
|
|
171
171
|
}
|
|
172
|
-
const browser = await chromium.connectOverCDP(this.
|
|
172
|
+
const browser = await chromium.connectOverCDP(this.connectURL({ sessionId: options.sessionId, proxy: options.proxy }));
|
|
173
173
|
const page = await browser.newPage();
|
|
174
174
|
await page.goto(url);
|
|
175
175
|
const screenshot = await page.screenshot({ fullPage: options.fullPage });
|
|
@@ -6,7 +6,7 @@ export default function BrowserbaseAISDK(b, options = {}) {
|
|
|
6
6
|
url: z.string().describe('Page URL to be loaded'),
|
|
7
7
|
}),
|
|
8
8
|
execute: async ({ url }) => {
|
|
9
|
-
const page = await b.
|
|
9
|
+
const page = await b.loadURL(url, options);
|
|
10
10
|
return { page };
|
|
11
11
|
},
|
|
12
12
|
};
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -46,20 +46,21 @@ export type Session = {
|
|
|
46
46
|
startedAt: string
|
|
47
47
|
endedAt: string
|
|
48
48
|
projectId: string
|
|
49
|
-
status
|
|
49
|
+
status?:
|
|
50
50
|
| 'NEW'
|
|
51
51
|
| 'CREATED'
|
|
52
52
|
| 'ERROR'
|
|
53
53
|
| 'RUNNING'
|
|
54
54
|
| 'REQUEST_RELEASE'
|
|
55
55
|
| 'RELEASING'
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
56
|
+
| 'COMPLETED'
|
|
57
|
+
taskId?: string
|
|
58
|
+
proxyBytes?: number
|
|
59
|
+
expiresAt?: string
|
|
60
|
+
avg_cpu_usage?: number
|
|
61
|
+
memory_usage?: number
|
|
62
|
+
details?: string
|
|
63
|
+
logs?: string
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
export type UpdateSessionOptions = {
|
|
@@ -68,57 +69,57 @@ export type UpdateSessionOptions = {
|
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
export type SessionRecording = {
|
|
71
|
-
type
|
|
72
|
-
timestamp
|
|
73
|
-
data
|
|
72
|
+
type?: number
|
|
73
|
+
timestamp?: number
|
|
74
|
+
data?: object
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
export type SessionLog = {
|
|
77
|
-
sessionId
|
|
78
|
+
sessionId?: string
|
|
78
79
|
id: string
|
|
79
|
-
timestamp
|
|
80
|
-
method
|
|
81
|
-
request
|
|
82
|
-
timestamp
|
|
83
|
-
params
|
|
84
|
-
rawBody
|
|
80
|
+
timestamp?: string
|
|
81
|
+
method?: string
|
|
82
|
+
request?: {
|
|
83
|
+
timestamp?: string
|
|
84
|
+
params?: object
|
|
85
|
+
rawBody?: string
|
|
85
86
|
}
|
|
86
|
-
response
|
|
87
|
-
timestamp
|
|
88
|
-
result
|
|
89
|
-
rawBody
|
|
87
|
+
response?: {
|
|
88
|
+
timestamp?: string
|
|
89
|
+
result?: object
|
|
90
|
+
rawBody?: string
|
|
90
91
|
}
|
|
91
|
-
pageId
|
|
92
|
+
pageId?: string
|
|
92
93
|
}
|
|
93
94
|
|
|
94
95
|
export type DebugConnectionURLs = {
|
|
95
|
-
debuggerFullscreenUrl
|
|
96
|
-
debuggerUrl
|
|
97
|
-
wsUrl
|
|
96
|
+
debuggerFullscreenUrl?: string
|
|
97
|
+
debuggerUrl?: string
|
|
98
|
+
wsUrl?: string
|
|
98
99
|
}
|
|
99
100
|
|
|
100
101
|
export default class Browserbase {
|
|
101
102
|
private apiKey: string
|
|
102
103
|
private projectId: string
|
|
103
|
-
private
|
|
104
|
+
private baseAPIURL: string
|
|
104
105
|
private baseConnectURL: string
|
|
105
106
|
|
|
106
107
|
constructor(options: ClientOptions = {}) {
|
|
107
108
|
this.apiKey = options.apiKey || process.env.BROWSERBASE_API_KEY!
|
|
108
109
|
this.projectId = options.projectId || process.env.BROWSERBASE_PROJECT_ID!
|
|
109
|
-
this.
|
|
110
|
+
this.baseAPIURL = options.baseURL || 'https://www.browserbase.com'
|
|
110
111
|
this.baseConnectURL =
|
|
111
112
|
options.baseConnectURL || 'wss://connect.browserbase.com'
|
|
112
113
|
}
|
|
113
114
|
|
|
114
|
-
|
|
115
|
+
connectURL({ sessionId, proxy = false }: ConnectOptions = {}): string {
|
|
115
116
|
return `${this.baseConnectURL}?apiKey=${this.apiKey}${
|
|
116
117
|
sessionId ? `&sessionId=${sessionId}` : ''
|
|
117
118
|
}${proxy ? `&enableProxy=true` : ''}`
|
|
118
119
|
}
|
|
119
120
|
|
|
120
121
|
async listSessions(): Promise<Session[]> {
|
|
121
|
-
const response = await fetch(`${this.
|
|
122
|
+
const response = await fetch(`${this.baseAPIURL}/v1/sessions`, {
|
|
122
123
|
headers: {
|
|
123
124
|
'x-bb-api-key': this.apiKey,
|
|
124
125
|
'Content-Type': 'application/json',
|
|
@@ -129,7 +130,7 @@ export default class Browserbase {
|
|
|
129
130
|
}
|
|
130
131
|
|
|
131
132
|
async createSession(options?: CreateSessionOptions): Promise<Session> {
|
|
132
|
-
const response = await fetch(`${this.
|
|
133
|
+
const response = await fetch(`${this.baseAPIURL}/v1/sessions`, {
|
|
133
134
|
method: 'POST',
|
|
134
135
|
headers: {
|
|
135
136
|
'x-bb-api-key': this.apiKey,
|
|
@@ -143,7 +144,7 @@ export default class Browserbase {
|
|
|
143
144
|
|
|
144
145
|
async getSession(sessionId: string): Promise<Session> {
|
|
145
146
|
const response = await fetch(
|
|
146
|
-
`${this.
|
|
147
|
+
`${this.baseAPIURL}/v1/sessions/${sessionId}`,
|
|
147
148
|
{
|
|
148
149
|
headers: {
|
|
149
150
|
'x-bb-api-key': this.apiKey,
|
|
@@ -160,7 +161,7 @@ export default class Browserbase {
|
|
|
160
161
|
options: UpdateSessionOptions
|
|
161
162
|
): Promise<Session> {
|
|
162
163
|
const response = await fetch(
|
|
163
|
-
`${this.
|
|
164
|
+
`${this.baseAPIURL}/v1/sessions/${sessionId}`,
|
|
164
165
|
{
|
|
165
166
|
method: 'POST',
|
|
166
167
|
headers: {
|
|
@@ -176,7 +177,7 @@ export default class Browserbase {
|
|
|
176
177
|
|
|
177
178
|
async getSessionRecording(sessionId: string): Promise<SessionRecording[]> {
|
|
178
179
|
const response = await fetch(
|
|
179
|
-
`${this.
|
|
180
|
+
`${this.baseAPIURL}/v1/sessions/${sessionId}/recording`,
|
|
180
181
|
{
|
|
181
182
|
headers: {
|
|
182
183
|
'x-bb-api-key': this.apiKey,
|
|
@@ -190,7 +191,7 @@ export default class Browserbase {
|
|
|
190
191
|
|
|
191
192
|
async getSessionLogs(sessionId: string): Promise<SessionLog[]> {
|
|
192
193
|
const response = await fetch(
|
|
193
|
-
`${this.
|
|
194
|
+
`${this.baseAPIURL}/v1/sessions/${sessionId}/logs`,
|
|
194
195
|
{
|
|
195
196
|
headers: {
|
|
196
197
|
'x-bb-api-key': this.apiKey,
|
|
@@ -211,7 +212,7 @@ export default class Browserbase {
|
|
|
211
212
|
return new Promise<void>((resolve, reject) => {
|
|
212
213
|
const fetchDownload = async () => {
|
|
213
214
|
const response = await fetch(
|
|
214
|
-
`${this.
|
|
215
|
+
`${this.baseAPIURL}/v1/sessions/${sessionId}/downloads`,
|
|
215
216
|
{
|
|
216
217
|
method: 'GET',
|
|
217
218
|
headers: {
|
|
@@ -243,7 +244,7 @@ export default class Browserbase {
|
|
|
243
244
|
sessionId: string
|
|
244
245
|
): Promise<DebugConnectionURLs> {
|
|
245
246
|
const response = await fetch(
|
|
246
|
-
`${this.
|
|
247
|
+
`${this.baseAPIURL}/v1/sessions/${sessionId}/debug`,
|
|
247
248
|
{
|
|
248
249
|
method: 'GET',
|
|
249
250
|
headers: {
|
|
@@ -259,21 +260,21 @@ export default class Browserbase {
|
|
|
259
260
|
|
|
260
261
|
load(url: string | string[], options: LoadOptions = {}) {
|
|
261
262
|
if (typeof url === 'string') {
|
|
262
|
-
return this.
|
|
263
|
+
return this.loadURL(url, options)
|
|
263
264
|
} else if (Array.isArray(url)) {
|
|
264
|
-
return this.
|
|
265
|
+
return this.loadURLs(url, options)
|
|
265
266
|
} else {
|
|
266
267
|
throw new TypeError('Input must be a URL string or array of URLs')
|
|
267
268
|
}
|
|
268
269
|
}
|
|
269
270
|
|
|
270
|
-
async
|
|
271
|
+
async loadURL(url: string, options: LoadOptions = {}): Promise<string> {
|
|
271
272
|
if (!url) {
|
|
272
273
|
throw new Error('Page URL was not provided')
|
|
273
274
|
}
|
|
274
275
|
|
|
275
276
|
const browser = await chromium.connectOverCDP(
|
|
276
|
-
this.
|
|
277
|
+
this.connectURL({ sessionId: options.sessionId, proxy: options.proxy })
|
|
277
278
|
)
|
|
278
279
|
const defaultContext = browser.contexts()[0]
|
|
279
280
|
const page = defaultContext.pages()[0]
|
|
@@ -295,7 +296,7 @@ export default class Browserbase {
|
|
|
295
296
|
return html
|
|
296
297
|
}
|
|
297
298
|
|
|
298
|
-
async *
|
|
299
|
+
async *loadURLs(
|
|
299
300
|
urls: string[],
|
|
300
301
|
options: LoadOptions = {}
|
|
301
302
|
): AsyncGenerator<string> {
|
|
@@ -304,7 +305,7 @@ export default class Browserbase {
|
|
|
304
305
|
}
|
|
305
306
|
|
|
306
307
|
const browser = await chromium.connectOverCDP(
|
|
307
|
-
this.
|
|
308
|
+
this.connectURL({ sessionId: options.sessionId, proxy: options.proxy })
|
|
308
309
|
)
|
|
309
310
|
const defaultContext = browser.contexts()[0]
|
|
310
311
|
const page = defaultContext.pages()[0]
|
|
@@ -339,7 +340,7 @@ export default class Browserbase {
|
|
|
339
340
|
}
|
|
340
341
|
|
|
341
342
|
const browser = await chromium.connectOverCDP(
|
|
342
|
-
this.
|
|
343
|
+
this.connectURL({ sessionId: options.sessionId, proxy: options.proxy })
|
|
343
344
|
)
|
|
344
345
|
const page = await browser.newPage()
|
|
345
346
|
await page.goto(url)
|
|
@@ -12,7 +12,7 @@ export default function BrowserbaseAISDK(
|
|
|
12
12
|
url: z.string().describe('Page URL to be loaded'),
|
|
13
13
|
}),
|
|
14
14
|
execute: async ({ url }: { url: string }) => {
|
|
15
|
-
const page = await b.
|
|
15
|
+
const page = await b.loadURL(url, options)
|
|
16
16
|
return { page }
|
|
17
17
|
},
|
|
18
18
|
}
|
package/test/lib.test.ts
CHANGED
|
@@ -51,7 +51,7 @@ describe('Browserbase', () => {
|
|
|
51
51
|
})
|
|
52
52
|
|
|
53
53
|
it('should load URLs', async () => {
|
|
54
|
-
const result = await browserbase.
|
|
54
|
+
const result = await browserbase.loadURLs(['https://example.com'])
|
|
55
55
|
const page = await result.next()
|
|
56
56
|
|
|
57
57
|
// finish iterator
|