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.
_assertContainsText() on robots.txt
globalworming
Moderators
Hi guys
that's the problem, I have to make sure a specific string is in the robots.txt for a website. I find no way to access this file with Sahi, does anyone can up with a way to get this text. If not with Sahi, maybe with a shell script?
Regards
Wormi
that's the problem, I have to make sure a specific string is in the robots.txt for a website. I find no way to access this file with Sahi, does anyone can up with a way to get this text. If not with Sahi, maybe with a shell script?
Regards
Wormi
This discussion has been closed.
Comments
You could download robots.txt (Click "Configure" on the dashboard-> download_urls.txt-> add the url in download_urls.txt -> Save-> Restart Sahi).
You can then read the file with the _readFile API.
Would that help?
Regards,
dkulkarni
I added the URL/robots.txt in sahi/config/download_urls.txt and to be sure, in sahi/userdata/config/download_urls.txt as well
Regards Wormi
You will have to use regular expression to add the URL/robots.txt.
Add .*robots[.]txt in Sahi/userdata/config/download_urls.txt.
Regards
Sumitra
Please help
Adding .*robots[.]txt in download_urls.txt will download the file in sahi/userdata/temp/download/
This text file will have a session id attached to it.
To read this file, you can use something like this:
Regards,
dkulkarni
Can you please post the script?
Regards
Sumitra
Instead of adding it to download_urls.txt, just do
var $robotsTxt = _readURL("http://yoururl/robots.txt"
_assertTrue($robotsTxt.indexOf("specificstring") != -1);
Regards,
Narayan
thank you all for your help.