gpt4 book ai didi

xcode-ui-testing - 如何获取与标识符匹配的元素数量,例如 XCUIQuery 返回的 "fooImage"?

转载 作者:行者123 更新时间:2023-12-04 08:32:21 24 4
gpt4 key购买 nike

假设我有一张包含三张图像的 table ,其 accessiblityIdentifier设置为“fooImage”。
XCTAssertTrue(table["tableName"].images.count == 3)会起作用,但这很糟糕——如果有人添加了另一种图像类型怎么办?我想要标识符==“fooImage”的所有图像的计数。
XCUIApplication().images["fooImage"].count编译失败 Value of type 'XCUIElement' has no member 'count' .

最佳答案

XCUIElementQuery 上使用下标会给你一个 XCUIElement没有 count属性(property)。你想用 countXCUIElementQuery 上像这样。

XCUIApplication().images.matching(identifier: "fooImage").count

关于xcode-ui-testing - 如何获取与标识符匹配的元素数量,例如 XCUIQuery 返回的 "fooImage"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49036048/

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