gpt4 book ai didi

android - Espresso 检查 View 要么 doesNotExist 要么 not isDisplayed

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:45:07 47 4
gpt4 key购买 nike

以下语句不起作用,因为 doesNotExist() 返回 ViewAssertion 而不是匹配器。没有 try-catch 有什么办法让它工作吗?

.check(either(matches(doesNotExist())).or(matches(not(isDisplayed()))));

最佳答案

如果要检查层次结构中是否不存在 View ,请使用以下断言。

ViewInteraction.check(doesNotExist());

如果要检查 View 是否存在于层次结构中但未显示给用户,请使用以下断言。

ViewInteraction.check(matches(not(isDisplayed())));

希望这对您有所帮助。

关于android - Espresso 检查 View 要么 doesNotExist 要么 not isDisplayed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41297524/

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