summaryrefslogtreecommitdiff
path: root/src/main/java/com/mavlushechka/a1qa/driverUtils/ActionUtils.java
blob: bd7b85b4b2a7693404f06c048dbb71b7cc274c42 (plain)
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
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();
    }

    public static void scrollTo(WebElement webElement) {
        new Actions(WebDriverSingleton.getInstance()).moveToElement(webElement);
    }

}