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

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -