简体   繁体   English

Espresso:由于“keyDispatchingTimedOut”,仪器运行失败

[英]Espresso: Instrumentation run failed due to 'keyDispatchingTimedOut'

Below is a section of an espresso test that tries to login to a remote server when a submit button is clicked and then after a successful Login it checks if the view with test " FAQ " is displayed.下面是 espresso 测试的一部分,当单击提交按钮时尝试登录到远程服务器,然后在成功登录后检查是否显示带有测试“ FAQ ”的视图。

 onView(withId(R.id.buttonSubmit)).perform(scrollTo());
 onView(withId(R.id.buttonSubmit)).perform(click());
 onView(withText("FAQ")).check(matches(ViewMatchers.isDisplayed()));

The following error is shown when the button is clicked :单击按钮时显示以下错误:

[INFO] emulator-52981_unknown_sdk : Run failed: Instrumentation run failed due to 'keyDispatchingTimedOut' [INFO] emulator-52981_unknown_sdk:运行失败:由于“keyDispatchingTimedOut”,仪器运行失败

I would like to know if anybody has an idea of what could be the cause of this error.我想知道是否有人知道导致此错误的原因。

Thanks谢谢

NOT perform(click()) in UI thread不在 UI 线程中执行(click())

below code run in instrument test, throw keyDispatchingTimedOut下面的代码在仪器测试中运行,抛出 keyDispatchingTimedOut

    try (ActivityScenario<MainActivity> activityScenario
                 = ActivityScenario.launch(MainActivity.class)) {
        activityScenario.onActivity(activity -> {
            onView(withId(R.id.tv1)).perform(click());
        });
    }

change to below code更改为以下代码

    try (ActivityScenario<MainActivity> activityScenario
                 = ActivityScenario.launch(MainActivity.class)) {
        onView(withId(R.id.tv1)).perform(click());
    }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 由于&#39;java.lang.IllegalAccessError&#39;,检测运行失败。 Gradle + Espresso - Instrumentation run failed due to 'java.lang.IllegalAccessError'. Gradle + Espresso 测试无法完成。 原因:“由于运行失败,仪器运行失败。 使用义式浓缩咖啡时 - Test failed to run to completion. Reason: 'Instrumentation run failed due to 'Process crashed. when using Espresso Android Espresso UI测试-测试运行失败:由于“进程崩溃”,仪表运行失败。 - Android Espresso UI test -— Test running failed: Instrumentation run failed due to 'Process crashed.' Espresso 2升级后测试失败(失败:由于&#39;java.lang.IllegalAccessError&#39;导致仪器运行失败) - Tests fail after Espresso 2 upgrade (failed: Instrumentation run failed due to 'java.lang.IllegalAccessError') Android Espresso UI测试-测试运行失败:由于“ java.lang.IllegalAccessError”,检测运行失败 - Android Espresso UI test - Test running failed: Instrumentation run failed due to 'java.lang.IllegalAccessError' 使用Lollipop下的设备在Espresso中测试失败(失败:由于“ java.lang.IllegalAccessError”,检测运行失败) - Tests fail in Espresso with devices under Lollipop (failed: Instrumentation run failed due to 'java.lang.IllegalAccessError') 通过Espresso运行单元测试时,由于“ java.lang.ClassNotFoundException”错误,导致仪表运行失败 - Instrumentation run failed due to 'java.lang.ClassNotFoundException'error while running Unit test through Espresso 在“由于程序崩溃”导致仪器运行失败后,如何恢复Android Espresso测试? - How to resume Android Espresso test after 'Instrumentation run failed due to 'Process crashed.''? 由于&#39;进程崩溃&#39;导致仪表运行失败 - Instrumentation run failed due to 'Process crashed' 由于“进程崩溃”,检测运行失败。 - Instrumentation run failed due to 'Process crashed.'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM