Draw Signature in android and iOS using Appium

I have to draw signature on a screen . Is there any method apart from TouchActions to draw signature or write on a screen?

Hi,

Did you get any idea for draw signature? I am also having the same scenario and I am looking for any suggestions.

Thanks,
Manikandan

Hi, did you get any response on how to draw signature? I have to automate same scenario for iOS application. Please help me.

For my application, signature is a mandatory fields to go through to next step, so instead of drawing complicated signatures, i used to just draw a straight line using standard coordinates,
driver.swipe(x1, y1, x1-offset, x2-offset, TimeInMilliSecs);
which resolved my problem for a while, but later in Appium version 6.1.0, driver.swipe method is deprecated. So no work arounds as found as of now, any ideas are much appreciated.

I resolved drawing signature using following method
public static void swipe(MobileDriver driver, int startX, int startY, int endX,int endY) {
JavascriptExecutor js = (JavascriptExecutor) driver;
Map<String, Object> params = new HashMap<>();
params.put(“duration”, 1.0);
params.put(“fromX”, startX);
params.put(“fromY”, startY);
params.put(“toX”, endX);
params.put(“toY”, endY);
js.executeScript(“mobile: dragFromToForDuration”, params);
}

With Appium 3, you can use below code
final PointerInput FINGER = new PointerInput(PointerInput.Kind.TOUCH, “finger”);
Point start = new Point(605, 817);
Point end = new Point (1760, 674);
Sequence swipe = new Sequence(FINGER, 1)
.addAction(
FINGER.createPointerMove(
Duration.ofMillis(0),
PointerInput.Origin.viewport(),
start.getX(),
start.getY()))
.addAction(FINGER.createPointerDown(PointerInput.MouseButton.LEFT.asArg()))
.addAction(
FINGER.createPointerMove(
Duration.ofMillis(1000),
PointerInput.Origin.viewport(),
end.getX(),
end.getY()))
.addAction(FINGER.createPointerUp(PointerInput.MouseButton.LEFT.asArg()));
driver.perform(Arrays.asList(swipe));