Hi, im trying to achieve my UI-test to scroll to the bottom of my scroll view but i havent been very successfull. Anyone have some tips on how to achieve this?
The answers there use Objective-C, but you should be able translate them easily as they're only a couple of lines of code - set a CGPoint object and call a method.
@DaveHunt Could you please provide a code example? I cant make my UI-test scroll what so ever not sure how to pass that cgpoint and make the test scroll to it, so far all my attempts seem to fail
I just realized you were actually referring to Xamarin.UITest, and not usage of UIScrollView. Xamarin.UITest doesn't have any method to scroll a view to the bottom.
If you have another control/view below the view you want to scroll, you could use IApp.ScrollDown and specify that control as the target. It will then scroll down until that control is visible, effectively scrolling to the bottom of your view.
@DaveHunt Yeah i just cant make that work. I marked my view with acessibilitylabel and i do app.scrolldown(c => c.marked(value))
I also tried the overload of scrolldown and just passed a string value of the view i want to scroll to but the simulator wont scroll. If i scroll myself all the way down the UI-test passes so its not that it cant find the view
@VictorConner I am facing this issue that you have reported in 2015 that the simulator wont scroll. if i scroll myself all the way down the UI test passes so its not that it cant find the view.
I found your post but i didnt find any answer. So if you can give an answer that would be really helpfull.
UITest queries everything on the stack when doing any actions so if you have more than one scrollable screen in the stack it will scroll through the first list in the stack for the marked item and then the next list and so on, until it reaches the timeout (30 seconds by default) so what you should always do as best practice is specify the view that you want to scroll on when using the ScrollDownTo API
app.ScrollDownTo(
a => a.Marked("ListCell").Property("text").Contains("Some text"),
b => b.Marked("SelectionListView"),
ScrollStrategy.Gesture,
swipePercentage: 0.67,
swipeSpeed: 2000,
timeout: TimeSpan.FromSeconds(60));
This works for us when scrolling to an item in the list with text in the field
if you need to scroll to the bottom of the list and not to a list item just use the ScrollDown API like so
app.ScrollDown(
b => b.Marked("SelectionListView"),
ScrollStrategy.Gesture,
swipePercentage: 0.67,
swipeSpeed: 2000
the only problem with this is it'll need to be wrapped in a while loop until it reaches the bottom of the screen as its a one off event
Does any one any idea about the swipePercentage, its not working as its expected based on the value of swipePercentage provided (from 0.0 to 1.0). I have tried by changing swipePercentage value but no effect on the percentage it should swipe.
Posts
Swipe your finger up the screen repeatedly... Sorry. Couldn't resist. ;-)
Have a look at this topic on stack overflow: http://stackoverflow.com/questions/952412/uiscrollview-scroll-to-bottom-programmatically
The answers there use Objective-C, but you should be able translate them easily as they're only a couple of lines of code - set a CGPoint object and call a method.
@DaveHunt Could you please provide a code example? I cant make my UI-test scroll what so ever
not sure how to pass that cgpoint and make the test scroll to it, so far all my attempts seem to fail
I just realized you were actually referring to Xamarin.UITest, and not usage of UIScrollView. Xamarin.UITest doesn't have any method to scroll a view to the bottom.
If you have another control/view below the view you want to scroll, you could use IApp.ScrollDown and specify that control as the target. It will then scroll down until that control is visible, effectively scrolling to the bottom of your view.
@DaveHunt Yeah i just cant make that work. I marked my view with acessibilitylabel and i do app.scrolldown(c => c.marked(value))
I also tried the overload of scrolldown and just passed a string value of the view i want to scroll to but the simulator wont scroll. If i scroll myself all the way down the UI-test passes so its not that it cant find the view
@VictorConner I am facing this issue that you have reported in 2015 that the simulator wont scroll. if i scroll myself all the way down the UI test passes so its not that it cant find the view.
I found your post but i didnt find any answer. So if you can give an answer that would be really helpfull.
UITest queries everything on the stack when doing any actions so if you have more than one scrollable screen in the stack it will scroll through the first list in the stack for the marked item and then the next list and so on, until it reaches the timeout (30 seconds by default) so what you should always do as best practice is specify the view that you want to scroll on when using the ScrollDownTo API
This works for us when scrolling to an item in the list with text in the field
if you need to scroll to the bottom of the list and not to a list item just use the ScrollDown API like so
the only problem with this is it'll need to be wrapped in a while loop until it reaches the bottom of the screen as its a one off event
Does any one any idea about the swipePercentage, its not working as its expected based on the value of swipePercentage provided (from 0.0 to 1.0). I have tried by changing swipePercentage value but no effect on the percentage it should swipe.
Any comment will be appreciated.
I managed to scroll to bottom/top on iOS, but Android. Script is available here.
Hope it help someone
.
Cheers.
link is dead
Oh, sorry, I changed my Github account
.
New link is https://gist.github.com/tuyen-vuduc/bf689732048d388bcbebffc1621eccad.
However, Calabash is deprecated and discontinued. It isn;t supported in MacOS HighSierra
.
Plz consider to move to other framework like Appium.
Cheers.