jeudi 7 décembre 2017

Iterate through a table for selenium testing

I want to go through a table and iterate all the rows of the table and want to check validation for a particular columns data, like which date is past date need to identify.

WebElement tableElement = webDriver.findElement(By.xpath("//[@id='tableID']/tbody/tr"));
    String rowElement = null;

    for(int i = 0; i < 9 ; i ++){
        rowElement = tableElement.findElement(By.xpath("//*[@id='column" + i + "']/td[3]")).getText();
        System.out.println(rowElement.toString());
    }

Error i got ->

org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id='tableID']/tbody/tr"}

Though I double check the table id and it is correct. I am new to selenium testing. Please help to get the data.

Aucun commentaire:

Enregistrer un commentaire