How do perform drag and drop using webdriver?



How do perform drag and drop using webdriver?..

Answer / Jitendra Rathore

To perform a drag-and-drop operation using Selenium WebDriver, you can use the `Actions` class. Here is an example for dragging an element with id 'draggable' to an element with id 'droppable':n```javanWebElement draggable = driver.findElement(By.id("draggable"));nWebElement droppable = driver.findElement(By.id("droppable"));nActions action = new Actions(driver);naction.dragAndDrop(draggable, droppable).build().perform();n```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Selenium Interview Questions

What is Selenium IDE?

1 Answers  


What evaluation can selenium do?

1 Answers  


Explain how can you find broken links in a page using selenium webdriver?

1 Answers  


Write a code snippet to perform mouse hover in webdriver.

1 Answers  


What is the difference between "assert" and "verify" commands?

1 Answers  


What is Dynamic xpath in selenium ?

1 Answers   Infogain,


Do you know a way to refresh the browser by using selenium?

1 Answers  


What is pom (page object model)?

1 Answers  


What are the advantages of selenium?

1 Answers  


How to iterate through options in test script?

1 Answers  


What is the selenese command to show the value of a variable in the log file?

1 Answers  


How do you handle Alerts and Pop Ups?

3 Answers   HCL,


Categories