browserclaw 0.7.0 → 0.8.0

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.cts CHANGED
@@ -195,6 +195,17 @@ interface LaunchOptions {
195
195
  * @deprecated Use `ssrfPolicy: { dangerouslyAllowPrivateNetwork: true }` instead.
196
196
  */
197
197
  allowInternal?: boolean;
198
+ /**
199
+ * Record video for all pages. Requires a directory to save video files.
200
+ * Videos are saved when the page or context is closed.
201
+ */
202
+ recordVideo?: {
203
+ dir: string;
204
+ size?: {
205
+ width: number;
206
+ height: number;
207
+ };
208
+ };
198
209
  }
199
210
  /** Options for connecting to an existing browser instance. */
200
211
  interface ConnectOptions {
@@ -215,6 +226,17 @@ interface ConnectOptions {
215
226
  * (e.g. OpenClaw browser control with gateway.auth.token).
216
227
  */
217
228
  authToken?: string;
229
+ /**
230
+ * Record video for all pages. Requires a directory to save video files.
231
+ * Videos are saved when the page or context is closed.
232
+ */
233
+ recordVideo?: {
234
+ dir: string;
235
+ size?: {
236
+ width: number;
237
+ height: number;
238
+ };
239
+ };
218
240
  }
219
241
  /**
220
242
  * Describes a single interactive element found during a snapshot.
@@ -644,6 +666,68 @@ declare class CrawlPage {
644
666
  * ```
645
667
  */
646
668
  click(ref: string, opts?: ClickOptions): Promise<void>;
669
+ /**
670
+ * Click at specific page coordinates.
671
+ *
672
+ * Useful for canvas elements, custom widgets, or elements without ARIA roles.
673
+ *
674
+ * @param x - X coordinate in pixels
675
+ * @param y - Y coordinate in pixels
676
+ * @param opts - Click options (button, clickCount, delayMs)
677
+ *
678
+ * @example
679
+ * ```ts
680
+ * await page.mouseClick(100, 200);
681
+ * await page.mouseClick(100, 200, { button: 'right' });
682
+ * await page.mouseClick(100, 200, { clickCount: 2 }); // double-click
683
+ * ```
684
+ */
685
+ mouseClick(x: number, y: number, opts?: {
686
+ button?: 'left' | 'right' | 'middle';
687
+ clickCount?: number;
688
+ delayMs?: number;
689
+ }): Promise<void>;
690
+ /**
691
+ * Click an element by its visible text content (no snapshot/ref needed).
692
+ *
693
+ * Finds and clicks atomically — no stale ref problem.
694
+ *
695
+ * @param text - Text content to match
696
+ * @param opts - Options (exact: require full match, button, modifiers)
697
+ *
698
+ * @example
699
+ * ```ts
700
+ * await page.clickByText('Submit');
701
+ * await page.clickByText('Save Changes', { exact: true });
702
+ * ```
703
+ */
704
+ clickByText(text: string, opts?: {
705
+ exact?: boolean;
706
+ button?: 'left' | 'right' | 'middle';
707
+ modifiers?: ('Alt' | 'Control' | 'ControlOrMeta' | 'Meta' | 'Shift')[];
708
+ timeoutMs?: number;
709
+ }): Promise<void>;
710
+ /**
711
+ * Click an element by its ARIA role and accessible name (no snapshot/ref needed).
712
+ *
713
+ * Finds and clicks atomically — no stale ref problem.
714
+ *
715
+ * @param role - ARIA role (e.g. `'button'`, `'link'`, `'menuitem'`)
716
+ * @param name - Accessible name to match (optional)
717
+ * @param opts - Click options
718
+ *
719
+ * @example
720
+ * ```ts
721
+ * await page.clickByRole('button', 'Save');
722
+ * await page.clickByRole('link', 'Settings');
723
+ * await page.clickByRole('menuitem', 'Delete');
724
+ * ```
725
+ */
726
+ clickByRole(role: string, name?: string, opts?: {
727
+ button?: 'left' | 'right' | 'middle';
728
+ modifiers?: ('Alt' | 'Control' | 'ControlOrMeta' | 'Meta' | 'Shift')[];
729
+ timeoutMs?: number;
730
+ }): Promise<void>;
647
731
  /**
648
732
  * Type text into an input element by ref.
649
733
  *
@@ -1243,6 +1327,7 @@ declare class CrawlPage {
1243
1327
  declare class BrowserClaw {
1244
1328
  private readonly cdpUrl;
1245
1329
  private readonly ssrfPolicy;
1330
+ private readonly recordVideo;
1246
1331
  private chrome;
1247
1332
  private constructor();
1248
1333
  /**
@@ -1283,7 +1368,7 @@ declare class BrowserClaw {
1283
1368
  * const browser = await BrowserClaw.connect('http://localhost:9222');
1284
1369
  * ```
1285
1370
  */
1286
- static connect(cdpUrl: string, opts?: ConnectOptions): Promise<BrowserClaw>;
1371
+ static connect(cdpUrl?: string, opts?: ConnectOptions): Promise<BrowserClaw>;
1287
1372
  /**
1288
1373
  * Open a URL in a new tab and return the page handle.
1289
1374
  *
package/dist/index.d.ts CHANGED
@@ -195,6 +195,17 @@ interface LaunchOptions {
195
195
  * @deprecated Use `ssrfPolicy: { dangerouslyAllowPrivateNetwork: true }` instead.
196
196
  */
197
197
  allowInternal?: boolean;
198
+ /**
199
+ * Record video for all pages. Requires a directory to save video files.
200
+ * Videos are saved when the page or context is closed.
201
+ */
202
+ recordVideo?: {
203
+ dir: string;
204
+ size?: {
205
+ width: number;
206
+ height: number;
207
+ };
208
+ };
198
209
  }
