diff --git a/.changeset/rude-moles-yawn.md b/.changeset/rude-moles-yawn.md new file mode 100644 index 000000000..6c5ed273f --- /dev/null +++ b/.changeset/rude-moles-yawn.md @@ -0,0 +1,5 @@ +--- +"@browserbasehq/stagehand": patch +--- + +Adding back useAccessibilityTree param to observe with a deprecation warning/error indicating to use onlyVisible instead diff --git a/lib/StagehandPage.ts b/lib/StagehandPage.ts index c5ad13b21..da7d3b47f 100644 --- a/lib/StagehandPage.ts +++ b/lib/StagehandPage.ts @@ -504,8 +504,24 @@ export class StagehandPage { domSettleTimeoutMs, returnAction = false, onlyVisible = false, + useAccessibilityTree, } = options; + if (useAccessibilityTree !== undefined) { + this.stagehand.log({ + category: "deprecation", + message: + "useAccessibilityTree is deprecated.\n" + + " To use accessibility tree as context:\n" + + " 1. Set onlyVisible to false (default)\n" + + " 2. Don't declare useAccessibilityTree", + level: 1, + }); + throw new Error( + "useAccessibilityTree is deprecated. Use onlyVisible instead.", + ); + } + if (typeof useVision !== "undefined") { this.stagehand.log({ category: "deprecation", diff --git a/types/stagehand.ts b/types/stagehand.ts index a088638ec..edb58a51c 100644 --- a/types/stagehand.ts +++ b/types/stagehand.ts @@ -91,13 +91,14 @@ export interface ObserveOptions { domSettleTimeoutMs?: number; returnAction?: boolean; onlyVisible?: boolean; + /** @deprecated `useAccessibilityTree` is now deprecated. Use `onlyVisible` instead. */ + useAccessibilityTree?: boolean; } export interface ObserveResult { selector: string; description: string; backendNodeId?: number; - //TODO: review name method?: string; arguments?: string[]; }