Execute javascript query

hi ,

i am trying to execute a javascript using execute javascript activity but it is not getting executed
the query which i used was

document.getElementsByClassName("example")[0].getElementsByTagName("tbody")[0].getElementsByTagName("tr").length

it is working in console.

what i am trying to do is to find the number of rows present in a web table since it is dynamic i am using javascript for that .kindly help.

Hi,

In case you are using Chrome or Firefox browser, if you need to return a value to be assigned to the output, use return keyword . Also, remember to map the out put variable to get the value

Ex:
return document.getElementsByClassName(“example”)[0].getElementsByTagName(“tbody”)[0].getElementsByTagName(“tr”).length

Regards,
Amit Anand

return #$tablelen#$=document.getElementsByClassName("tabularInfo_1")[1].getElementsByTagName("tbody")[0].getElementsByTagName("tr").length

hi i used the above javascript to find out the number of rows in a web table but its always returning 0.kindly help

Hi,

This is not correct expression

Correct will be:
return document.getElementsByClassName(“tabularInfo_1”)[1].getElementsByTagName(“tbody”)[0].getElementsByTagName(“tr”).length

map tablelen in output argument option

Regards,
Amit Anand