Cloudflare protection. (TypeError: Cannot find function observe.)
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 45/100
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
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de HtmlUnit/htmlunit
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
Todos los issues de HtmlUnit/htmlunit
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
fossasia/scrum_helper#949 ·
Los mantenedores suelen responder en 2 días
-
Learn Faust tutorial: Blocks step says Faust loads block CSS, but no WordPress styles are appliedAbierto[Type] Bug Needs Triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
TheOdinProject/curriculum#31493 ·
Los mantenedores suelen responder en 1 día
-
[Report] Some official plugins are marked as Stable, but their Readme says they are experimentalAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
TiddlyWiki/TiddlyWiki5#10061 ·
Los mantenedores suelen responder en 1 día
-
documentation ready
Dificultad 1/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día