From 0a82ad7350bf30944b421b1744d19bb8bb6b2a4c Mon Sep 17 00:00:00 2001 From: Derrors <33656531+Derrors@users.noreply.github.com> Date: Wed, 18 Nov 2026 00:55:30 +0800 Subject: [PATCH] fix(wda): a native floating search bar covers the rows under it Read natively (iOS 27), the tree is flat: the floating search bar at the bottom of Settings is a bare SearchField straight under the Application, without the Toolbar WDA's tree wraps it in. It didn't count as covering anything, so tapping a row under it by text tapped the row's center and opened the search; a scroll search could stop with its target there too. A SearchField straight under the Application in the lower 40% of the screen now counts as a floating bar: it covers the rows under it and takes taps BAR_SLOP beyond its frame, as the Toolbar does through WDA. Regression case #152, unit test on a tree read from the phone. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 1 + CHANGELOG.zh-CN.md | 1 + crates/ictl-wda/src/elements.rs | 43 ++++++++++++++++++- .../settings-floating-search-native-ios27.xml | 1 + docs/dev/regression-cases.md | 1 + 5 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 crates/ictl-wda/tests/fixtures/settings-floating-search-native-ios27.xml diff --git a/CHANGELOG.md b/CHANGELOG.md index e3af361..cd22ee0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ What changed in each release, one line per change. Versions follow [Semantic Ver ### Fixes +- Native control (iOS 27): the floating search bar at the bottom of Settings counts as covering the rows under it, as it does through WDA. Tapping a row under it by text taps its visible part instead of opening the search. - A WDA probe that answers, even with an error, resets the timeout count instead of accumulating unrelated slow requests into a stall. Recovery logs state the reason, and timeout logs include the endpoint and elapsed time. ## [0.2.7] - 2026-11-15 diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index 0938b73..5493fe8 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -21,6 +21,7 @@ ### 修复 +- 原生控制(iOS 27):设置首页底部悬浮的搜索栏算作挡住它下面的行,和经 WDA 时一样。按名字点被压在栏下的行,改点露出来的部分,不会再打开搜索。 - WDA 的短探测正常应答或返回远端错误时清零超时计数,不再把多个独立慢请求累计成卡死;恢复日志写明判定依据,请求超时日志包含端点和耗时。 ## [0.2.7] - 2026-11-15 diff --git a/crates/ictl-wda/src/elements.rs b/crates/ictl-wda/src/elements.rs index 6ef51c2..2fee7f4 100644 --- a/crates/ictl-wda/src/elements.rs +++ b/crates/ictl-wda/src/elements.rs @@ -332,6 +332,11 @@ impl Tree { /// 真机:设置首页搜索栏底板顶边 856,点 834 还能进下面那一行,838 就被栏吞掉(什么都不发生); /// 左右两边按同样的余量算 const BAR_SLOP: f64 = 24.0; +/// 原生控制读到的底部悬浮搜索栏(只有输入框,见 `floating_search`)往上吞掉多远的点击。真机(iPhone 15 Pro Max, +/// iOS 27.2.1,设置首页):输入框顶 866,点 806 还能进下面那一行,812、820、826 都被栏吞掉(什么都不发生) +const SEARCH_BAR_REACH: f64 = 58.0; +/// 同上,左右和往下:玻璃底板比输入框大约 10 点,再加 [`BAR_SLOP`] +const SEARCH_BAR_SIDE: f64 = 10.0 + BAR_SLOP; /// 可滚动的内容区 const SCROLLERS: [&str; 5] = ["ScrollView", "Table", "CollectionView", "WebView", "TextView"]; @@ -529,7 +534,13 @@ pub fn parse_tree(xml: &str, view: impl Into) -> Tree { // 下面判断在不在屏幕内、挡没挡住、点哪里,都用屏幕坐标 let scr = rotate.unwrap_or(Rotate::None).apply(abs, screen); let in_status_bar = kind == "StatusBar" || parent.is_some_and(|p| p.in_status_bar); - let in_bar = matches!(kind.as_str(), "Toolbar" | "TabBar") || parent.is_some_and(|p| p.in_bar); + // 原生控制读到的树是扁平的:设置首页底部悬浮的搜索栏只是一个直接挂在 Application 下的 SearchField,外面没有 + // WDA 树里那层 Toolbar。屏幕下部的这种搜索框也按悬浮栏算:盖得住下面的行,接收点击的范围也多算 BAR_SLOP。 + // 不然被压在栏下的行按名字点会点它的中心,打开的是搜索(iPhone 15 Pro Max,iOS 27.2.1) + let floating_search = + kind == "SearchField" && parent.is_some_and(|p| p.kind == "Application") && scr.y > sh * 0.6; + let in_bar = + matches!(kind.as_str(), "Toolbar" | "TabBar") || floating_search || parent.is_some_and(|p| p.in_bar); let on_bar = in_bar || kind == "NavigationBar" || parent.is_some_and(|p| p.on_bar); // 子节点在可滚动内容里(容器自己不算:它就是那块区域) let in_scroll = parent.is_some_and(|p| p.in_scroll || SCROLLERS.contains(&p.kind.as_str())); @@ -558,7 +569,15 @@ pub fn parse_tree(xml: &str, view: impl Into) -> Tree { .then(|| { let name = text.as_deref().map(|t| clip(t, 20, 20)).unwrap_or_default(); let mut rect = visible; - if in_bar && rect.y > sh * 0.6 { + // 原生的树里只有栏里的输入框,没有它外面那块玻璃底板:按真机量的范围算它吞掉的点击 + if floating_search { + rect = Rect { + x: rect.x - SEARCH_BAR_SIDE, + y: rect.y - SEARCH_BAR_REACH, + w: rect.w + 2.0 * SEARCH_BAR_SIDE, + h: rect.h + SEARCH_BAR_REACH + SEARCH_BAR_SIDE, + }; + } else if in_bar && rect.y > sh * 0.6 { rect = Rect { x: rect.x - BAR_SLOP, y: rect.y - BAR_SLOP, @@ -1072,6 +1091,26 @@ mod tests { assert_eq!(text.center, (59, 388)); } + /// 真机(iPhone 15 Pro Max,iOS 27.2.1,原生控制):设置首页底部悬浮的搜索栏在扁平的树里只是一个 SearchField, + /// 也要像工具栏一样挡住下面的行。它吞掉输入框(866)往上 58 点以内的点击:806 还能进下面那一行,812 就不行 + #[test] + fn a_native_floating_search_field_covers_the_rows_under_it() { + const XML: &str = include_str!("../tests/fixtures/settings-floating-search-native-ios27.xml"); + let row = |t: &Tree, label: &str| t.elements.iter().find(|e| e.label == label).cloned().unwrap(); + let t = parse_tree(XML, SCREEN); + // 766..818: clear of it, tapped at its center + assert!(matches!(t.tap_point(&row(&t, "相机")), TapPoint::Center(_))); + // 818..870: all of it is where the bar takes taps + assert!(matches!(t.tap_point(&row(&t, "主屏幕与App资源库")), TapPoint::Covered { .. })); + // 790..842: tapped above 808 + let lower = XML.replace(r#"y="766" width="390" height="52""#, r#"y="790" width="390" height="52""#); + let t = parse_tree(&lower, SCREEN); + match t.tap_point(&row(&t, "相机")) { + TapPoint::Moved { at, .. } => assert!(at.1 <= 806.0, "{at:?}"), + other => panic!("{other:?}"), + } + } + #[test] fn close_to_tolerates_small_drift_only() { let t = parse_tree(SETTINGS_IOS27, SCREEN); diff --git a/crates/ictl-wda/tests/fixtures/settings-floating-search-native-ios27.xml b/crates/ictl-wda/tests/fixtures/settings-floating-search-native-ios27.xml new file mode 100644 index 0000000..9028042 --- /dev/null +++ b/crates/ictl-wda/tests/fixtures/settings-floating-search-native-ios27.xml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/dev/regression-cases.md b/docs/dev/regression-cases.md index 69ef1c0..6130b82 100644 --- a/docs/dev/regression-cases.md +++ b/docs/dev/regression-cases.md @@ -155,3 +155,4 @@ | 149 | 拖动要先长按才拿得起来的东西(主屏幕图标、文件、可排序的列表项):`iphone_swipe` 按下就移动,只会滑动或翻页;在 W3C 手势里按下后用 `pause` 按住 0.6~1 秒再移动也拿不起来(0/6),原地 `pointerMove` 0.3 秒也不行 | `iphone_swipe` 的 `hold`:按下后用一段原地的 `pointerMove` 按住 `hold` 秒(不是 `pause`),再用 `seconds` 移到终点;HID 按住时每 100 毫秒重报一次位置,手指不抬起接着拖;`seconds + hold` 不超过 10 秒;不带 `hold` 的请求和以前完全一样 | 单测 `a_held_drag_holds_with_a_move_in_place`、`swipe_hold_defaults_to_zero`、`gesture_seconds_are_bounded`、`requests_round_trip_as_tagged_json` + 真机(iPhone 12 mini,iOS 26.4.1:主屏幕「设置」图标移到同一行空位,`hold` 0.5/0.6/1 各 5/5,不带 0/5;每次再用 `hold` 拖回原位)| | 150 | Agent 在原地打转:同一个点击原样做了好几次、界面一直没变,每次的结果都是同一句「界面和操作前一样…不要原样再做一遍」,看不出已经是第几次了 | 守护进程记下最近一个操作的原样请求和它连续几次做完界面没变:同一个请求再次没变时,从第二次起在这句后面说「这已经是连续第 N 次…换个做法,还不行就告诉用户卡在了哪一步」;换了操作、参数不同或界面变了重新数,没法比(操作前没看过界面)的那次不数也不清零 | 单测 `the_same_action_leaving_the_screen_unchanged_is_counted` + 真机(iPhone 12 mini,iOS 26.4.1:主屏幕空白处原样点 4 次,第 2~4 次带次数;换个点、再点回来、点开「设置」都不带)| | 151 | 要点的项在长列表屏幕外(设置首页的「隐私与安全性」):`iphone_tap_element` 只看当前屏幕,Agent 只能自己滑一下、读一次元素地来回;普通 0.3 秒快滑带惯性,手指移 300 点内容滚 618 点,会把要找的甩过去;找到的那一行可能正停在底部工具栏下面,整个被盖住 | `scroll`(`down` / `up`):每次在屏幕正中慢滑 35% 屏高(1 秒,几乎不带惯性,前后两屏有重叠),等列表停下再读树;要点的匹配存在且没被整个盖住才算找到;元素树不再变化算到了尽头,停下并在结果里说滑了几次 | 单测 `tap_element_scroll_search_is_optional_and_checked`、`a_search_scroll_is_a_short_vertical_stroke_in_the_middle`、`requests_round_trip_as_tagged_json` + 真机(iPhone 12 mini,iOS 26.4.1:设置首页往下找「隐私与安全性」滑 4 次点中;滑到底后往上找「通用」滑 3 次点中;找不存在的项滑到底 6 次停下)| +| 152 | 原生控制(iOS 27):设置首页底部悬浮的搜索栏在扁平的元素树里只是一个直接挂在 Application 下的 `SearchField`,没有 WDA 树里那层 Toolbar,不算遮挡;被压在栏下的行(如「隐私与安全」在 y≈866)按名字点会点它的中心,打开的是搜索;`iphone_tap_element` 带 `scroll` 时也会停在这样的位置 | 直接挂在 Application 下、在屏幕下部 40% 的 `SearchField` 按底部悬浮栏处理:盖得住下面的行;范围按真机量的算:输入框(顶 866)往上 58 点内的点击都被栏吞掉(806 还能进下面那一行,812、820、826 都不行),左右和往下多 34 点;一半压在这片范围里的改点上面露出来的部分,整个在里面的报被挡住 | 单测 `a_native_floating_search_field_covers_the_rows_under_it`(真机导出的树 `settings-floating-search-native-ios27.xml`)+ 真机(设置首页把行滑到搜索栏下,按名字点、带 scroll 找) |