forked from TalhaBinAshraf1/SeleniumTestingInternetHerokuApp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDragAndDrop.java
More file actions
33 lines (27 loc) · 1.07 KB
/
Copy pathDragAndDrop.java
File metadata and controls
33 lines (27 loc) · 1.07 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
package allTests;
import org.testng.annotations.Test;
import utility.BaseTest;
import utility.FrameworkConstants;
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;
public class DragAndDrop extends BaseTest{
@Test
public void test() throws InterruptedException {
System.setProperty(FrameworkConstants.CHROME_DRIVER_KEY,FrameworkConstants.CHROME_DRIVER_PATH);
WebDriver driver = new ChromeDriver();
driver.findElement(By.xpath("//a[contains(text(),'Drag and Drop')]")).click();
WebElement elementA = driver.findElement(By.cssSelector("div#column-a"));
System.out.println(elementA.getAttribute("id"));
WebElement elementB = driver.findElement(By.cssSelector("div#column-b"));
int x=elementB.getLocation().getX();
int y=elementB.getLocation().getY();
Actions actions = new Actions(driver);
// elementA.click();
actions.dragAndDrop(elementA, elementB).build().perform();
Thread.sleep(6000);
driver.quit();
}
}