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.atanas.kanchev.testframework.selenium.handlers.Interact.java

License:Apache License

/**
 * {@inheritDoc}/* w ww. j a v  a  2 s.co  m*/
 */
@Override
public Interact clickAndHold(int duration) {
    if (((SeleniumContext) context().getCurrentContext()).getCurrentElement() != null) {
        logger.debug("Click and Hold Element");
        Actions actions = new Actions(((SeleniumContext<WebDriver>) context().getCurrentContext()).getDriver());
        actions.clickAndHold(((SeleniumContext) context().getCurrentContext()).getCurrentElement()).perform();
        sleep(duration);
        actions.release(((SeleniumContext) context().getCurrentContext()).getCurrentElement()).perform();

    } else {
        logger.error("clickAndHold() : Element is Null");

    }
    return this;
}

From source file:com.atanas.kanchev.testframework.selenium.handlers.Interact.java

License:Apache License

/**
 * {@inheritDoc}//www.  ja v a2s  . c  o  m
 */
@Override
public Interact doubleClick() {
    if (((SeleniumContext) context().getCurrentContext()).getCurrentElement() != null) {
        logger.debug("Double Clicking Element");
        Actions actions = new Actions(((SeleniumContext<WebDriver>) context().getCurrentContext()).getDriver());
        actions.doubleClick(((SeleniumContext) context().getCurrentContext()).getCurrentElement()).perform();

    } else {
        logger.error("doubleClick() : Element is Null");

    }
    return this;
}

From source file:com.atanas.kanchev.testframework.selenium.handlers.Interact.java

License:Apache License

/**
 * {@inheritDoc}//from   ww w  . j  a  v a2  s. com
 */
@Override
public Interact hover() {
    if (((SeleniumContext) context().getCurrentContext()).getCurrentElement() != null) {
        logger.debug("Double Clicking Element");
        Actions actions = new Actions(((SeleniumContext<WebDriver>) context().getCurrentContext()).getDriver());
        actions.moveToElement(((SeleniumContext) context().getCurrentContext()).getCurrentElement()).perform();

    } else {
        logger.error("doubleClick() : Element is Null");

    }
    return this;
}

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

License:Apache License

public Actions getActionChain() {
    return new Actions(getDriver());
}

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 www  .j a va2  s . c o 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();/* ww  w.j  a v  a 2 s . c  o  m*/
    MenuItems.click().build().perform();
    waitTOSync();
}

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

public void verifySkimmerFunctionality() {

    WebElement DragPos = element("DragPos");
    WebElement DropPos = element("DropPos");
    WebElement DropWeek2 = element("DragPosWeek2");
    Actions act = new Actions(driver);
    act.dragAndDrop(DragPos, DropPos).build().perform();
    Assert.assertTrue(element("verifyWeek").isDisplayed(), "Week View is not enable or set as default");
    waitTOSync();/*from  ww w  . j av a2 s . co m*/
    waitTOSync();
    waitTOSync();
    act.dragAndDrop(DropPos, DropWeek2).build().perform();

}

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

public void clickOnEscButton() {
    Actions action = new Actions(driver);
    action.sendKeys(Keys.ESCAPE);
}

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

public void selectText() {
    waitForElementPresent("highlighttext");
    WebElement element = driver.findElement(By.xpath(""));
    waitTOSync();/*from  w  w w. ja va  2  s .  c  o  m*/
    // assuming driver is a well behaving WebDriver
    Actions actions = new Actions(driver);
    // and some variation of this:
    actions.moveToElement(element, 10, 5).clickAndHold().moveByOffset(30, 0).release().perform();
}

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

License:Open Source License

@Override
public void rightClick(String locator) {
    WebElement e1 = elementToBeClickable(locator);
    Actions action = new Actions(webDriver);
    action.contextClick(e1).build().perform();
    delay(FIVE);//w w w  .  ja  v a  2 s  . co  m
}