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 handle dynamic links with sahi
Hi,
I am facing one issue that is when we search for one keyword, then it will list out the number of keyword links in search result.When i spy on links, there is no unique property to identify the link on webpage.
For eg:
link1----SRB_g_17c830c2_a4f1_4e4d_a332_c2fa1e46da59_1_Title
link2----SRB_g_17c830c2_a4f1_4e4d_a332_c2fa1e46da59_2_Title
link3----SRB_g_17c830c2_a4f1_4e4d_a332_c2fa1e46da59_3_Title
How can we handle by using reguler expression.
Please provide the solution to resolve..
Thanking you in advance..
Regards
Raja
I am facing one issue that is when we search for one keyword, then it will list out the number of keyword links in search result.When i spy on links, there is no unique property to identify the link on webpage.
For eg:
link1----SRB_g_17c830c2_a4f1_4e4d_a332_c2fa1e46da59_1_Title
link2----SRB_g_17c830c2_a4f1_4e4d_a332_c2fa1e46da59_2_Title
link3----SRB_g_17c830c2_a4f1_4e4d_a332_c2fa1e46da59_3_Title
How can we handle by using reguler expression.
Please provide the solution to resolve..
Thanking you in advance..
Regards
Raja
This discussion has been closed.
Comments
Try using
SRB_g_17c830c2_a4f1_4e4d_a332_c2fa1e46da59_/.*/_Title
Check if this solves your issue.
Regards
Sumitra
Thanks for reply, Please have a look at the below code.
var $content = _readFile("C:/Users/xxxx/sahi_pro/userdata/scripts/Inputdata.txt");
//_alert($content);
var $lines = new Array();
$lines =$content.split("\n");
for (var $i = 0; $i < $lines.length; $i++){
var $uid = new Array();
$uid = $lines[$i];
//_alert($uid);
_navigateTo("http://www.google.com"
_setValue(_textbox("ctl00\$PlaceHolderSearchArea\$ctl01\$S3031AEBB_InputKeywords"), $uid);
_click(_image("Search"));
var $x=_count("_link","/SRB_g_17c830c2_a4f1_4e4d_a332_c2fa1e46da59_\.*\_Title/");
_alert($x);
for (var $i=1; $i<=$x; $i++) {
var $y = _getText(_link("/SRB_g_17c830c2_a4f1_4e4d_a332_c2fa1e46da59_$i_Title/"));
_alert($y);
//_writeCSVFile($y($i) +"\n","C:/Users/xxx/sahi_pro/userdata/scripts/Inputdata.csv");
}
}
Please reply me..
I tried as you suggested, but its not working
Regards
Raja
Use:
Also, change this:
Regards,
dkulkarni
Thank you so much.. its working now..
Thanks a lot for your wonderful support.............:)
Regards
Rja