我是机器人新手,现在我正在自动化应用程序。
应用程序以启动屏幕开始,然后在加载 1ndicator 15 秒后出现菜单屏幕,在菜单屏幕中有一个名为Application的按钮。当我继续单击该按钮时,它会返回错误。
注意:当我使用搜索文本时,它会返回带有名称的按钮
protected void setUp() throws Exception {
solo = new Solo(getInstrumentation(), getActivity());
}
public void testCanOpenSettings() throws Exception {
String appName = solo.getCurrentActivity().getClass().getSimpleName();
System.out.println(appName);
String appName1 = solo.getCurrentActivity().getClass().getSimpleName();
System.out.println(appName1);
solo.assertCurrentActivity("Home screen", appName1);
solo.waitForActivity(appName1, 10000);
solo.clickonbutton("Application");
}
@Override
public void tearDown() throws Exception {
try {
solo.finalize();
} catch (Throwable e) {
e.printStackTrace();
}
getActivity().finish();
super.tearDown();
}
堆栈跟踪:
junit.framework.AssertionFailedError: No Button with text Application is found!
at com.jayway.android.robotium.solo.ViewFetcher.getView(ViewFetcher.java:350)
at com.jayway.android.robotium.solo.Solo.getButton(Solo.java:1233)
at com.impiger.fff.controller.Test.testCanOpenSettings(Test.java:45)
at java.lang.reflect.Method.invokeNative(Native Method)
at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:205)
at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:195)
at android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:175)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:444)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1447)