ipankaj
ipankaj

Reputation: 77

How to automate drag and drop and click in Canvas Element using Selenium Webdriver?

I have to create automated tests for automating click and drag and drop in Html canvas.

Upvotes: 0

Views: 2403

Answers (3)

Chandra Sekhar
Chandra Sekhar

Reputation: 41

  Actions act=new Actions(driver);
  act.DragAndDrop(webElement_Source, webElement_Target)).Build().Perform();

Upvotes: 0

Vinay
Vinay

Reputation: 754

Well long story short we can do this using Actions class. Below code should get you started.

Actions act = new Actions(driver);
act.dragAndDrop(fromLocation, toLocation).perform();

Just ensure both fromLocation and toLocation are webelements. Cheers

Upvotes: 1

Marco
Marco

Reputation: 508

This documentation about Advanced User Actions might be useful.

Upvotes: 1

Related Questions