-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExample13.java
More file actions
29 lines (22 loc) · 964 Bytes
/
Example13.java
File metadata and controls
29 lines (22 loc) · 964 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package com.SeleniumTestingSamples.Examples;
import java.time.Duration;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.interactions.Actions;
//DRAG AND DROP
public class Example13 {
public static void main(String[] args) throws InterruptedException {
WebDriver driver = new ChromeDriver();
driver.get("https://www.leafground.com/drag.xhtml");
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10000));
WebElement from = driver.findElement(By.xpath("//*[@id=\'form:drop_header\']"));
WebElement to = driver.findElement(By.xpath("//*[@id=\'form:drop_header\']"));
Actions actions = new Actions(driver);
Thread.sleep(5000);
actions.dragAndDrop(from, to).build().perform();
System.out.print("Successfully Dropped");
}
}