- Jan 08, 2023
- admin
- 0
Drag And Drop in Selenium C#.
[Test]
public void DragandDrop()
{
dr.Navigate().GoToUrl("http://demo.guru99.com/test/drag_drop.html");
//Element which needs to drag.
IWebElement From = dr.FindElement(By.XPath("//*[@id='credit2']/a"));
//Element on which need to drop.
IWebElement To = dr.FindElement(By.XPath("//*[@id='bank']/li"));
//Using Action class for drag and drop.
Actions act = new Actions(dr);
//Dragged and dropped.
act.DragAndDrop(From, To).Build().Perform();
}