Drag and Drop of Card in Angular Application not working using selenium C#
I am trying to perform drag and drop of card in Angular application using selenium c# using Actions class but unfortunately not working. Below is the application screenshot. [ Below is the code I am using to perform drag and drop. IWebElement source = Browser.Driver.FindElement(By.XPath("//mat-card[contains(@class,'mat-card mat-focus-indicator cdk-drag ng-star-inserted')]")); IWebElement destination = Browser.Driver.FindElement(By.XPath("//gridster[contains(@class,'dashboard-grid')]")); try { Actions builder = new Actions(Driver); IAction dragAndDrop = builder.ClickAndHold(source) .MoveToElement(destination) .Release() .Build(); dragAndDrop.Perform(); } catch (Exception E) { Console.WriteLine("Drag and Drop Unsuccessful" + E.Message); } Note: Same code is working fine in other parts of application to perform Drag and Drop
I am trying to perform drag and drop of card in Angular application using selenium c# using Actions class but unfortunately not working.
Below is the application screenshot.
[
Below is the code I am using to perform drag and drop.
IWebElement source = Browser.Driver.FindElement(By.XPath("//mat-card[contains(@class,'mat-card mat-focus-indicator cdk-drag ng-star-inserted')]"));
IWebElement destination = Browser.Driver.FindElement(By.XPath("//gridster[contains(@class,'dashboard-grid')]"));
try
{
Actions builder = new Actions(Driver);
IAction dragAndDrop = builder.ClickAndHold(source)
.MoveToElement(destination)
.Release()
.Build();
dragAndDrop.Perform();
}
catch (Exception E)
{
Console.WriteLine("Drag and Drop Unsuccessful" + E.Message);
}
Note: Same code is working fine in other parts of application to perform Drag and Drop