I am working on a qa automation project using Selenium webdriver.
I need to perform drag and drop on a telerik rad grid for reordering columns and then right click on the grid to save the changes made.
Is there any way i can achieve these using selenium webdriver ?
Thanks.
Find the required target element i.e. 'Drop Here' object in our sample. Now Drag and Drop 'Drag me to my target' object to 'Drop Here' object. Verify message displayed on 'Drop Here' to verify that source element is dropped at the target element. Close the browser to end the program.
Move to Element: contextClick() method first performs mouseMove to the middle of the element location. This function performs the right click at the middle of the web element. Build: build() method is used to generate a composite action containing all actions.
Right click action in Selenium web driver can be done using Actions class. Right Click operation is also called Context Click in Selenium. Pre-defined method context click provided by Actions class is used to perform right click operation.
Some web application, have a functionality to drag web elements and drop them on defined area or element. We can automate drag and drop of such elements using Selenium Webdriver.
For drag and drop you may try:
using OpenQA.Selenium.Interactions;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium;
RemoteWebDriver driver = new FirefoxDriver();
Actions action = new Actions(driver);
IWebElement sourceElement = FindElement(By.Id("id1"));
IWebElement targetElement = FindElement(By.Id("id2"));
IWebElement gridElement = FindElement(By.Id("grid"));
action.DragAndDrop(sourceElement, targetElement).Perform(); //drag&drop
Thread.Sleep(500); //if necessary
action.ContextClick(gridElement).Perform(); //right click
or you may use JavaScript for this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With