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

前端 未结 4 887
甜味超标
甜味超标 2021-01-21 12:40

How do i scroll a UITableView down until i see a cell with label \"Value\" in Calabash/Cucumber. I\'ve been trying to do it using:

      Then          


        
4条回答
  •  故里飘歌
    2021-01-21 13:10

    table have rows and sections, based how your code is organized use rows or sections in below code

    def scroll_side_panel(text)
    
    section=0
    scroll_to_cell(:row => 0, :section => 0) # scroll to top of view
    sleep 1 # wait for a second
    
    #Scroll to each element and compare text, if there is a match break
    each_cell(:animate => false, :post_scroll => 0.2) do |row, sec|
      puts "#{query("tableViewCell indexPath:#{row},#{sec} label", :text)}  #{text}"
      if query("tableViewCell indexPath:#{row},#{sec} label", :text).first==text
        break
      end
      section=section+1
    end
    puts "table view text found at element number:#{section}"
    end
    

提交回复
热议问题