I am unable to identify element of edit text in table



  • 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"));
    


  • 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.



Suggested Topics

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