TestAutomationEssentials.Selenium.BrowserElement.DragAndDrop C# (CSharp) Method

DragAndDrop() public method

Drags the current element onto the target element
is null
public DragAndDrop ( BrowserElement target ) : void
target BrowserElement The target element to drop the current element onto
return void
        public void DragAndDrop(BrowserElement target)
        {
            if (target == null)
                throw new ArgumentNullException("target");

            Logger.WriteLine("Drag element '{0}' to '{1}'", Description, target.Description);
            var targetWebElement = target.WebElement;
            var action = CreateActionsSequence();
            var dragAndDrop = action.MoveToElement(WebElement).DragAndDrop(WebElement, targetWebElement).Build();
            dragAndDrop.Perform();
        }