Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

0 like 0 dislike
312 views
by The go-to Tester (473 points)
retagged by
Many times during print or graphics area, we need to use mouse drag and drop to sketch anything. So how can we perform this drag and drop functionality in selenium?

1 Answer

0 like 0 dislike
by The go-to Tester (181 points)

You can use Action class to perform drag and drop of an element.

Actions action = new Actions(driver);
action.dragAndDrop(Sourcelocator, Destinationlocator).build().perform();
 
We can also make it as below:
(new Actions(driver)).dragAndDrop(element, target).perform();
 
Hope that helps.


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

...