1

Robotium 4.1 似乎没有任何滚动到某个点然后停止的功能(适用于 ScrollView 而不是 ListView 对象)。我的问题是我需要从 TextView 对象接收文本,该对象从 scrollView 的最顶部不可见,但从底部也不可见。ScrollView 对象和 TextView 对象在目标包的 GUI 类中都是私有的,因此不能直接接收字符串。

这是我的尝试

    solo.waitForText("Start Logging");
    solo.clickOnText("Start Logging");
    solo.waitForText("Performing Throughput Test");

    assertEquals(
            GUIHelperFunctions.isServiceRunning(GlobalVariables.getContext(),
                    GlobalVariables.getSERVICENAME(), true), true);
    boolean inProgress = true;
    while (inProgress == true){
        if(!solo.searchText("Performing Throughput Test",true)){
            inProgress = false;
        }
    }


    String message = solo.getText("Upload Throughput:").getText().toString();

我发现当您将最后一行换成

    assertTrue(solo.searchText("Upload Throughput:"));

在我的项目中,我收到了其他几个 TextView 的内容,它们也在 LinearLayout 中,它是 ScrollView 的直接子项,但所有这些都可以从最顶部或最底部看到。

有没有人找到解决此问题的方法或在某个位置停止滚动 ScrollView 的方法?

4

1 回答 1

0

尝试使用:

assertTrue(solo.waitForText("Upload Throughput:", 1, 20000, true));

String message = solo.getText("Upload Throughput:").getText().toString();
于 2013-05-28T19:54:45.473 回答