calabash-android how to create loops or iterate something until an exit condition? -
i'm trying seat selection process bus. have seat layout seats booked ans not booked. need select unbooked seat. need create loop tapping random coordinates on screen till able tap on unbooked seat. how can done using calabash.
this thread bit old. anyways here goes along lines of looking for.
you want touch set of coordinates on screen, see if select seat , read fare value.
so need loop. can use this. picture can see have 8 seats on there. make quick lets try , hit the areas might have seat , looking @ 3x4 seats.
a = 0 b = 0 while < 3 while b < 4 b += 1 end += 1 end
the outer loop run 3 times, front back. inner loop run 4 times, seats left right.
now need make sure click on each position, add
performaction('click_on_screen',<x-value>, <y-value>)
and combined have this. have x , y starting positions , should match coordinates of first seat. @ first run click @ location , ever need fare price. after first click increase xoffset value distance between 2 seats, , ready click on second one. please keep in mind, made simpler second press touch on isle. on 3rd , 4th should again hit seats. , 2 next rows afterwards.
a = 0 b = 0 x = 100 y = 500 xoffset = x; while < 3 while b < 4 performaction('click_on_screen', xoffset, y) b += 1 xoffset += 200 end xoffset = x y += 200 += 1 end
best regards lasse
Comments
Post a Comment