相关疑难解决方法(0)

Espresso:Thread.sleep();

Espresso声称没有必要Thread.sleep();,但我的代码不起作用,除非我包含它.我正在连接到IP.连接时,会显示进度对话框.我需要sleep等待对话框解散.这是我使用它的测试片段:

    IP.enterIP(); // fills out an IP dialog (this is done with espresso)

    //progress dialog is now shown
    Thread.sleep(1500);

    onView(withId(R.id.button).perform(click());
Run Code Online (Sandbox Code Playgroud)

我曾尝试使用使用此代码,Thread.sleep();但它说不R.id.Button存在.我能让它发挥作用的唯一方法就是睡觉.

此外,我尝试用Thread.sleep();类似的东西替换,getInstrumentation().waitForIdleSync();但仍然没有运气.

这是唯一的方法吗?或者我错过了什么?

提前致谢.

testing android android-espresso

91
推荐指数
6
解决办法
6万
查看次数

标签 统计

android ×1

android-espresso ×1

testing ×1