#764 alternative fix by TikhomirovSergey · Pull Request #769 · appium/java-client

It is not possible. It will use NATIVE_MOBILE_SPECIFIC as it is defined by default or it will use HTML_OR_DEFAULT when there is no SearchContext which also implements ContextArare or HasSessionDetails. Also it will use HTML_OR_DEFAULT when HasSessionDetails.isBrowser returns true or current context != NATIVE_CONTEXT.

Also there is the method

    /**
     * This method sets required content type for the further searching.
     * @param type required content type {@link ContentType}
     * @return self-reference.
     */
    public By useContent(@Nonnull ContentType type) {
        checkNotNull(type);
        currentContent = type;
        return this;
    }