int i=1;
while (true) {
WebElementdisplay=driver.findElement(By.id("__bar"+i+"-btnGo"));
System.out.println(display);
if (display.isDisplayed()==true)
{
System.out.println("inside if statement"+i);
driver.findElement(By.id("__bar"+i+"-btnGo")).click();
break;
}
else
{
System.out.println("inside else statement"+ i);
i=i+1;
}
}