首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何单击、输入或选择android设备上的下载文件夹中的文件以打开选项

如何单击、输入或选择android设备上的下载文件夹中的文件以打开选项
EN

Stack Exchange QA用户
提问于 2014-01-09 10:53:41
回答 4查看 2.6K关注 0票数 0

如何单击、输入或选择android设备上的Downloads文件夹中的文件以打开选项as (Gallery, Image Gallery, Photos, etc)

这是我的代码:

代码语言:javascript
复制
        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");
        ....

我试着运行它并得到下一个错误:

代码语言:javascript
复制
"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)"

有什么想法吗?

EN

回答 4

Stack Exchange QA用户

发布于 2014-02-13 10:15:14

你的问题是因为机器人独奏可以使用你所拥有的课程。也许解决方案能对你有帮助。

票数 1
EN

Stack Exchange QA用户

发布于 2014-08-15 17:54:45

使用Robotium,您只能访问属于您的应用程序的活动。画廊,图片画廊,照片,等等。启动不属于应用程序的活动。

票数 1
EN

Stack Exchange QA用户

发布于 2014-03-11 08:26:46

如果您想用预装的应用程序编写测试,请使用Google:http://developer.android.com/tools/help/uiautomator/index.html的UIAutomator测试框架。

票数 0
EN
页面原文内容由Stack Exchange QA提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://sqa.stackexchange.com/questions/7494

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档