-1

enter image description hereI am unable to identify element. please find my below code.

WebElement editorFrame = dr.findElement(By.id("1536219451331-0-uiGrid-000L-cell"));
  • 2
    The id looks like something that is dynamically generated and might be changing for each run. – Dakshinamurthy Karra Sep 8 '18 at 7:11
0

As this looks like a web table please find the below logic. Please use xpath instead of id to locate element.

List<WebElement> rowList = driver.findElements(By.xpath("//tr"));
for(WebElement row : rowList)
{
    List<WebElement> columnList =  driver.findElements(By.xpath("//td"));
    for(WebElement cell : columnList)
    {
        String text = cell.getText();
        System.out.println(text);
    }
}

This is a sample code snippet to iterate a webtable. The first for loop is for iterating the rows and second for loop is for iterating the cells in each row. Hope this will help you understand the logic.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.