Xcode 8.2,IOS10.2
因此,当我启动UITest并进入屏幕时,我使用:
app.tables.element.swipeUp();
或
app.swipeUp();
无法找到屏幕上显示的元素,代码停在:
app.buttons["dingdanBtn"].tap();
但如果我使用鼠标滚动/向上滑动(单击,按住并向上移动)
XCTest可以找到元素吗?
有人认为这是一个错误,或者我做错了什么?
如果我用过
app.swipeUp()
print(app.buttons.debugDescription);
输出是:
Find: Target Application 0x6080000ad620
Output: {
Application 0x60800017e840: {{0.0, 0.0}, {414.0, 736.0}}, label: '纳豆行'
}
↪︎Find: Descendants matching type Button
Output: {
Button 0x60800017e180: traits: 8589934593, {{20.0, 31.0}, {20.7, 20.5}}, label: 'da ren list backBtn'
Button 0x60800017ca40: traits: 8589934593, {{114.5, 1140.8}, {184.9, 33.1}}, label: '我知道了'
Button 0x60800017ea80: traits: 8589934593, {{44.2, 1140.8}, {122.0, 33.1}}, label: '否'
Button 0x60800017e9c0: traits: 8589934593, {{247.8, 1140.8}, {122.0, 33.1}}, label: '是'
Button 0x60800017d1c0: traits: 8589934593, {{114.5, 1140.8}, {184.9, 33.1}}, label: '我知道了'
}
如果我没有使用:
app.swipeUp()
但是用我的鼠标滚动,输出是:
Find: Target Application 0x6000000b5900
Output: {
Application 0x600000366300: {{0.0, 0.0}, {414.0, 736.0}}, label: '纳豆行'
}
↪︎Find: Descendants matching type Button
Output: {
Button 0x600000366840: traits: 8589934593, {{20.0, 31.0}, {20.7, 20.5}}, label: 'da ren list backBtn'
Button 0x600000368ac0: traits: 8589934593, {{259.4, 504.6}, {66.2, 22.1}}, label: 'updateButton'
Button 0x600000368b80: traits: 8589934593, {{336.7, 504.6}, {66.2, 22.1}}, label: 'dingdanBtn'
Button 0x608000366780: traits: 8589934593, {{0.0, 0.0}, {77.3, 27.6}}, label: 'updateButton'
Button 0x608000366300: traits: 8589934593, {{0.0, 0.0}, {77.3, 27.6}}, label: 'updateButton'
Button 0x608000367980: traits: 8589934593, {{0.0, 0.0}, {77.3, 27.6}}, label: 'updateButton'
Button 0x608000365880: traits: 8589934593, {{0.0, 0.0}, {77.3, 27.6}}, label: 'updateButton'
Button 0x60800036b4c0: traits: 8589934593, {{0.0, 0.0}, {77.3, 27.6}}, label: 'updateButton'
Button 0x60800036a740: traits: 8589934593, {{0.0, 0.0}, {77.3, 27.6}}, label: 'updateButton'
Button 0x60800036b1c0: traits: 8589934593, {{0.0, 0.0}, {77.3, 27.6}}, label: 'updateButton'
Button 0x60800036c540: traits: 8589934593, {{0.0, 0.0}, {77.3, 27.6}}, label: 'updateButton'
Button 0x608000368040: traits: 8589934593, {{0.0, 0.0}, {77.3, 27.6}}, label: 'updateButton'
Button 0x60800036c900: traits: 8589934593, {{0.0, 0.0}, {77.3, 27.6}}, label: 'updateButton'
Button 0x60800036bd00: traits: 8589934593, {{114.5, 1140.8}, {184.9, 33.1}}, label: '我知道了'
Button 0x60800036cfc0: traits: 8589934593, {{44.2, 1140.8}, {122.0, 33.1}}, label: '否'
Button 0x60800036cf00: traits: 8589934593, {{247.8, 1140.8}, {122.0, 33.1}}, label: '是'
Button 0x60800036c180: traits: 8589934593, {{114.5, 1140.8}, {184.9, 33.1}}, label: '我知道了'
}
我正在寻找“dingdanBtn”按钮