Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Cloudflare protection. (TypeError: Cannot find function observe.)

Abierto
#1,136 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
45/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
java
Área
backend, web-dev

Línea de trabajo

Start by examining the attached log.txt and cloudflare.xml alongside the reported HtmlUnit 5.1.0 setup and the Cloudflare response from the example URL. The issue does not name source files or tests, so first trace how HtmlUnit handles the reported JavaScript error, TypeError: Cannot find function observe. Done means identifying whether this is an HtmlUnit issue and, if so, reproducing and fixing it with a regression test.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Hello, I'm trying to download a jar file from the website www.spigotmc.org , but I'm having trouble getting through Cloudflare's protection

My code:

import org.htmlunit.CookieManager;
import org.htmlunit.NicelyResynchronizingAjaxController;
import org.htmlunit.WebClient;
import org.htmlunit.html.HtmlPage;
import org.junit.jupiter.api.Test;

public class NetworksUtilTest
{
    private static final WebClient webClient = new WebClient();

    @Test
    void htmlUnitTest() throws Exception
    {
        webClient.addRequestHeader("Connection", "keep-alive");
        webClient.addRequestHeader("Upgrade-Insecure-Requests", "1");
        webClient.addRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36");
        webClient.addRequestHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8");
        webClient.addRequestHeader("Accept-Language", "en-US,en;q=0.9");
        webClient.addRequestHeader("Accept-Encoding", "gzip, deflate");

        webClient.getOptions().setThrowExceptionOnFailingStatusCode(false);
        webClient.getOptions().setThrowExceptionOnScriptError(false);
        webClient.getOptions().setFetchPolyfillEnabled(true);
        webClient.getOptions().setPopupBlockerEnabled(true);
	    webClient.getOptions().setGeolocationEnabled(false);
        webClient.getOptions().setJavaScriptEnabled(true);
        webClient.getOptions().setDoNotTrackEnabled(true);
        webClient.getOptions().setRedirectEnabled(true);
        webClient.getOptions().setDownloadImages(false);
        webClient.getOptions().setUseInsecureSSL(true);
        webClient.getOptions().setScreenHeight(768);
        webClient.getOptions().setScreenWidth(1366);
        webClient.getOptions().setCssEnabled(false);
	    webClient.getOptions().setTimeout(5000);

        CookieManager cookieManager = new CookieManager();
        webClient.setCookieManager(cookieManager);

        webClient.setAjaxController(new NicelyResynchronizingAjaxController());
        webClient.setAlertHandler((page, message) -> System.err.println("[alert] " + message)); // to be changed
        webClient.setJavaScriptTimeout(5000);
        webClient.getCookieManager().setCookiesEnabled(true);
        webClient.getCache().setMaxSize(1);

        HtmlPage htmlCloudflarePage = webClient.getPage("https://www.spigotmc.org/resources/vault.34315/download?version=344916");
        webClient.waitForBackgroundJavaScript(5_000);
        System.out.println(htmlCloudflarePage.getWebResponse().getResponseHeaderValue("Content-Type"));

        webClient.close();
    }
}

logs: log.txt

Gradle Version: gradle-9.5.1
HtmlUnit Version: 5.1.0

Update (10.08.2026)

XML Response: cloudflare.xml

Lenguaje dominante
JavaScript
Estrellas
952
Forks
183
Merge medio
2 d 1 h
PR fusionados (30 d)
1

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de HtmlUnit/htmlunit

Todos los issues de HtmlUnit/htmlunit

Issues similares

Más issues de JavaScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.