Best way to check that element is not present using Selenium WebDriver with java

后端 未结 9 1993
半阙折子戏
半阙折子戏 2020-12-24 02:33

Im trying the code below but it seems it does not work... Can someone show me the best way to do this?

public void verifyThatCommentDeleted(final String text         


        
9条回答
  •  醉酒成梦
    2020-12-24 03:02

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

提交回复
热议问题