在XCTest UI测试中单击NSToolbarItem

问题描述 投票:0回答:1

我正在为基于文档的macOS应用编写UI测试。

在UI测试中,如何以本地化友好的方式单击NSToolbarTiem?

[单击时,录制不录制任何内容。

[NSToolbarItem似乎没有accessibilityIdentifier

xcode xctest xcode-ui-testing
1个回答
0
投票

您应该检查元素树print(app.debugDescription)

找到您的元素,然后单击类似app.toolbars["brushes"].firstMatch.click()的字样>

如果缺少accessibilityIdentifierlabel,请将它们添加到应用程序代码或情节提要中。

© www.soinside.com 2019 - 2024. All rights reserved.