private static ChromeOptions setCommonChromeOptions(Capability capability, BrowserSpecs specs) {
    ChromeOptions chromeOptions = new ChromeOptions();
    if (capability.useFakeMedia()) {
      // We use fake media or mediafile as webcam/microphone
      chromeOptions.addArguments("use-fake-ui-for-media-stream");
      chromeOptions.addArguments("use-fake-device-for-media-stream");
      chromeOptions.addArguments("enable-automation"); // https://stackoverflow.com/a/43840128/1689770
      chromeOptions.addArguments("no-sandbox"); //https://stackoverflow.com/a/50725918/1689770
      chromeOptions.addArguments("disable-infobars"); //https://stackoverflow.com/a/43840128/1689770
      chromeOptions.addArguments("disable-dev-shm-usage"); //https://stackoverflow.com/a/50725918/1689770
      chromeOptions.addArguments("disable-browser-side-navigation"); //https://stackoverflow.com/a/49123152/1689770
      chromeOptions.addArguments("disable-gpu"); //https://stackoverflow.com/questions/51959986/how-to-solve-selenium-chromedriver-timed-out-receiving-message-from-renderer-exc      // If we use mediafile (only if not on android)
      chromeOptions.setPageLoadStrategy(PageLoadStrategy.EAGER);
      if (!specs.getPlatform().equals(Platform.ANDROID)) {
        if (capability.getVideo() != null || capability.getAudio() != null) {
          chromeOptions.addArguments("allow-file-access-from-files");
          if (capability.getVideo() != null) {
            chromeOptions.addArguments("use-file-for-fake-video-capture="
                + fetchMediaPath(capability.getVideo(), specs.getBrowserName()));
          }
          if (capability.getAudio() != null) {
            chromeOptions.addArguments("use-file-for-fake-audio-capture="
                + fetchMediaPath(capability.getAudio(), specs.getBrowserName()));
          }
        }
      } else {
        chromeOptions.setExperimentalOption("w3c", false);
      }
    }

    if (specs.getPlatform().equals(Platform.ANDROID)) {
      return chromeOptions;
    }
    // Create an Hashmap to edit user profile
    Map<String, Object> prefs = new HashMap<String, Object>();
    // Allow access to camera & micro
    // This does not affect fake media options above
    // but still logged the permission in profile, somes sfu require these
    prefs.put("profile.default_content_setting_values.media_stream_camera", 1);
    prefs.put("profile.default_content_setting_values.media_stream_mic", 1);
    chromeOptions.setExperimentalOption("prefs", prefs);



    chromeOptions.addArguments("auto-select-desktop-capture-source=Entire screen");
    if (! "electron".equals(specs.getVersion())) {
      // CHROME ONLY
      String extension = System.getProperty("kite.chrome.extension");
      extension = extension == null ? specs.getExtension() : extension;
      if (extension != null && !extension.isEmpty()) {
        chromeOptions.addExtensions(new File(extension));
      }
    }
    /*
     * if (client.getVersion().toLowerCase().contains("electron")) {
     * chromeOptions.setBinary(client.getBrowserSpecs().getPathToBinary()); }
     */
    if (capability.isHeadless()) {
      chromeOptions.addArguments("headless");
    }
    if (capability.getWindowSize() != null && capability.getWindowSize().trim().length() > 0) {
      chromeOptions.addArguments("window-size=" + capability.getWindowSize());
    }
    for (String flag : capability.getFlags()) {
      chromeOptions.addArguments(flag);
      // Examples:
      /*
       * chromeOptions.addArguments("--disable-gpu");
       * chromeOptions.addArguments("no-sandbox");
       */
    }
    logger.debug("ChromeOptions: " + chromeOptions.toJson());
    return chromeOptions;
  }
Create common chrome option to create chrome web driver

@param capability the Client capability
@param specs the Client browser specs
@return the chrome option
KITE-Framework/src/main/java/org/webrtc/kite/WebDriverFactory.java