module Selenium::WebDriver::Keys

def self.[](key)

def self.[](key)
  return KEYS[key] if KEYS[key]
  raise Error::UnsupportedOperationError, "no such key #{key.inspect}"
end

def self.encode(keys)

def self.encode(keys)
  keys.map { |key| encode_key(key) }
end

def self.encode_key(key)

def self.encode_key(key)
  case key
  when Symbol
    Keys[key]
  when Array
    key = key.map { |e| e.is_a?(Symbol) ? Keys[e] : e }.join
    key << Keys[:null]
    key
  else
    key.to_s
  end
end