Skip to content

Commit 87e09c6

Browse files
fix: targeted extract not allowing xpath= (#887)
# why - we were passing the wrong variable to `getAccessibilityTree` which broke targeted extract for selectors with the `xpath=` prefix # what changed - pass the parsed xpath instead of the raw selector # test plan - targeted extract evals
1 parent f97d703 commit 87e09c6

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.changeset/hot-geckos-build.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@browserbasehq/stagehand": patch
3+
---
4+
5+
fix: allow xpaths with prepended 'xpath=' for targeted extract

lib/handlers/extractHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ export class StagehandExtractHandler {
156156
combinedXpathMap: {} as Record<EncodedId, string>,
157157
discoveredIframes: [] as undefined,
158158
}))
159-
: getAccessibilityTree(this.stagehandPage, this.logger, selector).then(
159+
: getAccessibilityTree(this.stagehandPage, this.logger, targetXpath).then(
160160
({ simplified, idToUrl, iframes: frameNodes }) => ({
161161
combinedTree: simplified,
162162
combinedUrlMap: idToUrl as Record<EncodedId, string>,

0 commit comments

Comments
 (0)