Ask a Question

Unable to access HTML Table rows and cells in Test Script

SOLVED
mgurch56
New Contributor

Unable to access HTML Table rows and cells in Test Script

Hi,

 

I am writing a TestComplete script (in JavaScript) to verify that the rows and cols in a HTML table on a page contain the right values.

 

What I've done so far is something like this:

 

let test_table = page.NativeWebObject.Find(<"the table's html info">);

 

if(test_table.Exists)

{

   Log.Message(test_table.rows.length);

   Log.Message(test_table.rows[0]);

}

 

My code makes it to the if statement, and logs the amount of rows, but when it tries to log the first row it says it is undefined.

 

Same thing happens if I try something like test_table.rows[0].innerHTML or test_table.rows[0].cells[0].innerHTML.

 

Does anybody know how to access the rows and cells data in a given HTML table?

 

Thanks,

 

Mike

2 REPLIES 2
Marsha_R
Community Hero

Here's rows and cells:

https://support.smartbear.com/testcomplete/docs/app-testing/web/general/examples/parsing-html-tables...

 

 


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame

Thank you!

 

Looks like I was using the wrong syntax, silly me! 😅

cancel
Showing results for 
Search instead for 
Did you mean: