Accurate scrolling


How do you guys scroll accurately? I’m having issues doing precise scrolling, since scroll actions on mobile devices are thresholded, to better differentiate between click and drag touch actions.

The problem is that this scroll threshold is dynamically determined based on device resolution or even customized in a element.

For example on Android, drag action below ~15 px is still considered a click, above that distance Elements start scrolling.

Atm I’m using TouchAction functionality and I extend drag distance, if it happens to be under threshold. So I’m using smth similar to following:

static final int SCROLL_THRESHOLD = 20; // 20px

void scroll(int xAxis, int yStart, int yEnd) {
    yEnd += Integer.signum(yEnd) * SCROLL_THRESHOLD;

    TouchAction ta = new TouchAction(getDriver());
    ta.longPress(xAxis, yStart).moveTo(xAxis, yEnd).release().perform();

Any better ideas, which don’t involve moving pixel by pixel until element moves?