Is there a way to automate e-signature input in Selenium?
I attempted using the action class to draw a line on the canvas object. Below is the code I used:
Actions actionBuilder=new Actions(driver);
Action drawOnCanvas=actionBuilder
.contextClick(canvas_div)
.moveToElement(wbCanvas,8,8)
.clickAndHold(wbCanvas)
.moveByOffset(120, 120)
.moveByOffset(60,70)
.moveByOffset(-140,-140)
.release(canvas_div)
.build();
drawOnCanvas.perform();
Although Selenium can identify the canvas element and mouse movement is visible, nothing is drawn on the canvas element.
Currently, manual input from an e-signature device is required. Below is the HTML code for the element:
<div class="col-lg-12 col-md-12 col-sm-12" id="canvas_div">
<canvas height="75" class="col-lg-12 col-md-12 col-sm-12" id="eSignatureDialog_canvas" style="border: 1px solid rgb(0, 0, 0); border-image: none;" name="eSignatureDialog_canvas">
</canvas>
</div>