-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
  • Please provide the HTML dom – PDHide Jan 21 '20 at 22:13
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.

0

You could use xPath to find the column using the text from the first column.

So something like this would work:

//tr[td[contains(text(),'Cash Deposit (including online)')]]/td[2]

That will look the cell in the second column, where the first column is equal to the relevant text.

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.