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

181
Visualizações
While doing selenium, how to do enter key action, on a search bar which has no search button

I've been trying to test an ecommerce site after I close the initial popup no elements is captured by

bd.findElement(By.xpath("/html/body/div[5]/div[2]/div[1]/div[4]/div[3]/div/span")).click();

So, I have been using

JavascriptExecutor js = (JavascriptExecutor)bd;
js.executeScript("arguments[0].click();", element);

And after a while I got stuck at a place where I have to do the enter key action. I have been trying various keys for this and none of them seems to work. So, I either need a code for using the enter button event on the search bar using JavascriptExecutor or a solution where I can fetch elements using findElement.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

To enter the text within the search field you can use the following solution:

js.executeScript("arguments[0].value = 'valueToEnter';", webelement);
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