Our engine for Mobile Tests is using Appium to locate and interact with the elements from native and hybrid mobile applications.
Appium does not provide a
But we can achieve the same effect with a
We just have to flick in the opposite direction in which we want to scroll.
Flick action requires 3 parameters:
- Locator Type
- Offset to flick by
The value for the
Offset to flick by is comprised of a value for the X offset and a value for the Y offset, separated by a comma.
The offset is equivalent to the scrolling distance in this case.
As you can see, we need an element in order to flick.
Flick action does not work with any element and there is no attribute to indicate if an element is suitable or not.
If an element is not suitable for the
Flick action, it means that performing that action on that element will not result in a scroll on that page.
You will not see any errors in the logs in that case, you will just notice that it has no effect.
This is due to the fact that the element was located and the action was performed, Appium does not throw any errors if the
Flick action did not result in a scroll.
The recommended procedure in this case is to try to perform the
Flick action with different elements until you find one that works, it's a trial and error process.
For some applications, you might get an error that the
Flickaction is not supported, this is due to the fact that the default versions of Appium used by BrowserStack and Sauce Labs might not support the
Flickaction for some applications.
In this case, please write to us and we'll add a custom setting for your account to use a different Appium version.
1. Scroll down
If we want to scroll down, we must flick up.
This means that we need to add a negative value for the Y offset:
2. Scroll up
If we want to scroll up, we must flick down.
This means that we need to add a positive value for the Y offset:
3. Scroll left
If we want to scroll left, we must flick right.
This means that we need to add a positive value for the X offset:
4. Scroll right
If we want to scroll right, we must flick left.
This means that we need to add a negative value for the X offset: