18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
Number of columns in a table
Hi all,
I need code to find number of columns in a table..
Regards,
Selvi.D
I need code to find number of columns in a table..
Regards,
Selvi.D
This discussion has been closed.
Comments
var $columnCount;
_set($columnCount, _table("tableId").rows[0].cells.length);
_assertEqual(5, $columnCount);
or
_assertEqual(5, _table("tableId").rows[0].cells.length);
i tried ur both codes. But sahi wont accept it. Error comes like,
_assertEqual(7, _table("ctl00_cphClientBody_grvDelStatusRpt").rows[0].cells.length); TypeError: '_sahi._table(...).rows' is null or not an object No trace available Click for browser script at PendingRequests (scripts/gmail.sah:15) [10735 ms]
pls fix this issue.
Both scripts specified by Narayan works fine for me. Please ensure that the table is not null.
Can you post the script and error displayed on the Sahi Console.
Regards,
Theeran.
Do u need details. I will post it.
Thnx
"'_sahi._table(...).rows' is null " error will be displayed only when the table is null, that is there is no row in the table.
Since you have mentioned that the table is dynamic, It seems like the id for the table might be wrong. Please try to use the index of the table like table(0). Just hover the table, the sahi controller will identify the table with it index in Alternatives dropdownbox.
You may also use _near, _in, _under APIs to identify the table more specifically.
If you are still not successful, please reply with appropriate details,
Regards,
Theeran.