driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
WebElement fromElement=driver.findElement(By.id("todrag"));
WebElement toElement=driver.findElement(By.id("todrop"));
Actions builder = new Actions(driver);
1.
builder.dragAndDrop(fromElement, toElement).build().perform();
2.
builder.clickAndHold(fromElement).build().perform();
builder.moveToElement(toElement).build().perform();
builder.release(toElement).build().perform();
3.
builder.dragAndDropBy(fromElement, xoffset, yoffset).perform();
Example: builder.dragAndDropBy(fromElement, -20).perform();
4.
Action dragAndDrop = builder.clickAndHold(fromElement)
.moveToElement(dropElement)
.release(toElement)
.build();
dragAndDrop.perform();
WebElement fromElement=driver.findElement(By.id("todrag"));
WebElement toElement=driver.findElement(By.id("todrop"));
Actions builder = new Actions(driver);
1.
builder.dragAndDrop(fromElement, toElement).build().perform();
2.
builder.clickAndHold(fromElement).build().perform();
builder.moveToElement(toElement).build().perform();
builder.release(toElement).build().perform();
3.
builder.dragAndDropBy(fromElement, xoffset, yoffset).perform();
Example: builder.dragAndDropBy(fromElement, -20).perform();
4.
Action dragAndDrop = builder.clickAndHold(fromElement)
.moveToElement(dropElement)
.release(toElement)
.build();
dragAndDrop.perform();
No comments:
Post a Comment