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); } } String str = new String(new int[] { codePoint }, 0, 1); int[] mapping = textMap.get(str); return mapping; }
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])); } } return false; }
public void pressKey(CharSequence keyToPress) { Keys key = Keys.getKeyFromUnicode(keyToPress.charAt(0)); modifiers.add(key); exec.key(OperaKey.get(key).toScope(), false); }
public void releaseKey(CharSequence keyToRelease) { Keys key = Keys.getKeyFromUnicode(keyToRelease.charAt(0)); modifiers.remove(key); exec.key(OperaKey.get(key).toScope(), true); }
@Override protected void doPerform() { org.openqa.selenium.Keys seleniumKeys = org.openqa.selenium.Keys.getKeyFromUnicode(keys.getKeyCode()); if (isSourceDocumentRoot()) { keyboard().releaseKey(seleniumKeys); } else { getActions().keyUp(getFirstElement(), seleniumKeys).perform(); } } }
@Override protected void doPerform() { org.openqa.selenium.Keys seleniumKeys = org.openqa.selenium.Keys.getKeyFromUnicode(keys.getKeyCode()); if (isSourceDocumentRoot()) { keyboard().pressKey(seleniumKeys); } else { getActions().keyDown(getFirstElement(), seleniumKeys).perform(); } } }