- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
以下语句不起作用,因为 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/
是否有可能哄骗 Django 为 DoesNotExist 错误提供更多信息? 例如,真的如果他们能包含查询就好了……像这样: >>> Foo.objects.get(id="example_id")
我正在使用 Django 1.7。通常你可以在你的模型上捕获 DoesNotExist 异常; try: ... except model.DoesNotExist, den: ... 我
如果您能在点击搜索按钮时在另一个页面中查看数据,从而从数据库中接收数据,我将不胜感激。我收到的问题是 AttributeError。单击该按钮后 我试图研究类似的问题。 Views.py def ac
这个问题在这里已经有了答案: How to handle "matching query does not exist" when getting an object (3 个答案) 关闭 7 年前
我正在尝试创建一个单元测试来验证对象是否已被删除。 from django.utils import unittest def test_z_Kallie_can_delete_discussion_
我正在尝试在我的 Django Web 应用程序中激活社交登录,该应用程序来自此 GitHub repository 中的开源软件(所以我没有写);我遇到了这个众所周知的问题: DoesNotExis
从 git 仓库运行 Django 1.5.x。使用 south 来管理迁移。我有一个这样的模型: class Company(models.Model): name = models.Cha
我有一些关于 django exists() 和 DoesNotExist 异常的问题。 示例代码: id = 1 # first if User.objects.get(pk=id).exists(
我正试图捕获 Django。我在 Eclipse 上使用 Pydev。我写了一个简单的注册页面,但我无法开始工作。 Eclipse 提示 User.DoesNotExist 未定义。很可能,我错过了一
它并不总是这个代码块,但这是最新的。这似乎是随机的,有什么想法吗? try: u = User.objects.get(email__iexact=useremail) except User
我正在尝试通过基于相关模型的过滤来运行 filter() 查询,它会抛出 DoesNotExist 异常。 CourseMember.objects.filter(user__last_name__i
在 Django 中,我一直看到 DoesNotExist 被引发,就像在 db.models.fields.related.py 中一样。不是在 django.core.exceptions 中定义
我正在努力解决我的应用程序中的 DoesNotExist 错误。关键是我真的不明白为什么会抛出这个错误,因为我已经处理过了: import socket from django.core.except
我在 Django 1.5 网站上遇到了一个奇怪的异常: "TypeError: 'exceptions.AttributeError' object is not callable" 从本质上讲,
我在使用 django guardian 时遇到了一些问题。我定义了一个新闻模型 class News(models.Model): title = models.CharField(_('T
我正在尝试验证 ListView 不包含特定项目。这是我正在使用的代码: onData(allOf(is(instanceOf(Contact.class)), is(withContactItemN
我有一个 Django 模型的自定义管理器。我似乎无法在这里捕捉到 DoesNotExist 异常。我知道如何在模型中执行此操作,但在这里不起作用: class TaskManager(models.
为什么我创建的模型实例在之后直接从 celery 任务查询时没有找到?例如: # app.views model = Model.objects.create() # I create my l
我已经将 peewee 与 SQLite 一起使用了一段时间,现在我正在切换到带有 Postgres 的 SQLAlchemy,但我找不到等效的 DoesNotExist(参见示例) try:
我一直收到 has no attribute DoesNotExist 错误。 有什么想法吗? 到目前为止我试过: try: current_report = Report.o
我是一名优秀的程序员,十分优秀!