Method: WatirRobot::Parser#parse_key_code

Defined in:
lib/watir_robot/parser.rb

#parse_key_code(key) ⇒ String

(Non-keyword) Parses a key-code argument, provided as an actual character or in ASCII code

Parameters:

  • key (String)

    the key for which to find the java.awt.KeyEvent key-code constant

Returns:

  • (String)

    the constant for the key event



152
153
154
155
156
157
158
159
# File 'lib/watir_robot/parser.rb', line 152

def parse_key_code(key)
  if key[0..5].downcase = 'ascii='
    # return the ASCII code directly
    return key[6..key.length]
  else
    # we assume it's a character and try to map it to a constant
  end
end