diff options
Diffstat (limited to 'src/main/java/com/mavlushechka/a1qa/driverUtils/ActionUtils.java')
-rw-r--r-- | src/main/java/com/mavlushechka/a1qa/driverUtils/ActionUtils.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/main/java/com/mavlushechka/a1qa/driverUtils/ActionUtils.java b/src/main/java/com/mavlushechka/a1qa/driverUtils/ActionUtils.java new file mode 100644 index 0000000..bd7b85b --- /dev/null +++ b/src/main/java/com/mavlushechka/a1qa/driverUtils/ActionUtils.java @@ -0,0 +1,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); + } + +} |