diff --git a/scripts/src/hwlab-node-web-observe-runner-source.ts b/scripts/src/hwlab-node-web-observe-runner-source.ts index ef30cc2d..7b00d626 100644 --- a/scripts/src/hwlab-node-web-observe-runner-source.ts +++ b/scripts/src/hwlab-node-web-observe-runner-source.ts @@ -334,7 +334,10 @@ async function workbenchSessionSnapshot() { async function sendPrompt(text) { if (text.trim().length === 0) throw new Error("sendPrompt requires non-empty text"); const beforeUrl = currentPageUrl(); - const editor = page.locator('textarea, [role="textbox"], [contenteditable="true"], input[type="text"]').last(); + const primaryEditor = page.locator("#command-input").last(); + const editor = await primaryEditor.isVisible().catch(() => false) + ? primaryEditor + : page.locator('textarea, [role="textbox"], [contenteditable="true"], input[type="text"]').last(); await editor.waitFor({ state: "visible", timeout: 15000 }); const tag = await editor.evaluate((element) => element.tagName.toLowerCase()).catch(() => ""); const editable = await editor.evaluate((element) => element.getAttribute("contenteditable") === "true").catch(() => false); @@ -346,7 +349,10 @@ async function sendPrompt(text) { await editor.click(); await page.keyboard.insertText(text); } - const submit = page.locator([ + const primarySubmit = page.locator('#command-submit, [data-testid="command-submit"], [data-testid="composer-submit"], [data-testid="send-command"]').last(); + const submit = await primarySubmit.isVisible().catch(() => false) + ? primarySubmit + : page.locator([ 'button[type="submit"]', 'button:has-text("发送")', 'button:has-text("Send")',