我无法使用操作栏图像移动到应用程序中的下一个屏幕

发布于 2024-11-15 22:08:48 字数 868 浏览 5 评论 0原文

我是 Robotium 测试的新手。我遇到了一个问题:我们有发布一些主题的功能。我们的应用程序中没有移动到下一个屏幕的按钮,仅生成带有“下一步”选项的操作栏。 请问,您能帮我如何单击此“下一步”选项以移至下一个屏幕吗?

这是我的测试:

    solo.clickOnView(solo.getView(R.id.part_tab_post));
    solo.enterText(0, "Listing new from Julina");
    solo.enterText(1, "description from Julina");

//solo.getView(R.id.actionbar_post); - 但这没有帮助

这是包含与操作栏相关的行的代码:

private void initActionBar() {
    actionBarPostListing = (ActionBar) findViewById(R.id.actionbar_post);
    actionBarPostListing.setTitle(R.string.post_listing);
    actionBarPostListing.addAction(new ActionPostListingNext());
}

/** Action to next button on the Post a Listing actionbar.*/
private class ActionPostListingNext extends AbstractAction {

    public ActionPostListingNext() {
        super(R.drawable.btn_states_action_next);
    }

I'm new in Robotium testing. And I encountered with a problem: we have the functionality to post some theme. We don't have buttons in the application to move to the next screen, only generated actionbar with Next option.
Please, can you help me how can I click on this Next option to move to the next screen?

Here is my test:

    solo.clickOnView(solo.getView(R.id.part_tab_post));
    solo.enterText(0, "Listing new from Julina");
    solo.enterText(1, "description from Julina");

// solo.getView(R.id.actionbar_post); - but this doesn't help

Here is the code which includes lines related to actionbar:

private void initActionBar() {
    actionBarPostListing = (ActionBar) findViewById(R.id.actionbar_post);
    actionBarPostListing.setTitle(R.string.post_listing);
    actionBarPostListing.addAction(new ActionPostListingNext());
}

/** Action to next button on the Post a Listing actionbar.*/
private class ActionPostListingNext extends AbstractAction {

    public ActionPostListingNext() {
        super(R.drawable.btn_states_action_next);
    }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

岁月静好 2024-11-22 22:08:48

我刚刚也遇到了这个问题,我必须使用标准的android框架来让它像这样工作:

View view = activity.findViewById(R.id.part_tab_post);
runOnUiThread( new Runnable() {
  public void run() {
    view.requestFocus();
  }
};
TouchUtils.clickView(this, view);

然后你可以使用robotium输入你的文本

//solo.waitForActivity(activityName);
//or
//solo.waitForFragmentById(fragmentId);
solo.enterText(0, "Listing new from Julina");
solo.enterText(1, "description from Julina");

I've just encounter this problem also and I had to use the standard android framework to get this to work like so:

View view = activity.findViewById(R.id.part_tab_post);
runOnUiThread( new Runnable() {
  public void run() {
    view.requestFocus();
  }
};
TouchUtils.clickView(this, view);

Then you can enter your text with robotium

//solo.waitForActivity(activityName);
//or
//solo.waitForFragmentById(fragmentId);
solo.enterText(0, "Listing new from Julina");
solo.enterText(1, "description from Julina");
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文