如何单击、输入或选择android设备上的Downloads文件夹中的文件以打开选项as (Gallery, Image Gallery, Photos, etc)
这是我的代码:
String filepath = "/Downloads/";
File file = new File(filepath +"images.jpeg" );
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setClassName("com.android.providers.downloads.ui", "com.android.providers.downloads.ui.DownloadList");
getInstrumentation().getContext().startActivity(intent);
setActivityIntent(intent);
Solo solo2 = new Solo(getInstrumentation(), getActivity());
solo2.getCurrentViews();
assertNotNull(solo2);
solo2.clickInList(1);
solo2.sendKey(solo2.ENTER);
solo2.waitForDialogToOpen(10000);
solo2.clickInList(1);
solo2.clickOnButton("Just once");
....我试着运行它并得到下一个错误:
"junit.framework.AssertionFailedError: AbsListView is not found!
at com.jayway.android.robotium.solo.Waiter.waitForAndGetView(Waiter.java:501)
at com.jayway.android.robotium.solo.Clicker.clickInList(Clicker.java:450)
at com.jayway.android.robotium.solo.Clicker.clickInList(Clicker.java:430)
at com.jayway.android.robotium.solo.Solo.clickInList(Solo.java:1170)
at com.nsi.mobile.client.autotest.TestPrintQueue.testPrintfromOutside(TestPrintQueue.java:104)
at java.lang.reflect.Method.invokeNative(Native Method)
at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:214)
at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:199)
at android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:192)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:190)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:175)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:555)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1584)"有什么想法吗?
发布于 2014-02-13 10:15:14
你的问题是因为机器人独奏可以使用你所拥有的课程。也许这解决方案能对你有帮助。
发布于 2014-08-15 17:54:45
使用Robotium,您只能访问属于您的应用程序的活动。画廊,图片画廊,照片,等等。启动不属于应用程序的活动。
发布于 2014-03-11 08:26:46
如果您想用预装的应用程序编写测试,请使用Google:http://developer.android.com/tools/help/uiautomator/index.html的UIAutomator测试框架。
https://sqa.stackexchange.com/questions/7494
复制相似问题