修 iOS 选品类点偏:滚到居中带+沉降重取rect点新鲜中心
Color Bulb 在 y=3941(第5屏),滚进可视区后 tapElement 取到移动中的旧坐标点偏 → 仍在目录页空转。改:滚到居中带 [0.16h,0.72h]、沉降450ms、重取 rect 点新鲜中心坐标。验证 Color Bulb 现可进 Installing 流程。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
85a6f04fb1
commit
1f0b8fd576
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue