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

245
Vistas
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 Respuestas
Responde la pregunta

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 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