How to scroll a ListView until I see a specific string with Calabash-Android

Anna picture Anna · May 14, 2013 · Viewed 8.1k times · Source

I have exact same question as the post below, except that I need it to work for Android and the post below is for iOS. I have tried both solutions given in that post, but they don't seem to work for Android. All help is appreciated!

How do i scroll a UITable view down until i see a cell with label "Value" in Calabash

Answer

Proghero picture Proghero · May 19, 2013

you can add this new step definition and it should do the trick for Android:

Then /^I scroll until I see the "([^\"]*)" text$/ do |text|
  q = query("TextView text:'#{text}'")
  while q.empty?
    scroll_down
    q = query("TextView text:'#{text}'")
  end 
end

It works for me and I hope it does the same for you!