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.
If\esle conditions from external file
Hi,
I need a script that chooses the correct domain for tests before it opens the site. Before my attempt to make universal dmn file it worked gr8 but else\ if now give error: "Error in script: syntax error" on line with "else"
So i have problem with if\esle - i get syntax error on this script:
function domain($site, $link) {
var $link
var $site
if($site == "to");{
$link = "http://qa.+$site+.com/";
}
else
{
$link = "http://+$site+.stable.dev.com/";
}
_navigateTo($link);
}
//Set domain for widgets
function widgets($site, $widgets) {
var $widgets = "widgets."+$site+".az-qa.com/";
_selectDomain($widgets);
}
Included File:
//Scripts that generate e-mail address and choose our testing environment
_include("email.sah")
_include("Domain_bin.sah")
var $dmn = "to"; // Function need to be set depending on our env
domain($dmn);
widgets($dmn);
_setValue(_textbox("registration_first_name"), "Test");
I need a script that chooses the correct domain for tests before it opens the site. Before my attempt to make universal dmn file it worked gr8 but else\ if now give error: "Error in script: syntax error" on line with "else"
So i have problem with if\esle - i get syntax error on this script:
function domain($site, $link) {
var $link
var $site
if($site == "to");{
$link = "http://qa.+$site+.com/";
}
else
{
$link = "http://+$site+.stable.dev.com/";
}
_navigateTo($link);
}
//Set domain for widgets
function widgets($site, $widgets) {
var $widgets = "widgets."+$site+".az-qa.com/";
_selectDomain($widgets);
}
Included File:
//Scripts that generate e-mail address and choose our testing environment
_include("email.sah")
_include("Domain_bin.sah")
var $dmn = "to"; // Function need to be set depending on our env
domain($dmn);
widgets($dmn);
_setValue(_textbox("registration_first_name"), "Test");
Answers
function domain($site, $link) {
var $link
var $site
if($site == "to"){
$link = "http://qa.+$site+.com/";
}
else
{
$link = "http://+$site+.dev.com/";
}
_navigateTo($link);
}
//Set domain for widgets
function widgets($site, $widgets) {
var $widgets = "widgets."+$site+".az-qa.com/";
_selectDomain($widgets);
}
But i get: _navigateTo("http://qa.+$site+.com/"
$link = "http://" +$site+ "." +$env+ ".rnd.com";
Solved