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

248
Visualizações
How to skip one click action in between of loop

I am currently running one script where there is a search box and I am entering some keywords in it and searching for the result. All the keywords are coming from excel sheet one by one so I have used "for loop" to achieve this. Now in this loop first time when I search for keyword, in next step, I have to click on one element which I already have written in my script however when loop runs second time, I don't need to click on that element because it is already clicked, now my script is getting failed because in the second time webdriver is not able to click on that element, I have tried with isdisplayed(), isenalbled() function but nothing is working. so what could be the best option to skip one step of click in loop from the second time. I know the last option to achieve this will be try catch but I dont want to use it, please suggest

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

When your button get clicked for first time , use one boolean variable and assign true to it. When second time loop runs and find that boolean variable is true or not and if yes then use "continue;" in your java code.

boolean isClicked = false;
For(int i=0; i<=some_value;i++) {
if(!isCliecked){ 
WebElement.clicked Searchbox.sendkeys("mykeywords") } 
isClicked = true;
}else{
 continue;
 }
over 4 years ago · Santiago Trujillo 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