Skip to content

Commit f199c52

Browse files
authored
Add support for press commands (#133)
1 parent ab5e2c5 commit f199c52

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

lib/index.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -865,6 +865,29 @@ export class Stagehand {
865865
level: 1,
866866
});
867867

868+
if (retries < 2) {
869+
return this._act({
870+
action,
871+
steps,
872+
modelName,
873+
useVision,
874+
verifierUseVision,
875+
retries: retries + 1,
876+
chunksSeen,
877+
});
878+
}
879+
}
880+
} else if (method === "press") {
881+
try {
882+
const key = args[0];
883+
await this.page.keyboard.press(key);
884+
} catch (e) {
885+
this.log({
886+
category: "action",
887+
message: `Error pressing key (Retries ${retries}): ${e.message}\nTrace: ${e.stack}`,
888+
level: 1,
889+
});
890+
868891
if (retries < 2) {
869892
return this._act({
870893
action,

0 commit comments

Comments
 (0)