public static WebDriver createWebDriver(Client client, String testName, String id, String... kiteServerGridId)
          throws MalformedURLException, WebDriverException, KiteTestException {
    String urlStr = client.getPaas().getUrl();
    logger.debug("createWebDriver on " + urlStr + " for " + client);
    Capability capability = client.getCapability();
    URL url = new URL(urlStr);
    if (!client.isApp()) {
      RemoteWebDriver webDriver = new RemoteWebDriver(url, WebDriverFactory.createCapabilities(client, testName, id));
      if (client.getBrowserSpecs().getBrowserName().equalsIgnoreCase("firefox")) {
        if (capability.useFakeMedia()) {
          if (capability.getVideo() != null || capability.getAudio() != null) {
            String nodePublicIp = new URL(TestUtils.getNode(urlStr, webDriver.getSessionId().toString())).getHost();
            String gridId = kiteServerGridId.length > 0 ? kiteServerGridId[0] : "null";
            String command = writeCommand(capability, client.getBrowserSpecs());
            String uri = "/command?id=" + gridId + "&ip=" + nodePublicIp + "&cmd=" + command;
            logger.debug("kiteServerCommand response:\r\n" + TestUtils.kiteServerCommand(kiteServerUrl, uri));
          }
        }
      }
      return webDriver;
    } else {
      if (client.getBrowserSpecs().getPlatform().name().equalsIgnoreCase("android")) {
        return new AndroidDriver<>(url, WebDriverFactory.createCapabilities(client, testName, id));
      } else if (client.getBrowserSpecs().getPlatform().name().equalsIgnoreCase("ios")) {
        return new IOSDriver<>(url, WebDriverFactory.createCapabilities(client, testName, id));
      } else if(client.getBrowserSpecs().getPlatform().name().equalsIgnoreCase("windows")){
        return new WindowsDriver<>(url, WebDriverFactory.createCapabilities(client, testName, id));
      } else {
        return new RemoteWebDriver(url, WebDriverFactory.createCapabilities(client, testName, id));
      }
    }
  }
Creates a web driver based on the given Client object.

@param client           Client
@param testName         the test name
@param id               an ID to identify the WebDriver
@param kiteServerGridId an ID to identify the WebDriver
@return WebDriver web driver
@throws MalformedURLException if no protocol is specified in the remoteAddress of the client,
                              or an unknown protocol is found, or spec is null.
@throws WebDriverException    the web driver exception
KITE-Framework/src/main/java/org/webrtc/kite/WebDriverFactory.java