Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

### 修复

- 原生控制(iOS 27):设置首页底部悬浮的搜索栏算作挡住它下面的行,和经 WDA 时一样。按名字点被压在栏下的行,改点露出来的部分,不会再打开搜索。
- WDA 的短探测正常应答或返回远端错误时清零超时计数,不再把多个独立慢请求累计成卡死;恢复日志写明判定依据,请求超时日志包含端点和耗时。

## [0.2.7] - 2026-11-15
Expand Down
43 changes: 41 additions & 2 deletions crates/ictl-wda/src/elements.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"];
Expand Down Expand Up @@ -529,7 +534,13 @@ pub fn parse_tree(xml: &str, view: impl Into<View>) -> 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()));
Expand Down Expand Up @@ -558,7 +569,15 @@ pub fn parse_tree(xml: &str, view: impl Into<View>) -> 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,
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><XCUIElementTypeApplication type="XCUIElementTypeApplication" label="设置" name="设置" enabled="true" selected="false" focused="false" x="0" y="0" width="430" height="932"><XCUIElementTypeStaticText type="XCUIElementTypeStaticText" label="设置" name="设置" enabled="true" selected="false" focused="false" x="198" y="71" width="34" height="21"/><XCUIElementTypeButton type="XCUIElementTypeButton" label="个人热点、关闭" name="com.apple.settings.personalHotspot" enabled="true" selected="false" focused="false" x="20" y="103" width="390" height="52"/><XCUIElementTypeButton type="XCUIElementTypeButton" label="电池" name="com.apple.settings.battery" enabled="true" selected="false" focused="false" x="20" y="155" width="390" height="52"/><XCUIElementTypeSwitch type="XCUIElementTypeSwitch" label="VPN" name="com.apple.settings.vpn" value="1" enabled="true" selected="false" focused="false" x="20" y="208" width="390" height="52"/><XCUIElementTypeButton type="XCUIElementTypeButton" label="通用" name="com.apple.settings.general" enabled="true" selected="false" focused="false" x="20" y="295" width="390" height="52"/><XCUIElementTypeButton type="XCUIElementTypeButton" label="无障碍" name="com.apple.settings.accessibility" enabled="true" selected="false" focused="false" x="20" y="347" width="390" height="52"/><XCUIElementTypeButton type="XCUIElementTypeButton" label="操作按钮" name="com.apple.settings.actionButton" enabled="true" selected="false" focused="false" x="20" y="400" width="390" height="52"/><XCUIElementTypeButton type="XCUIElementTypeButton" label="待机显示" name="com.apple.settings.standBy" enabled="true" selected="false" focused="false" x="20" y="452" width="390" height="52"/><XCUIElementTypeButton type="XCUIElementTypeButton" label="控制中心" name="com.apple.settings.controlCenter" enabled="true" selected="false" focused="false" x="20" y="504" width="390" height="52"/><XCUIElementTypeButton type="XCUIElementTypeButton" label="墙纸" name="com.apple.settings.wallpaper" enabled="true" selected="false" focused="false" x="20" y="557" width="390" height="52"/><XCUIElementTypeButton type="XCUIElementTypeButton" label="搜索" name="com.apple.settings.search" enabled="true" selected="false" focused="false" x="20" y="609" width="390" height="52"/><XCUIElementTypeButton type="XCUIElementTypeButton" label="外观" name="com.apple.settings.appearance" enabled="true" selected="false" focused="false" x="20" y="661" width="390" height="52"/><XCUIElementTypeButton type="XCUIElementTypeButton" label="显示与亮度" name="com.apple.settings.displayAndBrightness" enabled="true" selected="false" focused="false" x="20" y="714" width="390" height="52"/><XCUIElementTypeButton type="XCUIElementTypeButton" label="相机" name="com.apple.settings.camera" enabled="true" selected="false" focused="false" x="20" y="766" width="390" height="52"/><XCUIElementTypeButton type="XCUIElementTypeButton" label="主屏幕与App资源库" name="com.apple.settings.homeScreen" enabled="true" selected="false" focused="false" x="20" y="818" width="390" height="52"/><XCUIElementTypeSearchField type="XCUIElementTypeSearchField" value="搜索" placeholderValue="搜索" enabled="true" selected="false" focused="false" x="28" y="866" width="374" height="28"/><XCUIElementTypeButton type="XCUIElementTypeButton" label="听写" name="Dictate" enabled="true" selected="false" focused="false" x="370" y="869" width="17" height="22"/></XCUIElementTypeApplication>
1 change: 1 addition & 0 deletions docs/dev/regression-cases.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 找) |
Loading