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.

Executing all commands in the same browser at different points of time

kashok121kashok121 Members
edited November -1 in Sahi - Open Source
Hi,

We are trying Sahi tool for our web automation requirement. We downloaded install_sahi_v35_20110719.jar (4.0 MB) from sourceforge.net/projects/sahi/files. We are using Windows 7 OS and IE 7, IE 8 as browsers.

Issue:

We want to execute all the commands on a single browser at different points of time from command prompt.

Detailed explanation:

We are using "testrunner.bat sample.sah google.com ie" to execute the commands in sample.sah. Eg: click on "Images" hyperlink in google browser.

We have another script sample1.sah which will click on "Gmail" hyperlink in the google browser.

But when we execute sample.sah, commands get executed and the browser is closed. Hence when we execute sample1.sah, commands are getting executed on another browser.

We understand we can use .suite file to execute sample.sah and sample1.sah at once. However the problem here again is, after completion of .suite file execution, the browser is closed. Hence if we want to execute another set of commands it opens up another browser.

Basically we are looking for all the commands to be executed in the same browser all the time, as long as the browser is open.

Please help us with some pointers.

Comments

  • narayannarayan Administrators
    Hi,

    Please open
    sahi/userdata/bin/testrunner.bat
    and change
    SET SINGLE_SESSION=false
    to
    SET SINGLE_SESSION=true

    Regards,
    Narayan
  • Thanks for your reply.

    I am not able to find any SET SINGLE_SESSION=false parameter in Sahi testrunner.bat.

    I downloaded SahiPro trial version and in testrunner.bat I edited the above parameter to SET SINGLE_SESSION=true. So is this parameter available only in SahiPro and not in Sahi?

    However after the execution of commands in the .suite file, the browser gets closed. If I want to execute another command, it opens up a new browser. Please suggest.
  • Could someone please help me in my previous query?
  • narayannarayan Administrators
    kashok,

    If your suite has sample1.sah and sample2.sah, and you have SET SINGLE_SESSION=true, then Sahi will open a browser, run sample1.sah, sample2.sah and then close it. That is the expected behaviour. Are you seeing anything else?

    Regards,
    Narayan
  • Thanks for your reply.

    I understand closing the browser after the execution of suite file is the expected behaviour.

    We basically want to execute some commands (each specified in some .sah files) on the same browser. I will be executing my .sah files independently. We are just looking for some options/workaround if available for this scenario.
  • narayannarayan Administrators
    If you are going to do it manually, I would suggest you run it from the Controller. (Assuming that you already understand _include, creating functions etc. and are choosing not to use them to your advantage.)
  • I am sorry I could nt get your suggestion completely. Could you please give me some pointers/example which helps me executing 2 .sah files independently on the same browser?
  • Hi Kashok121,

    If you have script1.sah and script2.sah then you can run both these scripts on a single browser from the controller.

    You will have to include script2.sah in script1.sah use _include() API. ie, _include("script2.sah").

    Usage of _include() API :

    http://sahi.co.in/w/sahi-scripting-basics

    Now Start Sahi--> Open a browser from Dashboard--> Alt+Double Click on the browser to get the controller-->Click on Playback--> Enter the file name(script1.sah)--> Set the URL--> Click on Play.

    Let me know if you face any problem.

    Regards
    Sumitra
Sign In or Register to comment.