Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- System.setProperty("webdriver.chrome.driver", "F:\Drivers\chromedriver.exe");
- d = new ChromeDriver();
- d.manage().window().maximize();
- d.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
- Actions act = new Actions(d);
- d.get("https://marceljuenemann.github.io/angular-drag-and-drop-lists/demo/#/nested");
- Thread.sleep(2000);
- ((JavascriptExecutor)d).executeScript("scroll(4,400)");
- WebElement src = d.findElement(By.xpath("html/body/div[2]/div[2]/div[2]/div[1]/div[1]/div[2]/div/div/ul/li[1]/div"));
- System.out.println("The src element is:" +src.getText());
- WebElement destn = d.findElement(By.xpath("html/body/div[2]/div[2]/div[2]/div[1]/div[1]/div[1]/div/div/ul/li[1]/div/div[2]/ul/li/div"));
- System.out.println("The src element is:" +destn.getText());
- org.openqa.selenium.Point pt1 = src.getLocation();
- org.openqa.selenium.Point pt2 = destn.getLocation();
- int xCord1 = pt1.getX();
- int yCord1 = pt1.getY();
- int xCord2 = pt2.getX();
- int yCord2 = pt2.getY();
- System.out.println("The X & Y cordinate of the src is:" +xCord1+ " & " +yCord1);
- System.out.println("The X & Y cordinate of the destn is:" +xCord2+ " & " +yCord2);
- Actions ac = new Actions(d);
- Action dragAndDrop = ac.clickAndHold(src).moveToElement(destn, 334, 661).release(destn).build();
- dragAndDrop.perform();
Add Comment
Please, Sign In to add comment