Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

499
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda