Click buttons within a canvas

I’m unable to click buttons, text, etc within a canvas using Katalon Studio unless I switch to SVG mode by placing the following at the end of the browser URL /?renderMode=SVG.

Im able to click on objects using Chrome in rendermode=svg by pointing to the objects XPATH and pointing to an iframe withing the object. but unable to do the same within Firefox and MS Edge What is the suggested method for clicking buttons text etc within a Canvas? Do you have an example?

You can do so with moveTo and an offset

//Possition in Canvas X = 60 Y = 30… find with a messuring tool what you need
Actions actions = new Actions(DriverFactory.getWebDriver());
actions.moveToElement(d.findElement(By.xpath(“your canvas id here”)), 60, 30).click();;

Is there a way to do this without using the X Y coordinates? When I use SVG mode I can use the xpath for the button within the canvas without using X,Y coordinates but SVG mode seems to have issues with headless mode and with firefox and ms Edge. It only works with Chrome.

@Spaz12 That is a difficult question without knowing the page and where the button might be on the canvas. You can seperate the movement with moveByOffset(200, 60) once you have the element. But what i think is that headless screws you over a bit, did you try making a screenshot of the page in that current state and check if the button is actual in reach ?