gpt4 book ai didi

ios - XCTest UI 测试 : can not find collectionView within a table cell

转载 作者:行者123 更新时间:2023-12-01 17:47:59 26 4
gpt4 key购买 nike

有一个单元格包含一个 Collection View 。我已经使用

在 Collection View 中设置了单元格
cell.accessibilityLabel = @"daren_shangjia_0001_add_new_photo_album";

然后在 XCTest 中,我会这样做

print(app.debugDescription);

我没有看到我提供的accessibilityLabel。

Element subtree:
→Application 0x608000367200: {{0.0, 0.0}, {414.0, 736.0}}, label: '纳豆行'
Window 0x608000365e80: Main Window, {{0.0, 0.0}, {414.0, 736.0}}
Other 0x608000365880: traits: 8589934592, {{0.0, 0.0}, {414.0, 736.0}}
Other 0x608000365b80: traits: 8589934592, {{0.0, 0.0}, {414.0, 736.0}}
Other 0x608000365700: traits: 8589934592, {{0.0, 0.0}, {414.0, 736.0}}
Other 0x608000364d40: traits: 8589934592, {{0.0, 0.0}, {414.0, 736.0}}
Other 0x608000364680: traits: 8589934592, {{0.0, 0.0}, {414.0, 736.0}}
Other 0x608000364740: traits: 8589934592, {{0.0, 0.0}, {414.0, 736.0}}
Other 0x608000364800: traits: 8589934592, {{0.0, 0.0}, {414.0, 736.0}}
NavigationBar 0x6080003648c0: traits: 35192962023424, {{0.0, 20.0}, {414.0, 44.0}}, identifier: '140'
Button 0x608000364980: traits: 8589934593, {{20.0, 31.0}, {20.7, 20.5}}, label: 'da ren list backBtn'
StaticText 0x608000365f40: traits: 8590000192, {{192.0, 28.0}, {30.0, 27.0}}, label: '140'
Button 0x608000366000: traits: 8589934593, {{360.7, 25.0}, {33.3, 33.1}}, label: 'denglu 0010 you ke register'
Other 0x608000366240: traits: 8589934592, {{0.0, 0.0}, {414.0, 736.0}}
Other 0x6000003660c0: traits: 8589934592, {{0.0, 0.0}, {414.0, 736.0}}
Other 0x600000365e80: traits: 8589934592, {{0.0, 0.0}, {414.0, 736.0}}
Table 0x600000365dc0: traits: 35192962023424, {{0.0, 0.0}, {414.0, 680.8}}
Image 0x608000366a80: traits: 8589934596, {{0.0, 64.0}, {414.0, 219.6}}
Image 0x608000366cc0: traits: 8589934596, {{168.4, 135.2}, {77.3, 77.3}}
Button 0x608000367080: traits: 8589934593, {{151.8, 118.6}, {110.4, 110.4}}
Image 0x6080003672c0: traits: 8589934596, {{245.2, 195.3}, {16.6, 16.6}}, identifier: 'da_ren_list_girl'

最佳答案

要访问容器 View 中的 View ,您必须确保容器 View 不可访问。在您的情况下,我认为这是表格 View 单元格。

let cell: UITableViewCell!
cell.isAccessibilityElement = false

为了降低辅助功能用户的复杂性,屏幕的任何部分都最多有一个辅助 View 。单元格通常是包含可以概括为单个实体的信息的东西,例如,代表一个项目,其中包括文本和图片以及可选择它的选项。由于您决定拥有一个相当复杂的单元格,您需要更改它的默认行为以允许辅助功能用户更精细地访问单元格的内容。它不能再在 TableView 单元格级别进行汇总。因此,解释屏幕上的内容的工作必须传递给 View 层次结构中较低的元素。

要进一步理解这个概念,请尝试在打开 VoiceOver 的情况下使用您的应用,并使用三指轻按三次来切换屏幕窗帘。

关于ios - XCTest UI 测试 : can not find collectionView within a table cell,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41845309/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com