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

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

Introduction

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

Prototype

public Actions click(WebElement target) 

Source Link

Document

Clicks in the middle of the given element.

Usage

From source file:info.magnolia.integrationtests.uitest.AbstractMagnoliaUITest.java

License:Open Source License

/**
 * This allow to select multiple web elements matching the given path.
 *
 * @param path: to list of elements//w w  w.j  ava2  s.co m
 * @param expectedElementCount: number of expected elements
 */
protected void selectMultipleElementsByPath(final By path, final int expectedElementCount) {
    List<WebElement> els = getElements(path, expectedElementCount);

    Actions multiSelect = new Actions(driver).keyDown(Keys.CONTROL);
    for (WebElement el : els) {
        multiSelect = multiSelect.click(el);
    }

    multiSelect.keyUp(Keys.CONTROL).build().perform();
}

From source file:io.openvidu.test.OpenViduClientBrowserTest.java

License:Apache License

public void exitFromRoom(int pageIndex, String userName) {
    Browser userBrowser = getPage(getBrowserKey(pageIndex)).getBrowser();
    try {/*from   w w  w  . j a va  2  s  .c o m*/
        Actions actions = new Actions(userBrowser.getWebDriver());
        actions.click(findElement(userName, userBrowser, "buttonLeaveRoom")).perform();
        log.debug("'buttonLeaveRoom' clicked on in {}", userName);
    } catch (ElementNotVisibleException e) {
        log.warn("Button 'buttonLeaveRoom' is not visible. Session can't be closed");
    }
}

From source file:org.apache.falcon.regression.ui.pages.ProcessPage.java

License:Apache License

/**
 * Vertex is defined by it's entity name and particular time of it's creation.
 *///ww w . j a v a  2  s  .  co  m
public void clickOnVertex(String entityName, String nominalTime) {
    LOGGER.info("Clicking on vertex " + entityName + '/' + nominalTime);
    if (isLineageOpened) {
        WebElement circle = driver
                .findElement(By.xpath(String.format(VERTEX_TEMPLATE, entityName + '/' + nominalTime)));
        Actions builder = new Actions(driver);
        builder.click(circle).build().perform();
        TimeUtil.sleepSeconds(0.5);
    }
}

From source file:org.jboss.arquillian.graphene.ftest.enricher.selenium.TestSeleniumResourceProvider.java

License:Open Source License

@Test
public void testActions(@ArquillianResource Actions actions) {
    // when/*from w  w w .ja  v a  2  s  . c o m*/
    actions.click(button).perform();
    // then
    assertEquals("Clicked", button.getAttribute("value"));
}

From source file:org.jboss.arquillian.graphene.ftest.enricher.TestInitializingPageFragments.java

License:Open Source License

@Test
public void testSupportForAdvancedActions() {
    Actions builder = new Actions(selenium);

    // following tests usage of Actions with injected plain WebElement
    builder.click(input);
    // following with List<WebElement>
    builder.click(divs.get(0));/*from w  w w .ja v  a  2  s . co  m*/
    // following with WebElements from Page Fragments
    builder.click(abstractPageFragmentStub.getLocatorRefByXPath());
    // following with List of WebElements from Page Fragments
    builder.click(abstractPageFragmentStub.getSpansInPageFragment().get(0));

    builder.perform();
}

From source file:org.kurento.room.test.RoomTest.java

License:Open Source License

protected void exitFromRoom(String label, WebDriver userBrowser) {
    try {//  w ww .j  a  v  a2 s. c o  m
        Actions actions = new Actions(userBrowser);
        actions.click(findElement(label, userBrowser, "buttonLeaveRoom")).perform();
        log.debug("'buttonLeaveRoom' clicked on in {}", label);
    } catch (ElementNotVisibleException e) {
        log.warn("Button 'buttonLeaveRoom' is not visible. Session can't be closed");
    }
}

From source file:org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage.java

License:Open Source License

public static void defineCategory(String category) {
    //      GeneralUIUtils.getSelectList(category, getCategoryField());

    Actions action = new Actions(GeneralUIUtils.getDriver());
    action.click(GeneralUIUtils.getWebElementByDataTestId(getCategoryField()));
    action.sendKeys(category).perform();
}

From source file:org.openlmis.UiUtils.TestWebDriver.java

License:Open Source License

public void click(final WebElement element) {
    Actions action = new Actions(driver);
    action.click(element).perform();
}

From source file:org.openlmis.UiUtils.TestWebDriver.java

License:Open Source License

public void clickForRadio(final WebElement element) {
    element.click();/* ww w  .j a v a 2  s  . c om*/
    if (!element.isSelected()) {
        Actions action = new Actions(driver);
        action.click(element).perform();
    }
}

From source file:org.richfaces.bootstrap.demo.ftest.webdriver.pickList.fragment.PickListSelectionImpl.java

License:Open Source License

private void select() {
    if (selection.size() > 1) {
        //multiple selection is not working
        Actions builder = new Actions(driver);
        boolean firstrun = true;
        for (WebElement keyElement : selection) {
            builder.click(keyElement);//also deselect previous selected elements
            if (firstrun) {
                firstrun = false;/*  w w w . java 2s .c  o  m*/
                builder.keyDown(Keys.CONTROL);
            }
        }
        builder.keyUp(Keys.CONTROL);
        builder.build().perform();
    } else {
        selection.get(0).click();
    }
}