How to make a simple Click in Java-client 8.3.0

I’m trying to increase Appium java client from 7.x to 8.x and I’m having trouble understanding how I can make a simple click on coordinates X and Y and passing duration of that click?

I could find good examples on how to make complex actions, while I have no idea how to make a simple click.

As an example, I created a scroll action like this:

PointerInput finger = new PointerInput(PointerInput.Kind.TOUCH, “finger”);
Sequence scroll = new Sequence(finger, 0);
scroll.addAction(finger.createPointerMove(Duration.ofMillis(0), PointerInput.Origin.viewport(), startX, startY));
scroll.addAction(finger.createPointerMove(Duration.ofMillis(timeInMillis), PointerInput.Origin.viewport(), endX, endY));

How can I make a simple click on X and Y with duration?

I found this piece of code here: Appium Pro: iOS-Specific Touch Action Methods

Map<String, Object> args = new HashMap<>();
args.put(“x”, 2);
args.put(“y”, 2);
driver.executeScript(“mobile: tap”, args);

… but as I understand, this is iOS specific + the Duration is missing. How to achieve the same on Android? Where is this documented?

Any help very much appreciated.

I wrote the following for myself, works great.
the only method you need to change is waitForElementToBeClickable(element) I just use WebDriverWait instance to make sure the element is clickable before tapping it.

public static void tapPoint(Point point) {
    PointerInput finger = new PointerInput(PointerInput.Kind.TOUCH, "finger");
    Sequence tap = new Sequence(finger, 1);
    tap.addAction(finger.createPointerMove(Duration.ZERO, PointerInput.Origin.viewport(), point.getX(), point.getY()));

public static void tapElement(WebElement element) {
    Rectangle rec = element.getRect();
    int centerX = rec.getX() + (rec.getWidth() / 2);
    int centerY = rec.getY() + (rec.getHeight() / 2);
    Point elementLocation = new Point(centerX, centerY);

as well, if you want to control the duration, between the createPointerDown(0) and CreatePointerUp(0) add the following:

        tap.addAction(new Pause(finger, myDuration));

it should work, just set myDuration accordingly.