-1

I have a "Call Us" hyperlink in a TextView. When the user clicks on it a dailog box is opened with two buttons "OK" and "Cancel". I am trying to test this feature using robotium but solo.clickOnText("Call Us") does not open the dialog box nor does it display an error saying text not found. Any help would be appreciated.

Thanks.

solo.scrollDown();
assertTrue(solo.searchText("Call Us"));
solo.clickOnText("Call Us");

This is pretty much the code I am trying to execute. The dialog is not displayed on screen after robotium has finished executing this code.

Nisha
  • 149
  • 1
  • 2
  • 9
  • could you please share some code that you have tried? – Spring Breaker Dec 10 '13 at 09:10
  • Edit to include the code. – Nisha Dec 10 '13 at 09:26
  • @Nisha Did you checked this ? http://stackoverflow.com/questions/14252604/display-alert-dialog-while-running-an-andriod-test-case – Hardik Joshi Dec 10 '13 at 09:36
  • @Prince: Thank you for suggesting the post. I read through this just now. From what I understand of this post he wants to create a dialog box specifically for the test case. In my case the dialog box is already there in the application, which means if you run the app independently and click on "Call us" the dialog is displayed but when you do solo.clickOnText("Call Us") through robotium the dialog is not displayed. I dont think creating a dialog box through robotium is what I am looking at. – Nisha Dec 10 '13 at 09:49
  • Are you sure the page is completely loaded? Could help you to put a solo.sleep(5000); before of this code to ensure page has been completely loaded? – Flavio Capaccio Dec 10 '13 at 19:26
  • ... or also to put a sleep after the instruction to give the time to display the popup! – Flavio Capaccio Dec 11 '13 at 09:21
  • I did put solo.sleep(1000)...did not help :( – Nisha Dec 12 '13 at 08:44

1 Answers1

1

Try to click on the view and not the text. It works for me.

TextView tv = (TextView)solo.getView(TEXT_VIEW_ID);
solo.clickOnView(tv);
Onivas
  • 161
  • 1
  • 8
  • 1
    The text view has a lot of text in it and at the end the hyperlink. I am not so sure if clicking on the whole text view would work. – Nisha Dec 26 '13 at 09:29