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.

batch mode in linux

orbaraorbara Members
edited November -1 in Sahi - Open Source
Hello
I've done a script *.sha, with the suite and bat files. It runs well in windows but I would like to run it in Linux.
The script *.sha manually runs very well but when I run it in batch mode with *.suite and *.sh files it doesn't work

Can I run in mode batch in Linux?

Thanks you for an answer
Best regards

orbara

Comments

  • narayannarayan Administrators
    Orbara,

    Yes you can run it on Linux.
    These could be the possible reasons for it not working.

    1) The shell script is not working because it has windows ctrl-M characters in it: Run dos2unix on that file or manually edit that file and delete and re-add line breaks.

    2) The shell script is working but the browser does not open properly: Check the path of the browser executable in your shell script. (It may be /path/to/firefox-bin. You could look at the properties of the browser shortcut on the desktop)

    3) The browser opens but does not close properly: Open sahi.properties and comment the existing processhelper lines and uncomment those for linux, so that it looks like this:
    #processhelper.pid_list_cmd=tasklist /FI "IMAGENAME eq $imageName" /NH /FO TABLE
    #processhelper.pid_list_pid_column_no=2
    #processhelper.pid_kill_cmd=taskkill /PID $pid
    
    #Use these for linux
    processhelper.pid_list_cmd=ps -ef | grep $imageName
    processhelper.pid_column_no=2
    processhelper.pid_kill_cmd=kill -9 $pid
    

    4) I am not very sure about this, but as a precaution, keep the extension of Sahi files as .sah (Ignore if this was just a typo in your post.)

    If all this does not seem to work for you, post the shell script and the errors that you see on the Sahi console (from where you ran sahi.sh) .

    Regards,
    Narayan
  • orbaraorbara Members
    Hello
    Thanks you for your answer, but every things you say were done , I sent a mail yesterday but I don't know if you have received it. I can't post a reply with the files sh and suite, I've error messages.
    If you have an other idea, or how can I send you the files?
    Thanks in advance
    Regards
    orbara
  • narayannarayan Administrators
    Email it to narayan@sahi.co.in
  • narayannarayan Administrators
    Orbara's comment via email:
    orbara wrote:
    "Thanks a lot for your help !

    The batch mode in Linux works perfectly, putting like you have told me:

    "in linux $threadNo was being replaced with a blank string since its value was undefined. You need to escape that $ with a back slash (\) in your suiterunner.sh file ".
    So the sh file should now look like:
    java -cp ../lib/ant-sahi.jar net.sf.sahi.test.TestRunner ../scripts/my_site.suite
       "/usr/bin/firefox" http://www.myurl.com default localhost 9999 3 
       firefox "-profile ../browser/ff/profiles/sahi\$threadNo -no-remote"
    

    Thanks a lot! - you can close this topic
    Best regards"
This discussion has been closed.