diff --git a/build_exe.bat b/build_exe.bat index e26ef0a..8c1daeb 100644 --- a/build_exe.bat +++ b/build_exe.bat @@ -7,7 +7,7 @@ REM 每次升级改 APP_VERSION,避免与正在运行的旧版本目录冲突 REM 使用:把整个文件夹拷到目标机器(或压缩成 zip 发送), REM 双击文件夹里的 Boss直聘AI投递-%APP_VERSION%.exe 运行。 REM ============================================================ -set APP_VERSION=1.2 +set APP_VERSION=1.3 echo [1/2] 安装打包依赖... pip install pyinstaller PySide6 --quiet diff --git a/client/browser/applicant.py b/client/browser/applicant.py index e081a85..e1b909a 100644 --- a/client/browser/applicant.py +++ b/client/browser/applicant.py @@ -83,17 +83,30 @@ _JD_JS = """(() => { def _select_expect_js(keyword: str, city_name: str) -> str: - """在期望条件栏查找目标期望(优先 关键词(城市) 全匹配,其次城市匹配),返回坐标供可信点击""" + """在期望条件栏查找目标期望(优先 关键词(城市) 全匹配,其次城市匹配), + 返回坐标及落点校验/全量期望项坐标,供可信点击与问题排查""" return ("((kw, city) => (() => {" "const items = [...document.querySelectorAll('.expect-item')];" "const txt = el => ((el.querySelector('.text-content') || el).innerText || '').trim();" + "const rect = el => { const r = el.getBoundingClientRect();" + " return {x: Math.round(r.x), y: Math.round(r.y)," + " w: Math.round(r.width), h: Math.round(r.height)}; };" "let hit = city && items.find(el => txt(el) === kw + '(' + city + ')');" "if (!hit && city) hit = items.find(el => txt(el).endsWith('(' + city + ')'));" "if (!hit && kw) hit = items.find(el => txt(el).toLowerCase().includes(kw.toLowerCase()));" "if (!hit) return JSON.stringify({ok: false, list: items.map(txt)});" "const r = hit.getBoundingClientRect();" + "const cx = r.x + r.width / 2, cy = r.y + r.height / 2;" + # 落点校验:坐标处实际压着的元素(若被浮层/筛选栏遮挡会暴露) + "const at = document.elementFromPoint(cx, cy);" "return JSON.stringify({ok: true, text: txt(hit)," - " x: r.x + r.width / 2, y: r.y + r.height / 2});" + " x: Math.round(cx), y: Math.round(cy)," + " w: Math.round(r.width), h: Math.round(r.height)," + " atPoint: at ? {tag: at.tagName, cls: String(at.className).slice(0, 80)," + " text: (at.innerText || '').trim().slice(0, 40)} : null," + " items: items.map(el => ({text: txt(el), ...rect(el)}))," + " view: {iw: window.innerWidth, ih: window.innerHeight," + " sy: Math.round(window.scrollY)}});" "})())(" + json.dumps(keyword, ensure_ascii=False) + "," + json.dumps(city_name, ensure_ascii=False) + ")") @@ -300,6 +313,13 @@ class Applicant: f"({city_name or '未配置城市名'})," f"现有期望:{info.get('list') or '无'}") return False + # 定位详情:目标坐标/尺寸 + 坐标处实际压着的元素 + 全部期望项坐标 + 视口状态 + logger.debug(f"期望定位:目标「{info.get('text')}」中心坐标" + f"({info.get('x')},{info.get('y')})" + f" 尺寸{info.get('w')}x{info.get('h')}" + f" 落点元素={info.get('atPoint')}" + f" 视口={info.get('view')}") + logger.debug(f"期望栏全部项坐标:{info.get('items')}") self._sess.human_click(info["x"], info["y"]) logger.info(f"已选中期望条件:{info.get('text')}") time.sleep(2) diff --git a/client/browser/cdp_lite.py b/client/browser/cdp_lite.py index 68465fb..1c61c4b 100644 --- a/client/browser/cdp_lite.py +++ b/client/browser/cdp_lite.py @@ -116,6 +116,7 @@ class CDPSession: time.sleep(random.uniform(0.02, 0.06)) self.click_at(tx, ty) self._last_xy = (tx, ty) + logger.debug(f"拟人点击:目标({x:.0f},{y:.0f}) → 落点({tx:.0f},{ty:.0f})") def close(self) -> None: try: