fix(web-probe): target workbench prompt controls

This commit is contained in:
Codex
2026-06-20 17:50:32 +00:00
parent f520f6fe77
commit 9fb1492ce6
@@ -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")',