Skip to content

Instantly share code, notes, and snippets.

@dannyshain
Created October 7, 2021 00:29
Show Gist options
  • Save dannyshain/231ea8f37440f6e632bd9a17c1711680 to your computer and use it in GitHub Desktop.
Save dannyshain/231ea8f37440f6e632bd9a17c1711680 to your computer and use it in GitHub Desktop.
MobileElement slider = driver.findElementByAccessibilityId("slider");
Point source = slider.getLocation();
PointerInput finger = new PointerInput(PointerInput.Kind.TOUCH, "finger");
Sequence sequence = new Sequence(finger, 1);
sequence.addAction(finger.createPointerMove(ofMillis(0),
PointerInput.Origin.viewport(), source.x, source.y));
sequence.addAction(finger.createPointerDown(PointerInput.MouseButton.MIDDLE.asArg()));
sequence.addAction(new Pause(finger, ofMillis(600)));
sequence.addAction(finger.createPointerMove(ofMillis(600),
PointerInput.Origin.viewport(), source.x + 400, source.y));
sequence.addAction(finger.createPointerUp(PointerInput.MouseButton.MIDDLE.asArg()));
driver.perform(singletonList(sequence));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment