Wednesday, 11 November 2015

Useful Calabash Android methods for scrolling, reading and counting items in Android List view

Calabash queries for Android list view

#Get total items in List view
query "ListView",:getCount

#Get first visible item from android list view
query "ListView",:getFirstVisiblePosition

#Get item details at row 2 in current list
query "ListView",{:getItemAtPosition=>1}

#get last visible position of item currently visible in list view
query "ListView",:getLastVisiblePosition

#Scroll in list view
query "ListView",{:smoothScrollToPosition=>5}

#scroll progressively in list view
query "ListView",{:smoothScrollByOffset=>1} # scroll by one position

Example of Android list view -


  1. Would you know the similar parameter for 'RecyclerView' for the following method?
    query "ListView",{:getItemAtPosition=>1}
    Thanks in advance!

  2. Can you try getChildAt
    query "RecyclerView",{:getChildAt=>1}

  3. This comment has been removed by the author.

  4. Sorry, but this method doesn't correspond to the index of the entire list. It corresponds just to those elements that are shown.

  5. Being new to the blogging world I feel like there is still so much to learn. Your tips helped to clarify a few things for me as well as giving..
    iOS Training in Chennai
    Android Training in Chennai
    php Training in Chennai

  6. Now you can win free stuff online, enter yourself into giveaways daily and win the latest products instantly. You can win free cash as a free giveaway every time we run a giveaway.