inconsistent scroll simulation
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.3k
- Forks
- 752
- Avg merge
- 6d 21h
- Merged PRs (30d)
- 8
Description
Description
When using the following code, each time the scroll goes roughly to the same place but not exactly, and there is no way to know exactly how much the element was scrolled:
private void scrollTo(int startX, int startY, int endX, int endY) {
PointerInput finger = new PointerInput(PointerInput.Kind.TOUCH, "finger");
Sequence scrollAction = new Sequence(finger, 0);
scrollAction.addAction(finger.createPointerMove(Duration.ofMillis(0), PointerInput.Origin.viewport(), startX, startY));
scrollAction.addAction(finger.createPointerDown(PointerInput.MouseButton.LEFT.asArg()));
scrollAction.addAction(finger.createPointerMove(Duration.ofMillis(500), PointerInput.Origin.viewport(), endX, endY));
// repeat last action as if to make the finger stay in place for 500 ms
scrollAction.addAction(finger.createPointerMove(Duration.ofMillis(500), PointerInput.Origin.viewport(), endX, endY));
scrollAction.addAction(finger.createPointerUp(PointerInput.MouseButton.LEFT.asArg()));
}
scrollTo(540, 1579, 540, 172);
On BrowserStack I see the correct request arrives:
[{"id":"finger","type":"pointer","parameters":{"pointerType":"touch"},"actions":[{"duration":0,"x":540,"y":1579,"type":"pointerMove","origin":"viewport"},{"button":0,"type":"pointerDown"},{"duration":500,"x":540,"y":172,"type":"pointerMove","origin":"viewport"},{"duration":500,"x":540,"y":172,"type":"pointerMove","origin":"viewport"},{"button":0,"type":"pointerUp"}]}]
but still each time I run that code on a fresh instance I get a bit different result.
Environment
- Appium version 1.21.0 (on BrowserStack)
- Android version 9.0, Google Pixel 2, UiAutomator2
Details
Please provide more details, if necessary.
Link To Appium Logs
https://gist.github.com/itaibh/d8028aa2f13ce3d16e15194101e9327e
In the Appium logs you'll see I use the Cancel action, but the result is the same as with lifting the finger.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the scrollTo pointer-action sequence from the issue on Android 9 with UiAutomator2, comparing repeated runs and the linked Appium logs. Trace how the Java client sends the W3C pointer actions and determine whether the inconsistent scroll is introduced by the client or the remote driver. Done means the cause is identified and the behavior is made deterministic or the limitation is documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100