Skip to content

Commit 318aef5

Browse files
committed
chore: add environment configuration for Stagehand
- Set the environment to "BROWSERBASE" in the Stagehand initialization. - Enhanced debugging by adding console logs for element evaluation in the file input check.
1 parent 448ff2f commit 318aef5

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

examples/upload_test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ async function main() {
1818

1919
const stagehand = new Stagehand({
2020
...StagehandConfig,
21+
env: "BROWSERBASE",
2122
verbose: 1,
2223
modelName: "openai/gpt-4o-mini",
2324
});

lib/index.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -978,11 +978,17 @@ export class Stagehand {
978978
// If this is a file input → set directly
979979
const isFileInput = await locator
980980
.evaluate(
981-
(el): boolean =>
982-
el.tagName.toLowerCase() === "input" &&
983-
(el as HTMLInputElement).type === "file",
981+
(el): boolean => {
982+
const tagName = el.tagName.toLowerCase();
983+
const type = (el as HTMLInputElement).type;
984+
console.log(`DEBUG: Element tagName=${tagName}, type=${type}`);
985+
return tagName === "input" && type === "file";
986+
},
984987
)
985-
.catch(() => false);
988+
.catch((e) => {
989+
console.log(`DEBUG: evaluate failed:`, e);
990+
return false;
991+
});
986992

987993
if (isFileInput) {
988994
await locator.setInputFiles(filesArg);

0 commit comments

Comments
 (0)