Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.openqa.selenium.By;
- import org.openqa.selenium.Point;
- import org.openqa.selenium.WebDriver;
- import org.openqa.selenium.WebElement;
- import org.openqa.selenium.firefox.FirefoxDriver;
- import org.openqa.selenium.interactions.Actions;
- public class testdragjquery {
- private static WebDriver myTestDriver;
- public static void main(String[] args) throws InterruptedException {
- myTestDriver = new FirefoxDriver();
- myTestDriver.get("http://tinyurl.com/2rxmut");
- Point MyPoint= myTestDriver.findElement(By.id("insideParent")).getLocation();
- System.out.println(MyPoint.x+"--------"+MyPoint.y);
- WebElement draggable = myTestDriver.findElement(By.id("insideParent"));
- new Actions(myTestDriver)
- .dragAndDropBy(draggable, MyPoint.x + 10, MyPoint.y +20)
- .build()
- .perform();
- Thread.sleep(5000L);
- new Actions(myTestDriver)
- .dragAndDropBy(draggable, MyPoint.x + 20, MyPoint.y +20)
- .build()
- .perform();
- Thread.sleep(5000L);
- new Actions(myTestDriver)
- .dragAndDropBy(draggable, MyPoint.x + 30, MyPoint.y +20)
- .build()
- .perform();
- Thread.sleep(5000L);
- new Actions(myTestDriver)
- .dragAndDropBy(draggable, MyPoint.x + 40, MyPoint.y +20)
- .build()
- .perform();
- Thread.sleep(5000L);
- new Actions(myTestDriver)
- .dragAndDropBy(draggable, MyPoint.x + 50, MyPoint.y +20)
- .build()
- .perform();
- myTestDriver.quit();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement