code: public static ContentType getCurrentContentType(SearchContext context) {
          return ofNullable(unpackWebDriverFromSearchContext(context)).map(driver -> {
              if (HasSessionDetails.class.isAssignableFrom(driver.getClass())) {
                  HasSessionDetails hasSessionDetails = HasSessionDetails.class.cast(driver);
  
                  if (!hasSessionDetails.isBrowser()) {
                      return NATIVE_MOBILE_SPECIFIC;
                  }
              }
  
              if (ContextAware.class.isAssignableFrom(driver.getClass())) { //it is desktop browser
                  ContextAware contextAware = ContextAware.class.cast(driver);
                  String currentContext = contextAware.getContext();
                  if (containsIgnoreCase(currentContext, NATIVE_APP_PATTERN)) {
                      return NATIVE_MOBILE_SPECIFIC;
                  }
              }
  
              return HTML_OR_DEFAULT;
          }).orElse(HTML_OR_DEFAULT);
      }
docs: Detects content type by the provided search {@code context}.
  
  @param context is an instance of {@link SearchContext}. It may be the instance of
  {@link WebDriver} or {@link org.openqa.selenium.WebElement} or some other
  user's extension/implementation.
  Note: if you want to use your own implementation then it should
  implement {@link ContextAware} or {@link WrapsDriver} or {@link HasSessionDetails}
  @return current content type. It depends on current context. If current context is
  NATIVE_APP it will return {@link ContentType#NATIVE_MOBILE_SPECIFIC}.
  {@link ContentType#HTML_OR_DEFAULT} will be returned if the current context is WEB_VIEW.
  {@link ContentType#HTML_OR_DEFAULT} also will be returned if the given
  {@link SearchContext} instance doesn't implement {@link ContextAware} and {@link WrapsDriver}