Skip to content

[Bug] pnpm chat-browser --interactive "Hello" and pnpm chat-browser "Hello" 这两个 case, playwright 找不到 Send 按钮, 导致失败. #2

@Guang1234567

Description

@Guang1234567

Hello dev:

As title said:

private async send(): Promise<boolean> {
const page = await this.page;
// 依赖input进行定位
const target = page.locator('input[type="file"][multiple] + * [aria-disabled="false"]').first();
if (!await target.count()) return false;
await target.scrollIntoViewIfNeeded();
await target.click();
return true;
}

  • 临时能 workaround 的方法 👇:
private async send(): Promise<boolean> {
        const page = await this.page;
        // 根据真实 HTML 结构定位:包含 SVG 且不含禁用类名的 div 按钮
        const target = page.locator('div[role="button"]:has(svg):not(.ds-button--disabled)').last();
        
        if (!await target.count()) {
            // 如果找不到启用的按钮,尝试按回车作为兜底
            await page.keyboard.press('Enter');
            return true;
        }
        
        await target.scrollIntoViewIfNeeded();
        await target.click();
        return true;
    }


pnpm chat-browser "Hello"

崩溃时, 竟然打印不出这个 error

if (!sent) throw new Error("Failed to click DeepSeek send button.");

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions