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.
Trouble reading from a .csv file...
Hello,
I'm trying to script the following:
1. The script is started with testrunner.bat
2. The script reads from .csv file which looks a little bit like so:
(relevant ip)(status)
123.456.7; active
123.456.8; inactive
123.456.9; inactive
... and so on
3. The script loops through the second column (status), looking for the word "active".
4. It does so every 5 minutes until it does NOT find the word "active" anymore.
5. When that happens, it runs another batch via the _execute API to start the real test.
What I have so far is this:
var $baseurl = "http://123.456.789";
var $loginpage = $baseurl + "/rest/of/url.html";
_navigateTo($loginpage);
for($t=0; $t<4; $t++) {
for($i=0; $i<2; $i++) {
var $active = false;
var $lockfile = _readCSVFile("//This/Is/For/Illustration/lockfile.csv");
var $current = $lockfile[" + $i + "][1];
if($current == "inactive") {
$active = false;
}
else {
$active = true;
}
}
if($active == false) {
_execute("C:/Users/Administrator/sahi_pro/userdata/bin/Maintest.bat", true);
}
else {
_wait(300000);
}
}
Second loop is short because for the purpose of this test there are only two machines written into the .csv file
Upon startup IE is opened, but closes again after only 2-3 seconds. I can't tell wether the scan has been done correctly, but the second bat is certainly not run.
Any pointers as to where I'm going wrong with this? csv was made in excel, separators are semicolons ;
I'm trying to script the following:
1. The script is started with testrunner.bat
2. The script reads from .csv file which looks a little bit like so:
(relevant ip)(status)
123.456.7; active
123.456.8; inactive
123.456.9; inactive
... and so on
3. The script loops through the second column (status), looking for the word "active".
4. It does so every 5 minutes until it does NOT find the word "active" anymore.
5. When that happens, it runs another batch via the _execute API to start the real test.
What I have so far is this:
var $baseurl = "http://123.456.789";
var $loginpage = $baseurl + "/rest/of/url.html";
_navigateTo($loginpage);
for($t=0; $t<4; $t++) {
for($i=0; $i<2; $i++) {
var $active = false;
var $lockfile = _readCSVFile("//This/Is/For/Illustration/lockfile.csv");
var $current = $lockfile[" + $i + "][1];
if($current == "inactive") {
$active = false;
}
else {
$active = true;
}
}
if($active == false) {
_execute("C:/Users/Administrator/sahi_pro/userdata/bin/Maintest.bat", true);
}
else {
_wait(300000);
}
}
Second loop is short because for the purpose of this test there are only two machines written into the .csv file
Upon startup IE is opened, but closes again after only 2-3 seconds. I can't tell wether the scan has been done correctly, but the second bat is certainly not run.
Any pointers as to where I'm going wrong with this? csv was made in excel, separators are semicolons ;