ios - 如何获取特定元素的所有后代?
问题描述
我是 ios 测试新手,我将快速自动化现有 ios 项目的 UI。
问题是我无法获取特定元素的所有后代,我想知道官方函数可以将所有后代返回为XCUIElementQuery
.
我尝试使用XCUIApplication().tables.descendants(matching: .cell)
get XCUIElementQuery
,但只得到了一种类型,如何同时获取特定元素下的不同类型?
- 结构喜欢这样:
Table, 0x282a00c30, {{0.0, 88.0}, {375.0, 641.0}}
Other, 0x282a184e0, {{0.0, 88.0}, {375.0, 44.0}}, identifier: 'XXX'
StaticText, 0x282a185b0, {{0.0, 88.0}, {375.0, 44.0}}, label: 'XXX'
Cell, 0x282a18680, {{0.0, 132.0}, {375.0, 78.0}}, identifier: 'XXX', label: 'XXX', value: 0.00
StaticText, 0x282a18750, {{127.0, 167.7}, {62.0, 13.3}}, label: 'XXX', value: 5
StaticText, 0x282a18340, {{127.0, 151.3}, {27.0, 14.3}}, label: 'XXX'
Button, 0x282a18820, {{127.0, 183.0}, {50.0, 8.0}}
Image, 0x282a188f0, {{352.0, 165.0}, {8.0, 12.0}}, identifier: 'XX'
Cell, 0x282a189c0, {{0.0, 210.0}, {375.0, 78.0}}, identifier: 'XXX', label: 'XXX', value: 0.00
StaticText, 0x282a18a90, {{127.0, 237.0}, {137.7, 14.3}}, label: 'XXX'
Button, 0x282a18b60, {{127.0, 253.3}, {50.0, 8.0}}
Image, 0x282a18d00, {{352.0, 243.0}, {8.0, 12.0}}, identifier: 'XXX'
Cell, 0x282a18dd0, {{0.0, 288.0}, {375.0, 78.0}}, identifier: 'XXX', label: 'XXX', value: 0.00
StaticText, 0x282a18ea0, {{127.0, 315.0}, {137.7, 14.3}}, label: 'XXX'
Button, 0x282a18f70, {{127.0, 331.3}, {50.0, 8.0}}
Image, 0x282a19040, {{352.0, 321.0}, {8.0, 12.0}}, identifier: 'XXX'
解决方案
推荐阅读
- android - 启用 proguard 时找不到 kotlin 对象类
- python - 无法将 tf 模型转换为 tflite 模型
- docker - 服务的不支持配置选项。*:“volumes_from”
- matlab - 背景和前景颜色变化
- r - 对单行中的多列求和,对于多行
- php - 在 codeigniter4 的模型中使用 $dateFormat INT
- apache-kafka - 从命令提示符创建 Kafka 生产者给代理断开错误
- r - 将文本字符串“ABCYYYYMM”转换为 R 中的日期格式
- php - 上传文件时响应文件管理器显示未知错误
- wcf - 如何确保将客户端证书传递给服务器