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.
Need help on Broken links checking.
Broken links checking.
I have one requirement to automate URL checking (broken link).
I have one web page. This web page will have around 30 links (pagination will be there if there are more results). User can click on these links. When user will click on the link, user will get redirected to the target website means that link is valid other wise Invalid link.we have to log the both results pass/fail into the one file. Following is the example:
1. I will login to the website
2. I will select city from dropdown (selecting City from City Dropdown and/or Industry from Industry Dropdown (for example .NET)
3. I will get search result page. This web page will have listing of jobs/any information with hyperlink.
4. Here I have to check all the links, whether they are valid or not (should not be a broken link), if it is a broken link we should log a details (Pass/Fail).
Right now I am manually checking each and every link whether it is valid or it is a broken link. Since there are 30 links in the web page, I need to click 30 times (there could be thousands of links to check for their validity).
How to automate this process? using SAHI......
I have one requirement to automate URL checking (broken link).
I have one web page. This web page will have around 30 links (pagination will be there if there are more results). User can click on these links. When user will click on the link, user will get redirected to the target website means that link is valid other wise Invalid link.we have to log the both results pass/fail into the one file. Following is the example:
1. I will login to the website
2. I will select city from dropdown (selecting City from City Dropdown and/or Industry from Industry Dropdown (for example .NET)
3. I will get search result page. This web page will have listing of jobs/any information with hyperlink.
4. Here I have to check all the links, whether they are valid or not (should not be a broken link), if it is a broken link we should log a details (Pass/Fail).
Right now I am manually checking each and every link whether it is valid or it is a broken link. Since there are 30 links in the web page, I need to click 30 times (there could be thousands of links to check for their validity).
How to automate this process? using SAHI......
Comments
Can you please tell me the solution.....
Thanks for your support and sorry for the late reply, this is working fine but my requirement is i dont want to check all the links in the page. i need only one section the section will be like below.
Name City Website Address
Website - Link
Website - Link
Website - Link
Website - Link
Website - Link
Is there any pattern that matches all these urls?
There is no any pattern that matches all these urls. but when i am doing object spy below information is displayed in the SAHI window.
_assertExists(_cell(_table(12), 2, 1));
_assertEqual("", _getText(_cell(_table(12), 2, 1)));
_assertContainsText("", _cell(_table(12), 2, 1));
when i am doing object spy for website link under Website Address column the below information is displayed in the SAHI window.
_assertExists(_link("Website"));
_assertExists(_link("Website[1]"));
_assertExists(_link("Website[2]"));
_assertExists(_link("Website[3]"));
_assertExists(_link("Website[4]"));
I'm trying to figure out if a link contains a certain text. I use the getLinks() function you have posted in this thread.
_set($links, getLinks());
var $tif = "blabla";
for (var $j=0; $j<$links.length; $j++)
{
if (_containsText($links[$j].url, $tif))
{
_log($links[$j].url + " contains " + $tif);
}
}
When I am running this script I see in the log:
/index_en.html contains blabla at 20-Oct-2009 16:26:01
This is what I don't understand, obviously the url does not contain the text "blabla"
I have installed Sahi V3 Release 2009-09-22, it happens with IE and Firefox
_containsText only works in the context of the browser (or when called as part of Browser Action APIs)
_containsText actually takes a dom object and a string.
In your case use
instead of
If you are curious to know why it was returning true, _containsText($links[$j].url, $tif) actually resolves to a simple string equal to say "_containsText(\"/index_en.html\", \"blabla\")". To check, try this in your script:
thanks a lot for your help. Now it works as expected !
Above is not working in my machine.
Please help.
Thanks and Regards
Nawaz Ahmed
Kindly create a new thread for your issue.
Could you please tell us what exactly you have done and where you are facing problem. Please be more specific about your issue.
What is the error message you are getting?
Regards
Sumitra
Hi Narayan,
How will i get the links inside a div?
Thanks.