private static MutableCapabilities buildBrowserCapabilities(Client client) {
    MutableCapabilities capabilities = new MutableCapabilities();
    BrowserSpecs specs = client.getBrowserSpecs();
    if (specs.getVersion() != null) {
      capabilities.setCapability(CapabilityType.VERSION, specs.getVersion());
    }
    if (specs.getPlatform() != null) {
      capabilities.setCapability(CapabilityType.PLATFORM_NAME, specs.getPlatform());
    }

//    if (client.getCapability().getGateway().toString() != null && !"none".equalsIgnoreCase(client.getCapability().getGateway().toString())) {
//      capabilities.setCapability("gateway", client.getCapability().getGateway().toString());
//    }

    // Only consider next code block if this is a client.
    switch (specs.getBrowserName()) {
      case "chrome":
        capabilities.setCapability(ChromeOptions.CAPABILITY, setCommonChromeOptions(client.getCapability(), specs));
        break;
      case "firefox":
        capabilities.merge(setCommonFirefoxOptions(client.getCapability(), specs));
        break;
      case "MicrosoftEdge":
        EdgeOptions MicrosoftEdgeOptions = new EdgeOptions();
        capabilities.setCapability("edgeOptions", MicrosoftEdgeOptions);
        capabilities.setCapability("avoidProxy", true);
        break;
      case "safari":
        SafariOptions options = new SafariOptions();
        capabilities.setCapability(SafariOptions.CAPABILITY, options);
        break;
      case "Safari Technology Preview":
        SafariOptions TPoptions = new SafariOptions();
        TPoptions.setCapability(CapabilityType.BROWSER_NAME, specs.getBrowserName());
        TPoptions.setUseTechnologyPreview(true);
        capabilities.setCapability(SafariOptions.CAPABILITY, TPoptions);
        break;
      default:
        capabilities.setCapability(CapabilityType.BROWSER_NAME, specs.getBrowserName());
        break;
    }
    // Add log preference to webdriver
    // TODO put log preference into config file
    LoggingPreferences logPrefs = new LoggingPreferences();
    logPrefs.enable(LogType.BROWSER, Level.ALL);
    capabilities.setCapability(CapabilityType.LOGGING_PREFS, logPrefs);
//    capabilities.setCapability("goog:loggingPrefs", logPrefs);
    // Capabilities for mobile client/app
    if (specs.getPlatform().toString().equalsIgnoreCase("android")
      ||specs.getPlatform().toString().equalsIgnoreCase("ios")) {
      // deviceName:
      // On iOS, this should be one of the valid devices returned by instruments with instruments -s devices.
      // On Android this capability is currently ignored, though it remains required.
      capabilities.setCapability("deviceName", specs.getDeviceName());
      capabilities.setCapability("platformName", specs.getPlatform());
      capabilities.setCapability("platformVersion", specs.getPlatformVersion());
      if (specs.getPlatform().name().equalsIgnoreCase("ios")) {
        capabilities.setCapability("automationName", "XCUITest");
        capabilities.setCapability("autoAcceptAlerts", true);
      } else {
        capabilities.setCapability("autoGrantPermissions", true);
        capabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 300);
      }
      capabilities.setCapability("noReset", true);
    }
    return capabilities;
  }
Build capabilities for client web driver

@param client the Client object
@return capabilities appium driver
KITE-Framework/src/main/java/org/webrtc/kite/WebDriverFactory.java