From 1f0b8fd5760049cd3f3cca5b1d8046259ed5ba57 Mon Sep 17 00:00:00 2001 From: woan <798680981@qq.com> Date: Thu, 25 Jun 2026 14:47:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=20iOS=20=E9=80=89=E5=93=81=E7=B1=BB?= =?UTF-8?q?=E7=82=B9=E5=81=8F:=E6=BB=9A=E5=88=B0=E5=B1=85=E4=B8=AD?= =?UTF-8?q?=E5=B8=A6+=E6=B2=89=E9=99=8D=E9=87=8D=E5=8F=96rect=E7=82=B9?= =?UTF-8?q?=E6=96=B0=E9=B2=9C=E4=B8=AD=E5=BF=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Color Bulb 在 y=3941(第5屏),滚进可视区后 tapElement 取到移动中的旧坐标点偏 → 仍在目录页空转。改:滚到居中带 [0.16h,0.72h]、沉降450ms、重取 rect 点新鲜中心坐标。验证 Color Bulb 现可进 Installing 流程。 Co-Authored-By: Claude Opus 4.8 --- utils/common/device-add.helper.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/utils/common/device-add.helper.ts b/utils/common/device-add.helper.ts index 1b3f12c..315d5b1 100644 --- a/utils/common/device-add.helper.ts +++ b/utils/common/device-add.helper.ts @@ -177,13 +177,17 @@ export async function selectDeviceCategory(driver: DeviceDriver, categoryName: s if (el) { const rect = await driver.getElementRect(el).catch(() => null); if (rect && rect.width > 0) { - // ★ WDA 会返回**屏外元素**(实测品类常在 y=1192,屏高仅 844)→ 直接点屏外坐标无效="点了没进流程"。 - // 必须先把它**滚进可视区**(y 在 [0.10h, 0.82h])再点:在下方就下滑、在上方就上滑。 - if (rect.y < catH * 0.10 || rect.y + rect.height > catH * 0.82) { + // ★ WDA 会返回**屏外元素**(实测品类常在 y=1192~3941,屏高仅 844)→ 直接点屏外坐标无效="点了没进流程"。 + // 必须先滚进**居中带**(y 在 [0.16h, 0.72h],远离顶部搜索栏/底部栏,避免边缘点空)再点。 + if (rect.y < catH * 0.16 || rect.y + rect.height > catH * 0.72) { if (rect.y > catH * 0.5) await slowScroll(); else await slowScrollUp(); continue; } - await driver.tapElement(el); await sleep(2500); + // 沉降 + 重取 rect(滚动后元素可能仍在动,tapElement 取到移动中的旧坐标 → 点偏)→ 点新鲜中心坐标 + await sleep(450); + const fresh = await driver.getElementRect(el).catch(() => rect); + await driver.tap(Math.round(fresh.x + fresh.width / 2), Math.round(fresh.y + fresh.height / 2)); + await sleep(2500); // ★ 校验真进了流程:**"Add Manually" 是 Add Device 目录页独有标志**,消失=已离开目录进流程 // (不能用 includes(categoryName):目录页本就列着品类名 → 误判成功)。 const after = await driver.getSource();