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 -

Query for Android hint text

query for hint text in android text fields (Edittext)

query "*",:hint