我目前正在尝试使用 XCUITest 框架对 parking 移动应用程序进行自动化测试。问题是,每次单击按钮时,我不想单击与该元素关联的静态文本(因为文本会发生变化),而是单击 ID。有办法做到这一点吗?
最佳答案
您可以使用 matching(identifier:)
函数通过标识符来匹配元素
https://developer.apple.com/documentation/xctest/xcuielementquery/1500679-matching
链接 .firstmatch
或 .element
以匹配单个元素。
关于swift - XCUI测试: Is it possible to tap on element not using static texts present but identifier?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57322672/