Drag and Drop using Java in Selenium Webdriver

Published: 05 February 2023
on channel: SDET Adda For QA Automation
1,570
38

In Selenium, you can perform a #drag-and-drop action using the Actions class.

dragAndDrop(WebElement source, WebElement target): This method performs left click, hold the click to hold the source element, moves to the location of the target element and then releases the mouse click.

Let’s see how to use Action class methods to perform drag-drop action:

First, instantiate an Actions class:

Actions actions = new Actions(driver);

As you can see, the dragAndDrop(WebElement source, WebElement target) method has two arguments to pass. One is a source web element and another is target web element. This source web element is any web element that needs to be dragged. Target web element is any web element on which dragged object needs to be placed or dropped.


Website references:
https://jqueryui.com/droppable/
https://www.selenium.dev/selenium/doc...

#framework #selenium #seleniumframework #draganddrop #actionsclass #extentreports
#testng #testrunner #webdriver #actionsapiinselenium #log4j2


Watch video Drag and Drop using Java in Selenium Webdriver online, duration hours minute second in high quality that is uploaded to the channel SDET Adda For QA Automation 05 February 2023. Share the link to the video on social media so that your subscribers and friends will also watch this video. This video clip has been viewed 1,570 times and liked it 38 visitors.