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 do I get the base URL passed to Sahi
How do I get the Base URL passed to Sahi in my scripts ?
Also I have a test suite with the following contents
script1.sah /myApp
script2.sah /myApp2
How do I get the URIs passed in the test suite ( /myApp , myApp2 ) ?
Also I have a test suite with the following contents
script1.sah /myApp
script2.sah /myApp2
How do I get the URIs passed in the test suite ( /myApp , myApp2 ) ?
Tagged:
Comments
_set($url, document.location.href);
Let me know if you are looking for something else.
If suppose my base URL is http://host:port/myApp and it redirects to http://host:port/myApp/index.html or http://host:port/myApp/login.html
_set($url, document.location.href); will return http://host:port/myApp/login.html and not http://host:port/myApp which is what I want.
What I want to do is get baseURL ( http://host:port/myApp ) and then _navigateTo a different URL.
I may also need to check if the content of the resultant page has "$baseURL".
I guess this is something that Sahi will have to provide a function for.
ReferenceError: "_getBaseURL" is not defined.
Please do not open old threads. Please open a new one, explain what you are doing and why you are doing it.
Regards,
Narayan
why i m doing this because i want to store log with baseurl name for my custom log report
./testrunner.sh test.suite http://10.10.10.10 firefox
function _getIpFrombaseUrl()
{
_set($url, document.location.href);
var $str = $url.split('//');
var $str1 = $str[1].split('/');
return $str1[0];
}
$GetBaseURL=_getIpFrombaseUrl()
u can get 10.10.10.10
and you set your log file name with 10.10.10.10.log
it's helpful when if any one run multiple test.suite with different base Url in one system.
you can easily distinguish log file with base Url