Example usage for org.openqa.selenium Keys getKeyFromUnicode

List of usage examples for org.openqa.selenium Keys getKeyFromUnicode

Introduction

In this page you can find the example usage for org.openqa.selenium Keys getKeyFromUnicode.

Prototype

public static Keys getKeyFromUnicode(char key) 

Source Link

Document

Get the special key representation, Keys , of the supplied character if there is one.

Usage

From source file:com.cognifide.qa.bb.actions.SendKeysByOneActionsInterceptor.java

License:Apache License

private boolean isKeysChord(final char character) {
    return null != Keys.getKeyFromUnicode(character);
}

From source file:com.machinepublishers.jbrowserdriver.Robot.java

License:Apache License

private static int[] convertKey(int codePoint) {
    char[] chars = Character.toChars(codePoint);
    if (chars.length == 1) {
        Keys key = Keys.getKeyFromUnicode(chars[0]);
        if (key != null) {
            return keysMap.get(key);
        }//from   w  w  w.  jav a  2s .  c o m
    }
    String str = new String(new int[] { codePoint }, 0, 1);
    int[] mapping = textMap.get(str);
    return mapping;
}

From source file:com.machinepublishers.jbrowserdriver.Robot.java

License:Apache License

private static boolean isChord(CharSequence charSequence) {
    int[] codePoints = charSequence.codePoints().toArray();
    if (codePoints.length > 0) {
        char[] chars = Character.toChars(codePoints[codePoints.length - 1]);
        if (chars.length == 1) {
            return Keys.NULL.equals(Keys.getKeyFromUnicode(chars[0]));
        }//w  ww.j a v a2  s  . c  om
    }
    return false;
}

From source file:com.thoughtworks.selenium.webdriven.commands.KeyDownNative.java

License:Apache License

@Override
protected Void handleSeleneseCommand(WebDriver driver, String keyCode, String ignored) {
    char[] chars = Character.toChars(Integer.parseInt(keyCode));
    new Actions(driver).keyDown(Keys.getKeyFromUnicode(chars[0])).perform();
    return null;/* w  w  w.ja  v  a 2 s .co  m*/
}

From source file:com.thoughtworks.selenium.webdriven.commands.KeyUpNative.java

License:Apache License

@Override
protected Void handleSeleneseCommand(WebDriver driver, String keyCode, String ignored) {
    char[] chars = Character.toChars(Integer.parseInt(keyCode));
    new Actions(driver).keyUp(Keys.getKeyFromUnicode(chars[0])).perform();
    return null;//from  ww w.j  ava 2  s  .  c om
}

From source file:de.learnlib.alex.data.entities.actions.web.PressKeyAction.java

License:Apache License

@Override
protected ExecuteResult execute(WebSiteConnector connector) {
    final String unescapedKey = StringEscapeUtils.unescapeJava(this.key);
    final Keys keyToPress = Keys.getKeyFromUnicode(unescapedKey.toCharArray()[0]);

    final WebElementLocator nodeWithVariables = new WebElementLocator(insertVariableValues(node.getSelector()),
            node.getType());/*w  w w. ja  va2 s . c om*/

    try {
        final WebElement element = connector.getElement(nodeWithVariables);
        element.sendKeys(keyToPress);
        LOGGER.info(LoggerMarkers.LEARNER, "Pressed the key '{}' on the element '{}'.", keyToPress.toString(),
                nodeWithVariables);
        return getSuccessOutput();
    } catch (Exception e) {
        LOGGER.info(LoggerMarkers.LEARNER, "Could not press key '{}' on element '{}'.", keyToPress.toString(),
                nodeWithVariables, e);
        return getFailedOutput();
    }
}

From source file:org.eclipse.che.selenium.assistant.KeyBindingsTest.java

License:Open Source License

@Test
public void enterKeyCombinationTest() throws Exception {
    projectExplorer.waitItem(PROJECT_NAME);
    projectExplorer.openItemByPath(PROJECT_NAME);
    notificationsPopupPanel.waitProgressPopupPanelClose();
    loader.waitOnClosed();/*from w w  w  .j ava2 s.co  m*/
    keyBindings.enterKeyCombination(Keys.CONTROL, Keys.ALT, Keys.getKeyFromUnicode('n'));
    navigateToFile.waitFormToOpen();
    navigateToFile.closeNavigateToFileForm();
    keyBindings.enterKeyCombination(Keys.ALT, Keys.F12);
    terminal.waitTerminalTab();
    WaitUtils.sleepQuietly(1);
    consoles.closeTerminalIntoConsoles();
    consoles.closeProcessesArea();
}