Skip to content

Commit a25a4cb

Browse files
handle prepended 'xpath=' (#552)
* handle prepended 'xpath=' * changeset
1 parent f56c7ba commit a25a4cb

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Diff for: .changeset/healthy-walls-refuse.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@browserbasehq/stagehand": patch
3+
---
4+
5+
accept xpaths with 'xpath=' prepended to the front in addition to xpaths without

Diff for: lib/handlers/extractHandler.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ export class StagehandExtractHandler {
184184
await this.stagehandPage._waitForSettledDom(domSettleTimeoutMs);
185185
await this.stagehandPage.startDomDebug();
186186

187-
const targetXpath = selector;
187+
const targetXpath = selector?.replace(/^xpath=/, "") ?? "";
188188

189189
// **2:** Store the original DOM before any mutations
190190
// we need to store the original DOM here because calling createTextBoundingBoxes()

0 commit comments

Comments
 (0)