我正在创建一个XCUIElementQuery来获取所有staticTexts以字符串开头的单元格(例如“购买”),但不知道。我用谷歌搜索了一下,但没有希望。
孤注一掷的尝试得到了staticText,但没有得到细胞。
XCUIElementQuery *rows = [app.cells.staticTexts matchingPredicate:[NSPredicate predicateWithFormat:@"label CONTAINS 'Buy'"]];有谁有过这样的经验吗?我们至少能得到上面staticTexts的parent吗?
发布于 2015-09-25 02:08:30
我发现这是可行的:
XCUIElementQuery *rows =
[app.cells containingPredicate:
[NSPredicate predicateWithFormat:@"label CONTAINS 'Buy'"]];如果你使用app.cells.staticTexts,你将得到一个标签查询,而不是单元格查询。另外,要确保你使用的是官方的Xcode7,测试版可能有buggy。
https://stackoverflow.com/questions/31848860
复制相似问题