Error when trying to verify text in a table

Hi, I am seeing the below error on my xpath.

Error: “driver.findElement(By.xpath(”//div[@id=‘a0O3F0000048iUk_00N30000003tWTk_body’]/table/tbody"))
Elapsed time: 22.977s
Table = driver.findElement(By.xpath("//div[@id=‘a0O3F0000048iUk_00N30000003tWTk_body’]/table/tbody")) FAILED.
org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {“method”:“xpath”,“selector”:"//div[@id=‘a0O3F0000048iUk_00N30000003tWTk_body’]/table/tbody"}"

WebDriver driver = DriverFactory.getWebDriver()

//‘Expected value from Table’
String ExpectedValue = “Facets ASO Medical”;

//‘To locate table’
WebElement Table = driver.findElement(By.xpath("//div[@id=‘a0O3F0000048iUk_00N30000003tWTk_body’]/table/tbody"))

//‘To locate rows of table it will Capture all the rows available in the table’
List rows_table = Table.findElements(By.tagName(‘tr’))

//‘To calculate no of rows In table’
int rows_count = rows_table.size()

//‘Loop will execute for all the rows of the table’

for (int row = 0; row < rows_count; row++) {

//‘To locate columns(cells) of that specific row’
List Columns_row = rows_table.get(row).findElements(By.tagName(‘td’))

//‘To calculate no of columns(cells) In that specific row’
int columns_count = Columns_row.size()

println((('Number of cells In Row ’ + row) + ’ are ') + columns_count)

//‘Loop will execute till the last cell of that specific row’
for (int column = 0; column < columns_count; column++) {
//‘It will retrieve text from each cell’
String celltext = Columns_row.get(column).getText()

println((((('Cell Value Of row number ’ + row) + ’ and column number ') + column) + ’ Is ') + celltext)

//‘Checking if Cell text is matching with the expected value’
if (celltext == ExpectedValue) {

//‘Getting the Group Product Record Name if cell text i.e GP Record Type matches with Expected value’
println('Text present in row number 3 is: ’ + Columns_row.get(2).getText())

@aaradhya.keerty Perhaps you may only need to insert a pause to allow the table to form before you search for the elements.

// Expected value from Table
String ExpectedValue = “Facets ASO Medical”;


// To locate table
WebElement Table = driver.findElement(By.xpath("//table/tbody"))

Another thing that I would do is adjust your println statements without all the parentheses:
println('Number of cells In Row ' + row.toString() + ' are ' + columns_count.toString())

println('Cell Value Of row number ' + row.toString() + ' and column number ' + column.toString() + ' is ' + celltext)

@grylion54 The table is already existing on the UI before the code is run. But it is still not able to search the element.

Okay, so the id you have in your code is not the same one as in your image. Do you only have the one table on the page. If so, then change your xpath to the manner that I have in my post above.