Skip to content

Commit 5bc514f

Browse files
authored
forcing deprecation of useAccessibilityTree on observe (#445)
* forcing deprecation of useAccessibilityTree on observe * added changeset
1 parent 1032d7d commit 5bc514f

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

Diff for: .changeset/rude-moles-yawn.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@browserbasehq/stagehand": patch
3+
---
4+
5+
Adding back useAccessibilityTree param to observe with a deprecation warning/error indicating to use onlyVisible instead

Diff for: lib/StagehandPage.ts

+16
Original file line numberDiff line numberDiff line change
@@ -504,8 +504,24 @@ export class StagehandPage {
504504
domSettleTimeoutMs,
505505
returnAction = false,
506506
onlyVisible = false,
507+
useAccessibilityTree,
507508
} = options;
508509

510+
if (useAccessibilityTree !== undefined) {
511+
this.stagehand.log({
512+
category: "deprecation",
513+
message:
514+
"useAccessibilityTree is deprecated.\n" +
515+
" To use accessibility tree as context:\n" +
516+
" 1. Set onlyVisible to false (default)\n" +
517+
" 2. Don't declare useAccessibilityTree",
518+
level: 1,
519+
});
520+
throw new Error(
521+
"useAccessibilityTree is deprecated. Use onlyVisible instead.",
522+
);
523+
}
524+
509525
if (typeof useVision !== "undefined") {
510526
this.stagehand.log({
511527
category: "deprecation",

Diff for: types/stagehand.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,14 @@ export interface ObserveOptions {
9191
domSettleTimeoutMs?: number;
9292
returnAction?: boolean;
9393
onlyVisible?: boolean;
94+
/** @deprecated `useAccessibilityTree` is now deprecated. Use `onlyVisible` instead. */
95+
useAccessibilityTree?: boolean;
9496
}
9597

9698
export interface ObserveResult {
9799
selector: string;
98100
description: string;
99101
backendNodeId?: number;
100-
//TODO: review name
101102
method?: string;
102103
arguments?: string[];
103104
}

0 commit comments

Comments
 (0)