Any idea how to do this for android? I can't seem to create a method that actually clicks.
I know you can do it with onview, but I just want an x/y position.
Any idea how to do this for android? I can't seem to create a method that actually clicks.
I know you can do it with onview, but I just want an x/y position.
The answer is already given here.
public static ViewAction clickXY(final int x, final int y){
return new GeneralClickAction(
Tap.SINGLE,
new CoordinatesProvider() {
@Override
public float[] calculateCoordinates(View view) {
final int[] screenPos = new int[2];
view.getLocationOnScreen(screenPos);
final float screenX = screenPos[0] + x;
final float screenY = screenPos[1] + y;
float[] coordinates = {screenX, screenY};
return coordinates;
}
},
Press.FINGER);
}