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

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

Introduction

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

Prototype

public Actions moveToElement(WebElement target) 

Source Link

Document

Moves the mouse to the middle of the element.

Usage

From source file:com.ggasoftware.jdi_ui_tests.elements.base.Element.java

License:Open Source License

public void mouseOver() {
    doJAction("Move mouse over element", () -> {
        getWebElement().getSize(); //for scroll to object
        Actions builder = new Actions(getDriver());
        builder.moveToElement(getWebElement()).build().perform();
    });/*from   w ww.  j  ava2  s .  c  o  m*/
}

From source file:com.ggasoftware.uitest.control.Element.java

License:Open Source License

/**
 * Mouse Over on the the given element.//from ww w  . j a  va2  s  .c  o  m
 *
 * @return Parent instance
 */
public ParentPanel mouseOver() {
    getWebElement().getSize(); //for scroll to object
    logAction(this, getParentClassName(), "mouseOver");
    Actions builder = new Actions(getDriver());
    builder.moveToElement(getWebElement()).build().perform();
    return parent;
}

From source file:com.ggasoftware.uitest.control.Elements.java

License:Open Source License

/**
 * Mouse Over on the the element by index.
 *
 * @param elementIndex - index of WebElement
 * @return Parent instance//w w w. j  a  v a 2 s .  c o m
 */
public ParentPanel mouseOver(int elementIndex) {
    getWebElements().get(elementIndex).getSize(); //for scroll to object
    logAction(this, getParentClassName(), "mouseOver");
    Actions builder = new Actions(WebDriverWrapper.getDriver());
    builder.moveToElement(getWebElements().get(elementIndex)).build().perform();
    return parent;
}

From source file:com.gwtplatform.carstore.cucumber.application.BasePage.java

License:Apache License

private void moveToElement(WebElement webElement) {
    Actions actions = new Actions(webDriver);
    actions.moveToElement(webElement);
    actions.perform();/*  www .  j  a v  a 2 s.co  m*/
}

From source file:com.jaeksoft.searchlib.crawler.web.browser.BrowserDriver.java

License:Open Source License

/**
 * Click on the given WebElement using Actions
 * /*from   ww w  .j  a  v  a2s. c o  m*/
 * @param element
 * @return
 */
public void click(WebElement element) {
    Actions builder = new Actions(driver);
    Action click = builder.moveToElement(element).click(element).build();
    click.perform();
}

From source file:com.liferay.blade.sample.test.functional.utils.BladeSampleFunctionalActionUtil.java

License:Apache License

public static void customClick(WebDriver webDriver, WebElement webElement) {
    Actions action = new Actions(webDriver);

    Actions actionMoveTo = action.moveToElement(webElement);

    Action buildActionMoveTo = actionMoveTo.build();

    buildActionMoveTo.perform();//from  w w  w. j  a va2 s  .  com

    WebDriverWait wait = new WebDriverWait(webDriver, 30);

    WebElement element = wait.until(ExpectedConditions.elementToBeClickable(webElement));

    element.click();
}

From source file:com.liferay.blade.samples.servicebuilder.web.BladeServiceBuilderWebTest.java

License:Apache License

public void customClick(WebDriver webDriver, WebElement webElement) {
    Actions action = new Actions(webDriver);

    action.moveToElement(webElement).build().perform();

    WebDriverWait wait = new WebDriverWait(webDriver, 5);

    WebElement element = wait.until(ExpectedConditions.visibilityOf(webElement));

    element.click();/*w  w w . java2 s .  co  m*/
}

From source file:com.liferay.cucumber.selenium.BaseWebDriverImpl.java

License:Open Source License

@Override
public void mouseDown(String locator) {
    WebElement webElement = getWebElement(locator);

    scrollWebElementIntoView(webElement);

    WrapsDriver wrapsDriver = (WrapsDriver) webElement;

    WebDriver webDriver = wrapsDriver.getWrappedDriver();

    Actions actions = new Actions(webDriver);

    actions.moveToElement(webElement);

    actions.clickAndHold(webElement);/*from   www .  j a v  a  2  s.c  o m*/

    Action action = actions.build();

    action.perform();
}

From source file:com.liferay.cucumber.selenium.BaseWebDriverImpl.java

License:Open Source License

@Override
public void mouseMove(String locator) {
    WebElement webElement = getWebElement(locator);

    scrollWebElementIntoView(webElement);

    WrapsDriver wrapsDriver = (WrapsDriver) webElement;

    WebDriver webDriver = wrapsDriver.getWrappedDriver();

    Actions actions = new Actions(webDriver);

    actions.moveToElement(webElement);

    Action action = actions.build();

    action.perform();/*  ww w  . j av  a 2 s.  c  om*/
}

From source file:com.liferay.cucumber.selenium.BaseWebDriverImpl.java

License:Open Source License

@Override
public void mouseOut(String locator) {
    WebElement webElement = getWebElement(locator);

    scrollWebElementIntoView(webElement);

    WrapsDriver wrapsDriver = (WrapsDriver) webElement;

    WebDriver webDriver = wrapsDriver.getWrappedDriver();

    Actions actions = new Actions(webDriver);

    actions.moveToElement(webElement);
    actions.moveByOffset(10, 10);/*  www  . j  a v  a 2s .  c  o  m*/

    Action action = actions.build();

    action.perform();
}