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 Run

PriyaPriya Members
edited November -1 in Sahi - Open Source
Hi Narayan,

I am trying to run a suite through command line,

Here is my suite file
UI-SUBM-005(2).sah http://10.11.252.218:8003/richcdm/
UI-SUBM-006(2).sah http://10.11.252.218:8003/richcdm/
UI-SUBM-007(2).sah http://10.11.252.218:8003/richcdm/

and

..\tools\toggle_IE_proxy.exe enable
java -cp ..\lib\ant-sahi.jar net.sf.sahi.test.TestRunner
D:/sahi/scripts/spring/New Folder/my.suite
"C:\Program Files\Internet Explorer\iexplore.exe"
http://10.11.252.218:8003/richcdm/main.jsf default localhost 9999 3
..\tools\toggle_IE_proxy.exe disable


Its opening the Blank page, and shows the following error

'http:' is not recognized as an internal or external command,
operable program or batch file.
C:\Documents and Settings\softsmith>..\tools\toggle_IE_proxy.exe disable
The system cannot find the path specified.


Please tell me where i hav gone wrong.

Comments

  • Hi Priya,

    Keep http://10.11.252.218:8003/richcdm/main.jsf in double quotes like this:
    "http://10.11.252.218:8003/richcdm/main.jsf" in your batch file and try again.
    See if this helps. Revert back in case of any problems :)

    Regards,
    Pankaj.
  • Thanks for the reply pankaj,

    Its giving the syntax error with double quotes -

    The filename, directory name, or volume label syntax is incorrect.
    and the blank page opens up.
  • narayannarayan Administrators
    The space in "New Folder" must be causing the problem. Use
    ..\tools\toggle_IE_proxy.exe enable
    java -cp ..\lib\ant-sahi.jar net.sf.sahi.test.TestRunner
         "D:/sahi/scripts/spring/New Folder/my.suite"
         "C:\Program Files\Internet Explorer\iexplore.exe" 
        http://10.11.252.218:8003/richcdm/main.jsf default localhost 9999 3
    ..\tools\toggle_IE_proxy.exe disable
    
    (I have added double quotes around the suite path.)
    If it is one of the more recent versions of Sahi, you may need to add iexplore.exe after 3.
    ..\tools\toggle_IE_proxy.exe enable
    java -cp ..\lib\ant-sahi.jar net.sf.sahi.test.TestRunner
         "D:/sahi/scripts/spring/New Folder/my.suite"
         "C:\Program Files\Internet Explorer\iexplore.exe" 
        http://10.11.252.218:8003/richcdm/main.jsf default localhost 9999 3 iexplore.exe
    ..\tools\toggle_IE_proxy.exe disable
    
  • Hi Narayan,

    I have changed the folder name, added iexplore.exe after 3,but still the same problem.
    It executes these lines "D:/sahi/scripts/spring/New Folder/my.suite"
    "C:\Program Files\Internet Explorer\iexplore.exe"
    i.e opens the my.suite file and blank IE page and stops

    Are there any further settings required for this
    ie I have done the proxy settings and opened the controller on my application, then executed these lines through command prompt
    Is this correct,wat else need to be done.
  • narayannarayan Administrators
    Priya,

    You may already be doing this, but just clarifying. There should be no line breaks in the java -cp line. The batch file should look like below.

    *Line 1*: ..\tools\toggle_IE_proxy.exe enable
    *Line 2*: java -cp ..\lib\ant-sahi.jar net.sf.sahi.test.TestRunner "D:/sahi/scripts/spring/New Folder/my.suite" "C:\Program Files\Internet Explorer\iexplore.exe" http://10.11.252.218:8003/richcdm/main.jsf default localhost 9999 3
    *Line 3*: ..\tools\toggle_IE_proxy.exe disable
  • Now i am getting this error in line 2

    C:\Documents and Settings\softsmith>D:sahi\tools\toggle_IE_proxy.exe enable

    C:\Documents and Settings\softsmith>java -cp ..\lib\ant-sahi.jar net.sf.sahi.tes
    t.TestRunner "D:/sahi/scripts/spring/NewFolder/my.suite" "C:\Program Files\Int
    ernet Explorer\iexplore.exe" http://10.11.252.218:8003/richcdm/main.jsf default
    localhost 9999 3 iexplore.exe

    Exception in thread "main" java.lang.NoClassDefFoundError: net/sf/sahi/test/Test
    Runner

    C:\Documents and Settings\softsmith>D:\sahi\tools\toggle_IE_proxy.exe disable
  • ensure you have ant-sahi.jar placed in /sahi/lib/ folder
  • Yes pankaj,
    ant-sahi.jar is present in my sahi/lib folder.
  • pankaj.nithpankaj.nith Members
    edited January 2009
    Hi Priya,

    Below is the code from my batch file that runs fine. See if this works for you. this os for older sahi. u can change it to work with new version. i think you will have to add iexplorer.exe at the end as mentioned by Narayan.
    java -cp D:\\sahi\\lib\\ant-sahi.jar net.sf.sahi.test.TestRunner "D:\\sahi\\scripts\\spring\\NewFolder\\my.suite" "C:\\Program Files\\Internet Explorer\\iexplore.exe" "http://10.11.252.218:8003/richcdm/main.jsf" default localhost 9999 1
    
    all should be in a single line without newline character.
    I hope this should help.

    Regards,
    Pankaj.
  • Thanks narayan and pankaj,

    Its working fine now,I think the problem was with '\\' in the path.
    Thanks a lot.
  • yup.. should have figured that out..
    either use '/' or '\\' in file path

    Regards,
    Pankaj.
  • Please let me know, can sahi be used for .net applications & how to run suite? Please explain me in brief....
  • pankaj.nith ,

    I am assuming the "http://<IP_Address>:<Port#>/..."; is supposed to be the Base URL of the app you are trying test.
    Up until now I was able to access the HTTPS site without an IP address or port number. I was able to get the IP address via a ping command but how do I determine the port number?

    Thanks,
    RR
  • Hi Robin,

    Try this:
    Navigate to your application in IE/Firefox.
    Now open command prompt. ping the application url to know its IP.
    Now type command:
    netstat -n
    this will give you the url along with the port number. it will look like this:
    Proto Local Address Foreign Address State
    TCP 127.0.0.1:1036 127.0.0.1:32000 ESTABLISHED

    In this table identify the IP of your application under the "Foreign Address" and the port after the semi-colon(32000 in this case) is your required port number. I hope this will help.

    Regards,
    Pankaj.
  • narayannarayan Administrators
    Ignore the ":<Port>" if you do not need it to access the website. I will indicate that in the docs.
  • Thanks! "netstat -n" worked to get the port, but I still get the Certificate Blocking window.

    Since we know the IP and port, and URL is the same and the window is not modal (meaning I can read the HTML) why can't we place a "_click(_link("overridelink"));" command before the login commands to make it go away?

    RR
Sign In or Register to comment.