adspace
How do you perform drag and drop operation in webdriver?
Answer Posted / Sanjay Kumar Chaubey
To perform a drag and drop operation in Selenium WebDriver, you need to use Actions class. Here's an example for dragging an element from one location to another:
```
Actions action = new Actions(driver);
WebElement source = driver.findElement(By.id("source"));
WebElement target = driver.findElement(By.id("target"));
action.dragAndDrop(source, target).build().perform();
```
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers