summaryrefslogtreecommitdiff
path: root/src/main/java/com/mavlushechka/a1qa/driverUtils/ActionUtils.java
blob: 88caf460534d8f022242bfd28fdca8165bc20e08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package com.mavlushechka.a1qa.driverUtils;

import org.openqa.selenium.Point;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;

public class ActionUtils {

    private ActionUtils() {
    }

    public static void dragAndDrop(WebElement element, Point currentPoint, Point expectedPoint) {
        new Actions(WebDriverSingleton.getInstance())
                .moveToElement(element, currentPoint.x, currentPoint.y)
                .click()
                .dragAndDropBy(element, expectedPoint.x, expectedPoint.y)
                .build()
                .perform();
    }

}