199
210
  /** Options for connecting to an existing browser instance. */
200
211
  interface ConnectOptions {
@@ -215,6 +226,17 @@ interface ConnectOptions {
215
226
  * (e.g. OpenClaw browser control with gateway.auth.token).
216
227
  */
217
228
  authToken?: string;
229
+ /**
230
+ * Record video for all pages. Requires a directory to save video files.
231
+ * Videos are saved when the page or context is closed.
232
+ */
233
+ recordVideo?: {
234
+ dir: string;
235
+ size?: {
236
+ width: number;
237
+ height: number;
238
+ };
239
+ };
218
240
  }
219
241
  /**
220
242
  * Describes a single interactive element found during a snapshot.
@@ -644,6 +666,68 @@ declare class CrawlPage {
644
666
  * ```
645
667
  */
646
668
  click(ref: string, opts?: ClickOptions): Promise<void>;
669
+ /**
670
+ * Click at specific page coordinates.
671
+ *
672
+ * Useful for canvas elements, custom widgets, or elements without ARIA roles.
673
+ *
674
+ * @param x - X coordinate in pixels
675
+ * @param y - Y coordinate in pixels
676
+ * @param opts - Click options (button, clickCount, delayMs)
677
+ *
678
+ * @example
679
+ * ```ts
680
+ * await page.mouseClick(100, 200);
681
+ * await page.mouseClick(100, 200, { button: 'right' });
682
+ * await page.mouseClick(100, 200, { clickCount: 2 }); // double-click
683
+ * ```
684
+ */
685
+ mouseClick(x: number, y: number, opts?: {
686
+ button?: 'left' | 'right' | 'middle';
687
+ clickCount?: number;
688
+ delayMs?: number;
689
+ }): Promise<void>;
690
+ /**
691
+ * Click an element by its visible text content (no snapshot/ref needed).
692
+ *
693
+ * Finds and clicks atomically — no stale ref problem.
694
+ *
695
+ * @param text - Text content to match
696
+ * @param opts - Options (exact: require full match, button, modifiers)
697
+ *
698
+ * @example
699
+ * ```ts
700
+ * await page.clickByText('Submit');
701
+ * await page.clickByText('Save Changes', { exact: true });
702
+ * ```
703
+ */
704
+ clickByText(text: string, opts?: {
705
+ exact?: boolean;
706
+ button?: 'left' | 'right' | 'middle';
707
+ modifiers?: ('Alt' | 'Control' | 'ControlOrMeta' | 'Meta' | 'Shift')[];
708
+ timeoutMs?: number;
709
+ }): Promise<void>;
710
+ /**
711
+ * Click an element by its ARIA role and accessible name (no snapshot/ref needed).
712
+ *
713
+ * Finds and clicks atomically — no stale ref problem.
714
+ *
715
+ * @param role - ARIA role (e.g. `'button'`, `'link'`, `'menuitem'`)
716
+ * @param name - Accessible name to match (optional)
717
+ * @param opts - Click options
718
+ *
719
+ * @example
720
+ * ```ts
721
+ * await page.clickByRole('button', 'Save');
722
+ * await page.clickByRole('link', 'Settings');
723
+ * await page.clickByRole('menuitem', 'Delete');
724
+ * ```
725
+ */
726
+ clickByRole(role: string, name?: string, opts?: {
727
+ button?: 'left' | 'right' | 'middle';
728
+ modifiers?: ('Alt' | 'Control' | 'ControlOrMeta' | 'Meta' | 'Shift')[];
729
+ timeoutMs?: number;
730
+ }): Promise<void>;
647
731
  /**
648
732
  * Type text into an input element by ref.
649
733
  *
@@ -1243,6 +1327,7 @@ declare class CrawlPage {
1243
1327
  declare class BrowserClaw {
1244
1328
  private readonly cdpUrl;
1245
1329
  private readonly ssrfPolicy;
1330
+ private readonly recordVideo;
1246
1331
  private chrome;
1247
1332
  private constructor();
1248
1333
  /**
@@ -1283,7 +1368,7 @@ declare class BrowserClaw {
1283
1368
  * const browser = await BrowserClaw.connect('http://localhost:9222');
1284
1369
  * ```
1285
1370
  */
1286
- static connect(cdpUrl: string, opts?: ConnectOptions): Promise<BrowserClaw>;
1371
+ static connect(cdpUrl?: string, opts?: ConnectOptions): Promise<BrowserClaw>;
1287
1372
  /**
1288
1373
  * Open a URL in a new tab and return the page handle.
1289
1374
  *