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

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

Introduction

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

Prototype

public Actions doubleClick(WebElement target) 

Source Link

Document

Performs a double-click at middle of the given element.

Usage

From source file:com.gargoylesoftware.htmlunit.javascript.host.UIEventTest.java

License:Apache License

/**
 * @throws Exception if an error occurs// w ww .  j a  va2  s.co m
 */
@Test
@Alerts(DEFAULT = { "[object Event]", "undefined", "[object MouseEvent]", "1", "[object MouseEvent]",
        "2" }, IE8 = { "[object]", "undefined", "[object]", "undefined", "[object]", "undefined" }, IE11 = {
                "[object Event]", "undefined", "[object PointerEvent]", "0", "[object PointerEvent]", "0" })
@BuggyWebDriver(FF31)
// FF31 has a detail of '1' for the double click but it is '2' when executed manually
public void detail() throws Exception {
    final String html = "<html><head><script>\n" + "  function alertDetail(e) {\n" + "    alert(e);\n"
            + "    alert(e.detail);\n" + "  }\n" + "</script></head>\n" + "<body onload='alertDetail(event)'>\n"
            + "  <div id='a' onclick='alertDetail(event)'>abc</div>\n"
            + "  <div id='b' ondblclick='alertDetail(event)'>xyz</div>\n" + "</body></html>";
    final WebDriver driver = loadPage2(html);
    driver.findElement(By.id("a")).click();
    final Actions action = new Actions(driver);
    action.doubleClick(driver.findElement(By.id("b")));
    action.perform();
    assertEquals(getExpectedAlerts(), getCollectedAlerts(driver));
}

From source file:com.ggasoftware.jdiuitest.web.selenium.elements.base.Element.java

License:Open Source License

public void doubleClick() {
    invoker.doJAction("Double click on Element", () -> {
        getWebElement().getSize(); //for scroll to object
        Actions builder = new Actions(getDriver());
        builder.doubleClick(getWebElement()).perform();
    });/*from w w  w .j  av  a 2  s.c o m*/
}

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

License:Open Source License

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

    WrapsDriver wrapsDriver = (WrapsDriver) webElement;

    WebDriver webDriver = wrapsDriver.getWrappedDriver();

    Actions actions = new Actions(webDriver);

    actions.doubleClick(webElement);

    Action action = actions.build();

    action.perform();//w ww  .jav  a2s  .co  m
}

From source file:com.mkl.websuites.internal.command.impl.click.DoubleClickCommand.java

License:Apache License

@Override
protected void doOperationOnElement(WebElement elem) {
    Actions actions = new Actions(browser);
    actions.doubleClick(elem).perform();
}

From source file:com.springer.omelet.driver.DriverUtility.java

License:Apache License

/***
 * Double click on WebElement using JavaScript or Actions Class
 * /* ww  w .  j a va 2s.c o  m*/
 * @param element
 *            :Element on which Double click needs to be performed
 * @param clickStrategy
 *            : double click using javascript or using action class
 * @param driver
 * @author kapilA
 */
public static void doubleClick(WebElement element, WebDriver driver, CLICK_STRATEGY clickStrategy) {

    switch (clickStrategy) {

    case USING_ACTION:
        Actions action = new Actions(driver);
        action.doubleClick(element).perform();
        break;
    case USING_JS:
        ((JavascriptExecutor) driver).executeScript("var evt = document.createEvent('MouseEvents');"
                + "evt.initMouseEvent('dblclick',true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0,null);"
                + "arguments[0].dispatchEvent(evt);", element);
    }

}

From source file:com.sugarcrm.candybean.automation.control.VControl.java

License:Open Source License

/**
 * Double-click the element./*from ww w  .j a  va  2  s  .c  om*/
 *
 * @throws Exception    if the element cannot be found
 */
public void doubleClick() throws Exception {
    voodoo.log.info("Selenium: double-clicking on control: " + this.toString());
    Actions action = new Actions(this.iface.wd);
    action.doubleClick(we).perform();
}

From source file:com.sugarcrm.candybean.automation.webdriver.WebDriverElement.java

License:Open Source License

/**
 * Double-click the element.//  w  ww .j  ava2 s. c o m
 */
public void doubleClick() throws CandybeanException {
    logger.info("Double-clicking on element: " + this.toString());
    Actions action = new Actions(this.wd);
    action.doubleClick(we).perform();
}

From source file:com.technophobia.webdriver.substeps.impl.ActionWebDriverSubStepImplementations.java

License:Open Source License

/**
 * Performs a double click on the current element (set with a previous Find
 * method).//www.  j  a  va  2s .com
 * 
 * @example PerformDoubleClick
 * @section Clicks
 * 
 */
@Step("PerformDoubleClick")
public void doDoubleClick() {

    final Actions actions = new Actions(webDriver());

    actions.doubleClick(webDriverContext().getCurrentElement());

    actions.perform();
}

From source file:com.vaadin.addon.charts.testbenchtests.RangeSelectorCustomDateParserTBTest.java

private void setRangeValue(String value, WebElement input) {
    Actions action = new Actions(driver);
    //Should be done as one action, otherwise does not work
    action.doubleClick(input).sendKeys(Keys.chord(Keys.CONTROL, "a")).sendKeys(Keys.BACK_SPACE).sendKeys(value)
            .sendKeys(Keys.TAB).perform();
}

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

License:Open Source License

/**
 * Performs a double click on a web element.
 *///from w  w w  .j a v a2s .  c  o  m
protected void doubleClick(WebElement element) {
    Actions doubleClickOnElement = new Actions(driver);
    doubleClickOnElement.doubleClick(element).perform();
}