0
我是robotium的新手,現在我正在自動化應用程序。點擊按鈕不起作用
應用程序從啓動屏幕開始,然後在加載1ndicator 15秒後顯示菜單屏幕,在菜單屏幕中有一個名爲的應用程序。當我繼續點擊那個按鈕時,它會返回一個錯誤。
注意:當我用搜索文本返回與名稱鍵存在
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)
yes文本名稱爲應用程序 – user608211 2011-03-02 09:28:15
根據您的代碼「solo.clickonbutton(」Application「);」,都是小寫字母,它必須是像「solo.clickOnButton(」Application「)這樣的駝峯案例;」 – exception01 2011-03-02 11:17:17