How to move the mouse on canvas to draw, using selenium webdriver -
i want automate drawing on canvas element. have written test case & passes.
but in code, have written function select drawing tool & draw simple line on canvas. end drawing tool selected line not drawn.
below code-
public void drawline() { wait.until(expectedconditions.elementtobeclickable(anotate_draw)); action.click(anotate_draw).perform(); action.clickandhold(canvas_page1) .movebyoffset(420, 280) .movebyoffset(550,300) .release().build().perform(); }
you have answered yourself. may work also:
webelement element = driver.findelement(by.xpath("your xpath")); // canvas element actions builder = new actions(driver); action drawaction = builder.movetoelement(element,50,50) // start point .click() .movebyoffset(100, 60) // second point .doubleclick() .build(); drawaction.perform();
Comments
Post a Comment