18 January 2026:


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.

Sahi and batch mode - how to run, how to specify user

gligogligo Members
edited March 2011 in Sahi - Open Source
Hello all,
my question is about running suite with batch files. My batch file is:
@ECHO OFF

java -cp d:\sahi\lib\ant-sahi.jar net.sf.sahi.test.TestRunner "D:\Sahi\userdata\scripts\testsuite.suite" "C:\Programme\Mozilla Firefox\firefox.exe" "http://test.com" default localhost 9999 1 firefox.exe
"-profile D:\Sahi\userdata\browser\ff\profiles\sahi$threadNo -no-remote"
The question is, should I set manual proxy to localhost on the FF? Should I run start_sahi.bat file separate?
Because if I dont do that, tests cannot be run...do I miss something?

Second question is - Can I specify in the suite, the user to login with, for example:
# A test suite
TestNewGUI.sah http://test.com <user??>

The function I use to log with a user is:

function Login($mainurl, $userName, $userPwd, $language){
_setValue($fLoginName, $userName);
_setValue($fLoginPwd, $userPwd);
if ($language != "")
_setSelected(_select("p_sLocale"), $language);
_wait(1000);
_click($bLogin);
}
The problem is, if I do the test on different servers with different users..how can I use 1 script and only to specify the current user?

Comments

  • Think about how you can verify, where the script is running. Maybe _sessionInfo() is helping or the browser differentiating APIs _isFF, _isIE and so on. When you find something which seperates the servers, create different .csv files with username and password and construct something as

    if (server1){
    $logindata = _readCSVFile($savepath1);
    } else if (server2) {
    $logindata = _readCSVFile($savepath2);
    }
    $username = $logindata[0][0];
    $password = $logindata[0][1];
  • gligogligo Members
    Thank you for the idea..i could create something..combining browsers, users and languages...
Sign In or Register to comment.