Created
September 5, 2022 01:03
-
-
Save bharathmuddada/0c6c068637d0e2bff458af2263460663 to your computer and use it in GitHub Desktop.
C# Selenium program to perform Drag and Drop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DragandDrop { | |
public static void Main(string[] args) | |
{ | |
new DriverManager().SetUpDriver(new ChromeConfig()); | |
var driver = new ChromeDriver(); | |
driver.Navigate().GoToUrl("http://demo.guru99.com/test/drag_drop.html"); | |
driver.Manage().Window.Maximize(); | |
var sales_button = driver.FindElement(By.XPath("//*[@id='credit1']/a")); | |
var bank_button = driver.FindElement(By.XPath("//*[@id='credit2']/a")); | |
var amount_button = driver.FindElement(By.XPath("//*[@id='fourth']/a")); | |
var debitsideaccount_element = driver.FindElement(By.XPath("//*[@id='bank']/li")); | |
var debitsideamount_element = driver.FindElement(By.XPath("//*[@id='amt7']/li")); | |
Actions actions = new Actions(driver); | |
actions.DragAndDrop(bank_button, debitsideaccount_element).Build().Perform(); | |
actions.DragAndDrop(amount_button, debitsideamount_element).Build().Perform(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment