Command looping on android


Running this code on android:

my_array =
while my_array.size == 0 do
    sleep 30
    my_array = texts("Wake up")

makes appium server run query hundreds of times in a row without sleeping even if it always returns array size 0.

If I run it from arc, it works normally. Check output.log from line 131 till the end when it finally returns the object and goes to sleep.

output.log (220.9 KB)

If I add

 set_wait 2

before the loop, then it will just query for that amount of time.

Changing the interval in common.js just affects the polling interval, but it continues querying.

You probably want set_wait 0

The way to solve is that, and I have it.

But shouldn’t texts command return an array (empty or not) and proceed with the code independently of the timeout? Same to anything that returns an array (find_elements, finds, buttons, etc.)?