From fbe23007176488043c2415519f25021612fff989 Mon Sep 17 00:00:00 2001 From: Sameel Date: Thu, 12 Dec 2024 18:54:43 -0500 Subject: [PATCH] log playwright action (#299) * log playwright action * changeset --- .changeset/three-planes-clap.md | 5 +++++ lib/handlers/actHandler.ts | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 .changeset/three-planes-clap.md diff --git a/.changeset/three-planes-clap.md b/.changeset/three-planes-clap.md new file mode 100644 index 00000000..a3ebef31 --- /dev/null +++ b/.changeset/three-planes-clap.md @@ -0,0 +1,5 @@ +--- +"@browserbasehq/stagehand": patch +--- + +log playwright actions for better debugging diff --git a/lib/handlers/actHandler.ts b/lib/handlers/actHandler.ts index 48ba0164..1de2630a 100644 --- a/lib/handlers/actHandler.ts +++ b/lib/handlers/actHandler.ts @@ -203,6 +203,23 @@ export class StagehandActHandler { ) { const locator = this.stagehand.page.locator(`xpath=${xpath}`).first(); const initialUrl = this.stagehand.page.url(); + + this.stagehand.log({ + category: "action", + message: "performing playwright method", + level: 2, + auxiliary: { + xpath: { + value: xpath, + type: "string", + }, + method: { + value: method, + type: "string", + }, + }, + }); + if (method === "scrollIntoView") { this.stagehand.log({ category: "action",