Google+ Followers

Tuesday, 11 February 2014

IOS What are rows and sections , Scroll table view using calabash

Table views in IOS

What are rows and sections ??

A table view has only one column and allows vertical scrolling only. It consists of rows in sections. Each section can have a header and a footer that displays text or an image.

For more details  refer here -

Find value of third tableViewCell in table view by using index:
query("tableViewCell index:2 label",:text)

Scrolling down in IOS table view:
 scroll("tableView", :down)
  scroll "scrollView", :down

Scroll to row 3 in table view
  scroll_to_row "tableView", 2
Scroll to first cell:

Scroll to cell options: 

 {:query => "tableView",
 :row => 0,
 :section => 0,
 :scroll_position => :top,
 :animate => true}

Scroll to each cell and print values of labels
  each_cell(:post_scroll=>0) do |row, sec|
  sleep 0.5
  puts query("tableViewCell indexPath:#{row},#{sec} label",:text)

Scroll to row or section till particular text is found
#Scroll to text in table view
  def scroll_table(text)
    scroll_to_cell(:row => 0, :section => 0)  #scroll to top of table
    sleep 1
#Below code loops through each cell to check if the appropriate text was found
    each_cell(:animate => false, :post_scroll => 0.2) do |row, sec|
      if query("tableViewCell indexPath:#{row},#{sec} label", :text).first==text
        break # if text found break from loop

The above code scroll through to table to find text , 
if you want to click on text , add touch command before break


  1. Hi Tejasvi,

    I used your above method to scroll down to the text, but when I add a touch before the break, the touch command is not working. Can you tell me where am i going wrong.


  2. Sorry Parinita, I was bit busy .. do let me know if you still have same issue ?