fix(boss): 修复沟通页治理公告弹窗未关闭及新招呼 tab 选择器失效

BOSS_CHAT_PAGE_MAIN 有独立的浏览器启动逻辑,未调用 dismissGovernanceNoticeDialog,
导致弹窗一直阻挡后续所有操作;现将其导出并在 page.goto 完成后显式调用。
新招呼 tab 的 title 含动态未读数(如"新招呼(1312)"),精确匹配 [title="新招呼"]
永远失败,改为前缀匹配 [title^="新招呼"]。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@Ginkgo0110
2026-04-02 12:06:26 +08:00
parent 8bfcb6d044
commit 23c820d4af
3 changed files with 7 additions and 3 deletions

View File

@@ -239,4 +239,4 @@ export const GOVERNANCE_NOTICE_DIALOG_CONFIRM_BTN_SELECTOR = '.dialog-uninstall-
* 每次开始处理前须先点击此 tab确保只扫描新招呼消息避免遍历其他类型会话。
* HTML: div.chat-label-item[title="新招呼"],选中态有 class selected。
*/
export const CHAT_PAGE_TAB_NEW_GREET_SELECTOR = '.chat-label-item[title="新招呼"]'
export const CHAT_PAGE_TAB_NEW_GREET_SELECTOR = '.chat-label-item[title^="新招呼"]'

View File

@@ -67,7 +67,7 @@ export async function initPuppeteer () {
* 该弹窗在每次登录后必现,不处理会导致后续自动化操作卡死超时。
* @param {import('puppeteer').Page} page
*/
async function dismissGovernanceNoticeDialog (page) {
export async function dismissGovernanceNoticeDialog (page) {
try {
const confirmBtn = await page
.waitForSelector(GOVERNANCE_NOTICE_DIALOG_CONFIRM_BTN_SELECTOR, { timeout: 10000 })

View File

@@ -146,10 +146,12 @@ const runChatPage = async () => {
processContext?: { currentCandidate: any } | null;
}) => Promise<void>
initPuppeteer: () => Promise<{ puppeteer: any }>
dismissGovernanceNoticeDialog: (page: any) => Promise<void>
}
const {
startBossChatPageProcess,
initPuppeteer
initPuppeteer,
dismissGovernanceNoticeDialog
} = (await import('@geekgeekrun/boss-auto-browse-and-chat/index.mjs')) as unknown as BossAutoBrowseModule
const { setupCanvasTextHook } = (await import('@geekgeekrun/boss-auto-browse-and-chat/resume-extractor.mjs')) as any
log('boss package import 完成,初始化 puppeteer...')
@@ -252,6 +254,8 @@ const runChatPage = async () => {
await setDomainLocalStorage(browser, localStoragePageUrl, bossLocalStorage || {})
await page.goto(BOSS_CHAT_PAGE_URL, { timeout: 60 * 1000 })
await page.waitForFunction(() => document.readyState === 'complete', { timeout: 120 * 1000 })
await new Promise(r => setTimeout(r, 1500))
await dismissGovernanceNoticeDialog(page)
sendToDaemon({
type: 'worker-to-gui-message',