private String selectWindow(String seleniumWindowName) {
        if (!proxyInjectionMode) {
          String result;
          try {
            result = doCommand("selectWindow", seleniumWindowName, "");
          } catch (RemoteCommandException rce) {
            result = rce.getMessage();
          }
          return result;
        }
        if (seleniumWindowName == null) {
            seleniumWindowName = DEFAULT_SELENIUM_WINDOW_NAME;
        }        
        if (seleniumWindowName.startsWith("title=")) {
            return selectWindowByRemoteTitle(seleniumWindowName.substring(6));
        }
        // TODO separate name and var into separate functions
        if (seleniumWindowName.startsWith("name=")) {
            seleniumWindowName = seleniumWindowName.substring(5);
            return selectWindowByNameOrVar(seleniumWindowName);
        }
        if (seleniumWindowName.startsWith("var=")) {
            seleniumWindowName = seleniumWindowName.substring(4);
            return selectWindowByNameOrVar(seleniumWindowName);
        }
        // no locator prefix; try the default strategies
        String match = findMatchingFrameAddress(uniqueIdToCommandQueue.keySet(),
                    seleniumWindowName, DEFAULT_LOCAL_FRAME_ADDRESS);
        
        // If we didn't find a match, try finding the frame address by window title
        if (match == null) {
	        return selectWindowByRemoteTitle(seleniumWindowName);
        }
        
        // we found a match
        setCurrentFrameAddress(match);
        return "OK";
    }