The blog gives you idea of testing and automation testing example of selenium webdriver,SQl and Jmeter, you see the basic example of selenium web driver and get idea how to do automation testing,

Perform Drag-and-Drop operation

If you want to drag and drop some element in Automation testing then you should have to use action class. Action class Supports all user interactions Example : Mouse and Keyboard event on a web page or application

You have to find Xpath of elements, first which element you want to drag and second where you want to drop.

WebDriver driver = new FirrfoxDriver();
// Element which you want to drag
WebElement elementToDrag = driver.findElement(By.id("elementToDrag"));
// element at which position you want to drop
WebElement elementToDropAt = driver.findElement(By.id("placeWhereDrag"));

Actions action = new Actions(driver);
action.dragAndDrop(elementToDrag, elementToDropAt).perform();


dragAndDrop method is in the actions class which takes two parameters as input. One is the element to drag and another one is the destination to drop element.
after execution of above code you element will be drap from one position to another position.

No comments

Post a Comment

Powered by Blogger.