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.
Clicking on a link in the webtable
The following peice of code works fine when i copy to evaluate expression box and test it. But when i have the same code in my scripts its not working. Sahi just stops there. Can any one have any idea why this behaviour is so??
Basically i'm trying to click a link in the webtable whose value i dont know. I just have to click on the first link appearing in the table.
var table = document.getElementById("srchValTbl");
var tr = table.getElementsByTagName("tr");
for (var $i = 0; $i < $tr.length; i++) {
var $td=$tr.getElementsByTagName("td");
var $checkbox=$td[1].getElementsByTagName("a")[0];
_click(_link($checkbox.innerHTML));
}
I tried this code as well
var $Edittable,Edittr,Edittd,Editcheckbox;
_set($Edittable, top.document.getElementById("checkBoxGrp000"));
_set($Edittr, $Edittable.getElementsByTagName("tr"));
_set($Edittd, $Edittr[0].getElementsByTagName("td"));
_set($Editcheckbox, $Edittd[0].getElementsByTagName("a")[0]);
_click(_link($Editcheckbox.innerHTML));
_wait(3000);
Basically i'm trying to click a link in the webtable whose value i dont know. I just have to click on the first link appearing in the table.
var table = document.getElementById("srchValTbl");
var tr = table.getElementsByTagName("tr");
for (var $i = 0; $i < $tr.length; i++) {
var $td=$tr.getElementsByTagName("td");
var $checkbox=$td[1].getElementsByTagName("a")[0];
_click(_link($checkbox.innerHTML));
}
I tried this code as well
var $Edittable,Edittr,Edittd,Editcheckbox;
_set($Edittable, top.document.getElementById("checkBoxGrp000"));
_set($Edittr, $Edittable.getElementsByTagName("tr"));
_set($Edittd, $Edittr[0].getElementsByTagName("td"));
_set($Editcheckbox, $Edittd[0].getElementsByTagName("a")[0]);
_click(_link($Editcheckbox.innerHTML));
_wait(3000);
Comments
for (var $i = 0; $i < $tr.length; i++) {
should be:
for (var $i = 0; $i < $tr.length; $i++) {
But sahi stops at this step <<var table = document.getElementById("srchValTbl"); >> and it will not continue further.
Im using FF3.0 and sahi version sahi_20080627.
When the above step is encountered then an alert is displayed by browser for stopping of script or to continue.
Appreciate any help on this.
Rgds,
Vazid
<browser>
function getFirstLink(){
var table = document.getElementById("srchValTbl");
var tr = table.getElementsByTagName("tr");
for (var i = 0; i < tr.length; i++) {
var td = tr.getElementsByTagName("td");
var checkbox = td[1].getElementsByTagName("a")[0];
return checkbox.innerHTML;
}
}
</browser>
_click(_link(getFirstLink()));