Not able to perform signature in an electronic signature box


I have to perform signature in an electronic signature box which is a canvas element… It can’t be a single dot.

I tried the below script but it was still not working

WebUI.dragAndDropByOffset(findTestObject(‘Object Repository/Retail/canvas’), 20, -180)

WebUI.dragAndDropByOffset(findTestObject(‘Object Repository/Retail/canvas’), 80, -20)

Can someone please help me out in this.

Hi, I too had similar requirement and I was able to draw (some thing like a ‘W’) on the canvas using the below method

WebDriver driver = DriverFactory.getWebDriver()

Actions builder = new Actions(driver)

WebElement ele = WebUiCommonHelper.findWebElement(findTestObject(‘CANVAS OBJECT’), 20)

Action drawAction = builder.moveToElement(ele, 50, 0).clickAndHold().moveByOffset(100, 50).release().build().perform()

Action drawAction1 = builder.moveToElement(ele, 100, 0).clickAndHold().moveByOffset(50, 50).release().build().perform()

Action drawAction2 = builder.moveToElement(ele, 100, 0).clickAndHold().moveByOffset(100, 50).release().build().perform()

Hi Arun,

Thanks for the response. But I am getting below error in Console. Have you used the above code in Katalon Studio.

unable to resolve class WebDriver

@ line 36, column 11.

WebDriver driver = DriverFactory.getWebDriver()



Sorry for late reply… Yes I was using the above script in Katalon Studio and please press CTRL+SHIFT+O in the script view to add the library for Webdriver

Hi Arun - Thanks for this answer. I have the code working but the modal for signature is not being drawn on in my case because it’s really small window. I’m assuming the numbers are the coordinates and I can manipulate them to work within the coordinates I have. Is that a correct assumption?
Thanks in advance!