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

496
Vistas
sendKeys not working in Selenium Webdriver

Having problems with Webdriver in trying to input text into a form. The form has javascript validation that I can't get rid of. It has an error message enabled by default that only gets removed when valid input is detected (for example if you type IRELAND and press TAB or click away).

Tried using the key.TAB from selenium, didn't work. This is the code:

await driver.wait(until.elementLocated(By.className('combi-select__input')), 15000);
const sets = await driver.findElement(By.className('combi-select__input'));

await sets.sendKeys("IRELAND");

Now when I check the html output, the form is empty and I still get the error. I tried click() on it first.

On the other hand this works:

await driver.wait(until.elementLocated(By.className('combi-select__input')), 15000);
const sets = await driver.findElement(By.className('combi-select__input'));
    
await driver.executeScript("arguments[0].setAttribute('value','IRELAND');", sets);

The problem with this is that the javascript validation still keeps the error, so the form can't be submitted.

If anyone can help, that would be amazing.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Try using JavascriptExecutor

JavascriptExecutor jse = ((JavascriptExecutor)driver);          
WebElement email = driver.findElement(By.id("useremail"));

jse.executeScript("arguments[0].value='-----your input----';", email);
about 4 years ago · Juan Pablo Isaza 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