Unable to scroll down a screen

1,220 views
Skip to first unread message

Johana

unread,
Sep 12, 2013, 2:38:16 AM9/12/13
to calabash...@googlegroups.com
Hi,

I want to scroll down a screen in my app until i find some text.

I had written the following step def in ruby file:

Then /^I scroll until I see the "([^\"]*)" text$/ do |text|
  q = query("TextView text:'#{text}'")
  while q.empty?
    performAction('scroll_down')
    q = query("TextView text:'#{text}'")
  end 
end


The function performAction('scroll_down') is not working in my case
Can any one please help me?

aya

unread,
Oct 2, 2013, 5:31:18 AM10/2/13
to calabash...@googlegroups.com
Do you maybe have more than one listview on that screen? I had the same issue, because i had array of ListViews in a ViewPager. I worked around the issue by using drag action instead. It's obviously not as accurate, but I needed to do exactly the same thing (search text) and it worked fine:

Then /^I scroll down until I see the "([^\"]*)" text$/ do |text|
  q = query("TextView text:'#{text}'")
  while q.empty?
    performAction('drag',50,50,50,20,5)
    q = query("TextView text:'#{text}'")
  end 
end

about "drag" action... the first 2 numbers are startX and stopX, then startY and stopY. The last one is number of steps (the more steps the slower the drag). Those are percentage values, so in this case i make a quick fling from the middle of the screen to point at 20% of screen's height. You can adjust those values if you want the scroll to be slower or longer.

Rosy Chhabra

unread,
Oct 7, 2013, 5:10:48 AM10/7/13
to calabash...@googlegroups.com
Thanks aya. The solution given by you is working .


--
You received this message because you are subscribed to the Google Groups "calabash-android" group.
To unsubscribe from this group and stop receiving emails from it, send an email to calabash-andro...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Tech Tock Tech

unread,
Oct 18, 2016, 10:58:46 PM10/18/16
to calabash-android, er.rosy...@gmail.com
Hi,

please check this out , how to scroll on nested scroll view : https://www.youtube.com/watch?v=zKVk4d4FgBI

Thanks
Reply all
Reply to author
Forward
0 new messages