androidui-automationcalabash-android

Scrolling in calabash-android


I am trying to scroll down in calabash-android but couldn't. Here is the code that I using for the scrolling part

In feature file:

Then I scrolldown until I see "Engine Light On"

In calabash_steps.rb:

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

the error that I am getting:

enter image description here


Solution

  • We can use the following code in the calasbash_steps.rb file.

    Then(/^I scroll view "([^"]*)" "([^"]*)"$/) do |view,direction|
       scroll("#{view}",:"#{direction}")
    end
    

    In the .feature file, we can pass the view and directions in the manner you want to scroll.Here is a sample:

    Then I scroll view "ExpandableListView" "down"
    Then I scroll view "ExpandableListView" "up"