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.autocognite.selenium.lib.SeleniumWebUiDriver.java

License:Apache License

public void moveToElementAndClick(WebElement element) throws Exception {
    Actions builder = getActionChain();
    builder.moveToElement(element).click(element).perform();
}

From source file:com.autocognite.selenium.lib.SeleniumWebUiDriver.java

License:Apache License

public void hover(By findBy) throws Exception {
    Actions builder = getActionChain();
    WebElement element = findElement(findBy);
    builder.moveToElement(element).perform();
}

From source file:com.autocognite.selenium.lib.SeleniumWebUiDriver.java

License:Apache License

@Override
public void hover(WebElement element) throws Exception {
    Actions builder = getActionChain();
    builder.moveToElement(element).perform();
}

From source file:com.autocognite.selenium.lib.SeleniumWebUiDriver.java

License:Apache License

public void hoverAndClick(WebElement element) throws Exception {
    try {/*from  w ww  .  j a v a  2  s . co  m*/
        Actions builder = getActionChain();
        builder.moveToElement(element).perform();
        getWaiter().until(ExpectedConditions.elementToBeClickable(element));
        element.click();
    } catch (Exception e) {
        moveToElementAndClick(element);
    }
}

From source file:com.autocognite.selenium.lib.SeleniumWebUiDriver.java

License:Apache License

public void hoverAndClick(By finder1, By finder2) throws Exception {
    Actions builder = null;
    try {//  w  w w.  ja  va2 s .  c om
        builder = getActionChain();
        builder.moveToElement(findElement(finder1)).perform();
        getWaiter().until(ExpectedConditions.elementToBeClickable(finder2));
        findElement(finder2).click();
    } catch (Exception e) {
        builder = getActionChain();
        builder.moveToElement(findElement(finder1)).click(findElement(finder2)).perform();
    }
}

From source file:com.bc.opec.webtests.TestUserInfo.java

License:Open Source License

@Test
public void testThatUserInfoBalloonIsShown() throws Exception {
    WebElement webElement = driver.findElement(By.xpath("//*/div[@aria-describedby='user-info-balloon']"));
    assertNotNull(webElement);//from  w w w . j ava 2s . co  m
    if (webElement.getAttribute("aria-describedby").equals("user-info-balloon")) {
        assertEquals("none", webElement.getCssValue("display").toLowerCase());

        final WebElement element = driver.findElement(By.id("userInfoToggleBtn"));
        Actions actions = new Actions(driver);
        actions.moveToElement(element).click().perform();

        assertEquals("block", webElement.getCssValue("display").toLowerCase());
    }
}

From source file:com.cengage.mindtap.keywords.AssignableActivityPageActions.java

protected void clickOnElementUsingActionBuilder(WebElement element) {
    Actions builder = new Actions(driver);
    Actions MenuItems = builder.moveToElement(element);
    waitTOSync();//from ww  w. j a v  a 2 s  .co  m
    MenuItems.click().build().perform();
    waitTOSync();
}

From source file:com.chtr.tmoauto.webui.CommonFunctions.java

License:Open Source License

@Override
public Actions mouseOverByActions(String locator) {
    Actions action = new Actions(webDriver);
    action.moveToElement(findElement(locator));
    return action;
}

From source file:com.chtr.tmoauto.webui.CommonFunctions.java

License:Open Source License

/**
 * This method uses the webDriver object to move over the desired child element and click using action class
 *
 * @param locator/*from   w  w w .jav  a2  s .  c o  m*/
 */
@Override
public void moveToElementAndClick(String... locatores) {
    Actions action = new Actions(webDriver);
    String locator = null, bLocator = null;
    for (String b : locatores) {
        locator = b;
        delay(3);
        if (!isVisible(locator)) {
            action.moveToElement(findElement(bLocator)).build().perform();
            delay(3);
        }
        action.moveToElement(findElement(locator, 20)).build().perform();
        bLocator = locator;
    }
    log.info("Moving to and Clicking: " + locator);
    try {
        action.moveToElement(findElement(locator)).click().build().perform();
    } catch (Exception e) {
        click(locator);
    }
}

From source file:com.chtr.tmoauto.webui.CommonFunctions.java

License:Open Source License

@Override
public Actions mouseOverByActions(WebElement locator) {
    Actions action = new Actions(webDriver);
    action.moveToElement(locator);
    return action;
}