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

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

Introduction

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

Prototype

public Actions keyDown(CharSequence key) 

Source Link

Document

Performs a modifier key press.

Usage

From source file:org.auraframework.test.util.WebDriverTestCase.java

License:Apache License

public Action shiftTab() {
    Actions builder = new Actions(currentDriver);
    builder.keyDown(Keys.SHIFT).sendKeys(Keys.TAB).keyUp(Keys.SHIFT);
    return builder.build();
}

From source file:org.eclipse.che.selenium.pageobject.CodenvyEditor.java

License:Open Source License

/**
 * Select text in defined interval/*from   w ww. j  a  va2s  . c om*/
 *
 * @param fromLine beginning of first line for selection
 * @param numberOfLine end of first line for selection
 */
public void selectLines(int fromLine, int numberOfLine) {
    Actions action = seleniumWebDriverHelper.getAction(seleniumWebDriver);
    setCursorToLine(fromLine);
    action.keyDown(SHIFT).perform();
    for (int i = 0; i < numberOfLine; i++) {
        typeTextIntoEditor(Keys.ARROW_DOWN.toString());
    }
    action.keyUp(SHIFT).perform();
    action.sendKeys(Keys.END.toString()).keyUp(SHIFT).perform();
}

From source file:org.eclipse.che.selenium.pageobject.CodenvyEditor.java

License:Open Source License

/** Launches code assistant by "ctrl" + "space" keys pressing. */
public void launchAutocomplete() {
    Actions action = actionsFactory.createAction(seleniumWebDriver);
    action.keyDown(CONTROL).perform();
    typeTextIntoEditor(SPACE.toString());
    action.keyUp(CONTROL).perform();/*w  w w  .ja  v a2 s .  c  o m*/
}

From source file:org.eclipse.che.selenium.pageobject.CodenvyEditor.java

License:Open Source License

/** Launches the "code assist proposition" container */
public void launchPropositionAssistPanel() {
    loader.waitOnClosed();//  w  w w  . j av  a2 s.  c om
    Actions action = actionsFactory.createAction(seleniumWebDriver);
    action.keyDown(ALT).perform();
    action.sendKeys(ENTER).perform();
    action.keyUp(ALT).perform();
    waitPropositionAssistContainer();
}

From source file:org.eclipse.che.selenium.pageobject.CodenvyEditor.java

License:Open Source License

/** Launches the "code assist proposition" container in JS files */
public void launchPropositionAssistPanelForJSFiles() {
    loader.waitOnClosed();//from  w w  w .jav a 2  s. c o  m
    Actions action = actionsFactory.createAction(seleniumWebDriver);
    action.keyDown(LEFT_CONTROL).perform();
    action.sendKeys(SPACE).perform();
    action.keyUp(LEFT_CONTROL).perform();
}

From source file:org.eclipse.che.selenium.pageobject.CodenvyEditor.java

License:Open Source License

/**
 * Deletes line with specified {@code numberOfLine}.
 *
 * @param numberOfLine number of line which should be deleted
 *//*www  . ja  va2  s.  c  o m*/
public void selectLineAndDelete(int numberOfLine) {
    Actions action = actionsFactory.createAction(seleniumWebDriver);
    setCursorToLine(numberOfLine);
    typeTextIntoEditor(HOME.toString());
    action.keyDown(SHIFT).perform();
    typeTextIntoEditor(END.toString());
    action.keyUp(SHIFT).perform();
    typeTextIntoEditor(DELETE.toString());
    loader.waitOnClosed();
}

From source file:org.eclipse.che.selenium.pageobject.CodenvyEditor.java

License:Open Source License

/** Deletes current editor's line. */
public void selectLineAndDelete() {
    Actions action = actionsFactory.createAction(seleniumWebDriver);
    typeTextIntoEditor(HOME.toString());
    action.keyDown(SHIFT).perform();
    typeTextIntoEditor(END.toString());/*from  ww  w. j  a  v  a  2  s .c  o  m*/
    action.keyUp(SHIFT).perform();
    typeTextIntoEditor(DELETE.toString());
}

From source file:org.eclipse.che.selenium.pageobject.FindText.java

License:Open Source License

/** launch the 'Find' main form by keyboard */
public void launchFindFormByKeyboard() {
    loader.waitOnClosed();/*from www . j ava2 s.c  o  m*/
    Actions action = actionsFactory.createAction(seleniumWebDriver);
    action.keyDown(Keys.CONTROL).keyDown(Keys.SHIFT).sendKeys("f").keyUp(Keys.SHIFT).keyUp(Keys.CONTROL)
            .perform();
}

From source file:org.eclipse.che.selenium.pageobject.NavigateToFile.java

License:Open Source License

/** launch the 'Navigate To File' widget by keyboard (with Ctrl + 'n' keys) */
public void launchNavigateToFileByKeyboard() {
    loader.waitOnClosed();/*from   w  w w .j  a va2 s.  c o  m*/
    Actions action = actionsFactory.createAction(seleniumWebDriver);
    action.keyDown(CONTROL).keyDown(ALT).sendKeys("n").keyUp(CONTROL).keyUp(ALT).perform();
}

From source file:org.eclipse.che.selenium.pageobject.ProjectExplorer.java

License:Open Source License

/**
 * Performs the multi-select by {@code Ctrl} key
 *
 * @param path item's path in format: "Test/src/pom.xml".
 */// www  .ja v a2  s. c  o  m
public void selectMultiFilesByCtrlKeys(String path) {
    if (PlatformUtils.isMac()) {
        Actions actions = actionsFactory.createAction(seleniumWebDriver);
        actions.keyDown(COMMAND).perform();
        waitAndSelectItem(path);
        waitItemIsSelected(path);
        actions.keyUp(COMMAND).perform();
    } else {
        Actions actions = actionsFactory.createAction(seleniumWebDriver);
        actions.keyDown(CONTROL).perform();
        waitAndSelectItem(path);
        waitItemIsSelected(path);
        actions.keyUp(CONTROL).perform();
    }
}