private String getCurrentContextHandle(RemoteWebDriver driver) {
   RemoteExecuteMethod executeMethod = new RemoteExecuteMethod(driver);
   String context = (String) executeMethod.execute(DriverCommand.GET_CURRENT_CONTEXT_HANDLE, null);
   return context;
 }
 private List<String> getContextHandles(RemoteWebDriver driver) {
   RemoteExecuteMethod executeMethod = new RemoteExecuteMethod(driver);
   List<String> contexts =
       (List<String>) executeMethod.execute(DriverCommand.GET_CONTEXT_HANDLES, null);
   return contexts;
 }
 private void switchToContext(RemoteWebDriver driver, String context) {
   RemoteExecuteMethod executeMethod = new RemoteExecuteMethod(driver);
   Map<String, String> params = new HashMap<String, String>();
   params.put("name", context);
   executeMethod.execute(DriverCommand.SWITCH_TO_CONTEXT, params);
 }