Compilation error when iterating through While loop, compilation error at line no. 10, start of While loop



  • I am getting compilation error when trying to store list size value into an int.

    public class HandleWebTable {

    private static WebDriver driver;
    
    public HandleWebTable(){
        super();
    }
    
    public static void printAllHeaderOfWebTable() {
    
    List<WebElement> allHeaderTable=driver.findElements(By.xpath("//div[@class='panel history-panel panel panel-default']"));
    
    int allHeaderSize=allHeaderTable.size();
    
    ListIterator<WebElement> tr=allHeaderTable.listIterator();
    
    System.out.println("Traverse in forwrd direction");
    
    While(tr.hasNext()) { //getting compilation error here, asking to add ;
    
        System.out.println("index" + tr.nextIndex() + "value" + tr.next());
    }
    

    please help what should be the right approach to get the rows and columns of webtable.



  • While statement should begin with a lowercase w.

    while(tr.hasNext()) { //getting compilation error here, asking to add ;
        System.out.println("index" + tr.nextIndex() + "value" + tr.next());
    }
    


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2