Playwright sign an electronic signature

2.8k Views Asked by At

I have a question in regards to Playwright and whether there is a way to sign an electronic signature into a canvas element using the mouse(hold and move the mouse around to simulate a signature) and of course it should be a way longer signature than a dot or a couple of dots but more like a real signature as the application does not allow me to continue with only having a dot or two as a signature.

Also I am not able to do this through codegen as I thought it would work.

Would be thankful for any ideas regarding this issue if any had similar, thanks!

1

There are 1 best solutions below

1
On
 public async drawTheSignature() {
module2Page = new Module2Page();
const rect = await module2Page.signatureField.boundingBox();
await module2Page.signatureField.scrollIntoViewIfNeeded();
await page.mouse.move(rect.x + 10, rect.y + 10);
await page.mouse.down();
await page.mouse.move(rect.x + 100, rect.y + 100);
await page.mouse.move(rect.x + 200, rect.y + 100);
await page.mouse.move(rect.x + 200, rect.y + 130);
await page.mouse.up();

}