Example usage for org.openqa.selenium.interactions Actions Actions

List of usage examples for org.openqa.selenium.interactions Actions Actions

Introduction

In this page you can find the example usage for org.openqa.selenium.interactions Actions Actions.

Prototype

public Actions(WebDriver driver) 

Source Link

Usage

From source file:com.epam.jdi.uitests.mobile.appium.elements.base.Element.java

License:Open Source License

public void rightClick() {
    invoker.doJAction("Right click on Element", () -> {
        Actions builder = new Actions(getDriver());
        builder.contextClick(getWebElement()).perform();
    });//  www.  j  a va  2  s. c  o m
}

From source file:com.epam.jdi.uitests.mobile.appium.elements.base.Element.java

License:Open Source License

public void clickCenter() {
    invoker.doJAction("Click in Center of Element", () -> {
        Actions builder = new Actions(getDriver());
        builder.click(getWebElement()).perform();
    });//  www.  j a  va 2s  .  c  o m
}

From source file:com.epam.jdi.uitests.mobile.appium.elements.base.Element.java

License:Open Source License

public void mouseOver() {
    invoker.doJAction("Move mouse over Element", () -> {
        Actions builder = new Actions(getDriver());
        builder.moveToElement(getWebElement()).build().perform();
    });//from w  w  w . j a  v  a 2 s . c  o  m
}

From source file:com.epam.jdi.uitests.mobile.appium.elements.base.Element.java

License:Open Source License

public void focus() {
    invoker.doJAction("Focus on Element", () -> {
        Dimension size = getWebElement().getSize(); //for scroll to object
        new Actions(getDriver()).moveToElement(getWebElement(), size.width / 2, size.height / 2).build()
                .perform();//  w  w  w.java2 s  .c o m
    });
}

From source file:com.epam.jdi.uitests.mobile.appium.elements.base.Element.java

License:Open Source License

public void selectArea(int x1, int y1, int x2, int y2) {
    invoker.doJAction(format("Select area: from %d,%d;to %d,%d", x1, y1, x2, y2), () -> {
        WebElement element = getWebElement();
        new Actions(getDriver()).moveToElement(element, x1, y1).clickAndHold().moveToElement(element, x2, y2)
                .release().build().perform();
    });//  ww w  .  j a va  2  s.c  o  m
}

From source file:com.epam.jdi.uitests.mobile.appium.elements.base.Element.java

License:Open Source License

public void dragAndDropBy(int x, int y) {
    invoker.doJAction(format("Drag and drop Element: (x,y)=(%s,%s)", x, y),
            () -> new Actions(getDriver()).dragAndDropBy(getWebElement(), x, y).build().perform());
}

From source file:com.epam.jdi.uitests.mobile.appium.elements.base.Element.java

License:Open Source License

public void dragAndDrop(Element target) {
    invoker.doJAction(format("Drag and drop to Target Element: %s", target.toString()),
            () -> new Actions(getDriver()).dragAndDrop(getWebElement(), target.getWebElement()).build()
                    .perform());//  ww  w.  j  ava2  s  .  co m
}

From source file:com.epam.jdi.uitests.mobile.appium.elements.complex.Menu.java

License:Open Source License

protected void hoverAction(String... name) {
    chooseItemAction(name, el -> {//from   w  ww . j a  v a2s  .  c o  m
        Actions action = new Actions(getDriver());
        action.moveToElement(el).clickAndHold().build().perform();
    });
}

From source file:com.epam.jdi.uitests.web.selenium.elements.base.Element.java

License:Open Source License

public void clickWithKeys(Keys... keys) {
    invoker.doJAction("Ctrl click on Element", () -> {
        Actions action = new Actions(getDriver());
        for (Keys key : keys) {
            action = action.keyDown(key);
        }//from   w w w .  ja  v a  2 s .c o  m
        action = action.moveToElement(getWebElement()).click();
        for (Keys key : keys) {
            action = action.keyUp(key);
        }
        action.perform();
    });
}

From source file:com.epam.jdi.uitests.web.selenium.elements.base.Element.java

License:Open Source License

public void doubleClicks() {
    invoker.doJAction("Double click on Element", () -> {
        Actions builder = new Actions(getDriver());
        builder.doubleClick(getWebElement()).perform();
    });// ww w .  j a  va  2 s  .com
}