Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

135
Vistas
Java Selenium / HtmlunitDriver opens wrong website

I try to open a website by using `driver.get(url):

    driver = new HtmlUnitDriver(BrowserVersion.CHROME);
    driver.setJavascriptEnabled(true);
    driver.setAcceptSslCertificates(true);
    driver.setDownloadImages(true);

    driver.get(<private url>);

However, the URL contains an 'Ö', a german Umlaut. So the driver replaces 'ö' with '%D6'

So it opens a wrong site.

I tried changing to UTF-8 in Eclipse; didn't work.

Also using unicode didn't work.

Does anyone have an idea?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Your case works with 2.27-SNAPSHOT.

indexÖ.html:

<body>Ö</body>

Java code:

    WebDriver driver = new HtmlUnitDriver();
    driver.get("http://localhost:8080/indexÖ.html");
    System.out.println(driver.getPageSource());

Output:

<?xml version="1.0" encoding="ISO-8859-1"?>
<html>
  <head/>
  <body>
    Ã
  </body>
</html>

which is what real Chrome also shows.

As you said, ensure your all workspace is in UTF-8: enter image description here

And if you are using maven:

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda