我正在尝试将文本添加到 Esprsso 中的文本字段(在 Web 视图内),但收到此错误:
引起原因:java.lang.RuntimeException:评估错误评估:
状态:13 值:{message=无法设置选择结束} hasMessage:
真实消息:无法设置选择结束
code:
textField.perform(webKeys("[email protected] /cdn-cgi/l/email-protection"));
当我只是单击文本字段时它可以工作,但是当我尝试输入文本时它会崩溃。
我面临着同样的问题。我的代码适用于 Android 7.1.1 模拟器,但在 Android 8.0 模拟器上失败。
我通过在 build.gradle 中执行以下操作解决了这个问题。
1) 升级浓缩咖啡库。
我当时在:
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
androidTestCompile('com.android.support.test.espresso:espresso-contrib:2.2.2')
现在它:
androidTestCompile 'com.android.support.test:runner:1.0.0'
androidTestCompile 'com.android.support.test:rules:1.0.0'
androidTestCompile 'com.android.support.test.espresso:espresso-core:3.0.0'
androidTestCompile('com.android.support.test.espresso:espresso-contrib:3.0.0')
2) 执行此操作后,您的应用程序可能无法构建。它可能会说找不到 test:runner:1.0.0
在这种情况下,您需要添加
repositories {
maven { url "https://maven.google.com" }
}
3) 您可能需要解决的以下问题是它可能会抱怨“应用程序 (2x.x.x) 和测试应用程序 (2x.x.x) 的版本不同”
所以我在gradle中添加了以下内容。
configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:2x.x.x'
}
4) 另外,您可能需要确保添加了跑步者。
defaultConfig {
"android.support.test.runner.AndroidJUnitRunner"
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)