@browserbasehq/stagehand 1.10.0 → 1.10.1
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/README.md +4 -4
- package/dist/index.js +3 -4
- package/lib/handlers/observeHandler.ts +2 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -49,16 +49,16 @@ Here's a sample of what you can do with Stagehand:
|
|
|
49
49
|
// Keep your existing Playwright code unchanged
|
|
50
50
|
await page.goto("https://docs.stagehand.dev");
|
|
51
51
|
|
|
52
|
+
// Stagehand AI: Act on the page
|
|
53
|
+
await page.act("click on the 'Quickstart'");
|
|
54
|
+
|
|
52
55
|
// Stagehand AI: Extract data from the page
|
|
53
56
|
const { description } = await page.extract({
|
|
54
|
-
instruction: "
|
|
57
|
+
instruction: "extract the description of the page",
|
|
55
58
|
schema: z.object({
|
|
56
59
|
description: z.string(),
|
|
57
60
|
}),
|
|
58
61
|
});
|
|
59
|
-
|
|
60
|
-
// Stagehand AI: Act on the page
|
|
61
|
-
await page.act({ action: "click on the 'Quickstart'" });
|
|
62
62
|
```
|
|
63
63
|
|
|
64
64
|
## Why?
|
package/dist/index.js
CHANGED
|
@@ -4376,10 +4376,9 @@ var StagehandObserveHandler = class {
|
|
|
4376
4376
|
const backendNodeIdMap = {};
|
|
4377
4377
|
yield this.stagehandPage.startDomDebug();
|
|
4378
4378
|
yield this.stagehandPage.enableCDP("DOM");
|
|
4379
|
-
const evalResult = yield this.stagehand.page.evaluate(() =>
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
}));
|
|
4379
|
+
const evalResult = yield this.stagehand.page.evaluate(() => {
|
|
4380
|
+
return window.processAllOfDom().then((result) => result);
|
|
4381
|
+
});
|
|
4383
4382
|
for (const [index, xpaths] of Object.entries(evalResult.selectorMap)) {
|
|
4384
4383
|
try {
|
|
4385
4384
|
const xpath = xpaths[0];
|
|
@@ -89,9 +89,8 @@ export class StagehandObserveHandler {
|
|
|
89
89
|
await this.stagehandPage.startDomDebug();
|
|
90
90
|
await this.stagehandPage.enableCDP("DOM");
|
|
91
91
|
|
|
92
|
-
const evalResult = await this.stagehand.page.evaluate(
|
|
93
|
-
|
|
94
|
-
return result;
|
|
92
|
+
const evalResult = await this.stagehand.page.evaluate(() => {
|
|
93
|
+
return window.processAllOfDom().then((result) => result);
|
|
95
94
|
});
|
|
96
95
|
|
|
97
96
|
// For each element in the selector map, get its backendNodeId
|