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


On this page of the site you can watch the video online Drag and Drop using Java in Selenium Webdriver with a duration of hours minute second in good quality, which was uploaded by the user SDET Adda For QA Automation 05 February 2023, share the link with friends and acquaintances, this video has already been watched 1,570 times on youtube and it was liked by 38 viewers. Enjoy your viewing!