Alban Soupper
Alban Soupper

Reputation: 721

Robotium: searchText

I have a strange situation I can't explain myself.
The following code works well:
solo.sleep(1000);
assertTrue(solo.searchText("Banking"));


but the following code fails:
assertTrue(solo.waitForText("Banking", 1, 1000));

Can someone can explain me this?

Kind regards,
Alban.

Upvotes: 2

Views: 4248

Answers (2)

pjv
pjv

Reputation: 10708

Before robotium-1.7.1 there were some issues with searchText(). It was definetely not always finding the text even when it should. You might want to try again with simple code without timing.

Upvotes: 0

kiswa
kiswa

Reputation: 14987

The problem is that '1000' in waitForText isn't setting a delay, it's setting how long to keep looking. If it doesn't find the text within that time, it returns false. See Robotium source

Try the second version like this and see if it doesn't work:

assertTrue(solo.waitForText("Banking", 1, 10000)); // Take up to 10 seconds

Also, the delay before the first one probably doesn't change anything. I think the first example would work just as well if it was only:

assertTrue(solo.searchText("Banking"));

Upvotes: 4

Related Questions