Example usage for org.openqa.selenium Keys LEFT_ALT

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

Introduction

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

Prototype

Keys LEFT_ALT

To view the source code for org.openqa.selenium Keys LEFT_ALT.

Click Source Link

Usage

From source file:org.safs.selenium.webdriver.lib.WDLibrary.java

License:Open Source License

/**
 *
 * @param key Keys, the selenium Keys value
 * @return int the value of java KeyEvent
 * @throws SeleniumPlusException/*from   w w  w .  j a v a  2  s  .c o m*/
 */
static int toJavaKeyCode(Keys key) throws SeleniumPlusException {
    String debugmsg = StringUtils.debugmsg(WDLibrary.class, "toJavaKeyCode");
    if (Keys.SHIFT.equals(key))
        return KeyEvent.VK_SHIFT;
    else if (Keys.LEFT_SHIFT.equals(key))
        return KeyEvent.VK_SHIFT;
    else if (Keys.CONTROL.equals(key))
        return KeyEvent.VK_CONTROL;
    else if (Keys.LEFT_CONTROL.equals(key))
        return KeyEvent.VK_CONTROL;
    else if (Keys.ALT.equals(key))
        return KeyEvent.VK_ALT;
    else if (Keys.LEFT_ALT.equals(key))
        return KeyEvent.VK_ALT;
    else {
        String msg = " No handled key '" + (key == null ? "null" : key.toString()) + "'.";
        IndependantLog.debug(debugmsg + msg);
        throw new SeleniumPlusException(msg);
    }
}