-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathAUI.java
More file actions
43 lines (32 loc) · 1.11 KB
/
Copy pathAUI.java
File metadata and controls
43 lines (32 loc) · 1.11 KB
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
30
31
32
33
34
35
36
37
package chapter17;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.Point;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.interactions.Actions;
public class AUI {
static ChromeDriver driver;
public static void main(String[] args) {
driver = new ChromeDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
droppable();
}
static void draggable() {
driver.get("https://jqueryui.com/draggable/");
driver.switchTo().frame(0);
WebElement src = driver.findElementById("draggable");
Actions builder = new Actions(driver);
Point location = src.getLocation();
builder.dragAndDropBy(src, location.getX()+20, location.getY()+2000)
.perform();
}
static void droppable() {
driver.get("https://jqueryui.com/droppable/");
driver.switchTo().frame(0);
WebElement src = driver.findElementById("draggable");
WebElement target = driver.findElementById("droppable");
Actions builder = new Actions(driver);
Point location = src.getLocation();
builder.dragAndDrop(src, target).build().perform();
}
}