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.
How to test the hyperlink functionality without hard coding
ID Name
123 John
124 Tom
125 Jack
126 Jill
The results will be displayed in a grid like mentioned above. ( with many columns like ID, Name etc..)
In that the ID will be a hyperlink where the user can click the link (.eg.123) and see the details of the person ( john) in a pop-up window.
Right now I have written the following script to test the hyperlink functionality and able to achieve the result by specifying the ID one by one.
_click(_link("123"));
//Assert the ID//
_popup("EditName1")._assertExists(_span("123"));
_popup("EditName1")._assert(_isVisible(_span("123")));
_popup("EditName1")._assertEqual("123", _getText(_span("123")));
_popup("EditName1")._assertContainsText("123", _span("123"));
_popup("EditName1")._closeWindow();
_click(_link("124"));
//Assert the ID//
_popup("EditName1")._assertExists(_span("124"));
_popup("EditName1")._assert(_isVisible(_span("124")));
_popup("EditName1")._assertEqual("124", _getText(_span("124")));
_popup("EditName1")._assertContainsText("124", _span("124"));
_popup("EditName1")._closeWindow();
But I need to recognize the hyperlinks automatically without hard coding like above and execute the above steps.
Could anyone help me in this.
Regards,
Vatsan
123 John
124 Tom
125 Jack
126 Jill
The results will be displayed in a grid like mentioned above. ( with many columns like ID, Name etc..)
In that the ID will be a hyperlink where the user can click the link (.eg.123) and see the details of the person ( john) in a pop-up window.
Right now I have written the following script to test the hyperlink functionality and able to achieve the result by specifying the ID one by one.
_click(_link("123"));
//Assert the ID//
_popup("EditName1")._assertExists(_span("123"));
_popup("EditName1")._assert(_isVisible(_span("123")));
_popup("EditName1")._assertEqual("123", _getText(_span("123")));
_popup("EditName1")._assertContainsText("123", _span("123"));
_popup("EditName1")._closeWindow();
_click(_link("124"));
//Assert the ID//
_popup("EditName1")._assertExists(_span("124"));
_popup("EditName1")._assert(_isVisible(_span("124")));
_popup("EditName1")._assertEqual("124", _getText(_span("124")));
_popup("EditName1")._assertContainsText("124", _span("124"));
_popup("EditName1")._closeWindow();
But I need to recognize the hyperlinks automatically without hard coding like above and execute the above steps.
Could anyone help me in this.
Regards,
Vatsan
Comments
Thanks
With reference to the above grid,the following script would help you to recognize the hyperlinks in a particular column and execute the above steps,
Regards,
Theeran.
Thanks for replying. i have tried your script and got the following error..
_click(_link(_link(0, _in(_cell(_table(0), 1, 0)))));
TypeError: 'undefined' is null or not an object
No trace available
Click for browser script
at assertCheck
Script Used:
function assertCheck($Id){
_click(_link($Id));
_popup("Name")._assertExists(_span($Id));
_popup("Name")._assert(_isVisible(_span($Id)));
_popup("Name")._assertEqual($Id, _getText(_span($Id)));
_popup("Name")._assertContainsText($Id, _span($Id));
_popup("Name")._closeWindow();
}
var $count;
var $table =_table(45);
_set($count, $table.rows.length);
for(var $i=1;$i<=$count;$i++){
var $employeeId=_link(0,_in(_cell(_table(0),$i,0)));
assertCheck($employeeId);
}
Can you please help me.
Thanks!
Try the following script,
This might help you.
Regards,
Theeran.
I have tried the script you have provided and got the following error
ERROR
missing ) after argument list