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.

How to add useSingleSession in xml file

SPSP Members
edited November -1 in Sahi - Open Source
OS: Windows Xp
Browser: Firefox 8 and 9
Sahi: Sahi3.5

How to add single session in xml file. When i tried to add single session in xml file, I am getting following error.

BUILD FAILED
C:\Documents and Settings\mcfadyen_2\.hudson\jobs\SampleTest3\workspace\build.xml:20: sahi doesn't support the "useSingleSession" attribute.

This is my xml file code
<target name="StartRegressionTest" description="Starting the Execution of Sahi Suite">
<antcall target="startsahi"/>
<sleep seconds="4"/>
<sahi suite="C:/sahi/userdata/scripts/ARC/NewUI/Suites/SC_ExecuteAllScenarios.suite"
browserType="firefox"
baseurl="${urlbase}"
sahihost="localhost"
sahiport="9999"
failureproperty="sahi.failed"
haltonfailure="false"
useSingleSession="true"
threads="1">
<!--<report type="html" logdir="C:/Documents and settings/mcfadyen_2/.hudson/jobs/SampleTest3/workspace/testresult"/>-->
</sahi>

Regards,
SP

Comments

  • Hi SP,

    Could you try using:
    <target name="StartRegressionTest" description="Starting the Execution of Sahi Suite">
    <antcall target="startsahi"/>
    <sleep seconds="4"/>
    <sahi suite="C:/sahi/userdata/scripts/ARC/NewUI/Suites/SC_ExecuteAllScenarios.suite"
                browserType="firefox"
                              baseurl="${urlbase}"
                              sahihost="localhost"
                              sahiport="9999"
                              failureproperty="sahi.failed"
                              haltonfailure="false"
                              useSingleSession="true"
                              threads="1">
                <!--<report type="html" logdir="C:/Documents and settings/mcfadyen_2/.hudson/jobs/SampleTest3/workspace/testresult"/>-->
                </sahi>
    

    Check if this solves your issue.

    Also, check if you are using the latest build.

    Kindly have a look at : http://sahi.co.in/forums/viewtopic.php?id=2798

    Regards
    Sumitra
  • SPSP Members
    Hi Sumitra,

    Actually my question is not how to useSingleSession in testrunner bat. Actually I have written an xml file for executing scripts and invoking using Hudson. For this xml I am not using testrunner.bat. But in this xml I need to specify useSingleSession as true. how i can do that?. This is my xml file


    <?xml version="1.0" encoding="ISO-8859-1"?>
    <project name="invokeArcTest" default="StartRegressionTest">
    <property environment="env"/>
    <property name="sahi.home" value="${env.SAHI_HOME}" location="C:/sahi/" />
    <property name="user.data" value="${env.SAHI_USERDATA_DIR}" location="C:/sahi/userdata" />
    <property name="urlbase" value="http://www.google.co.in/"/>;
    <taskdef name="sahi" classname="net.sf.sahi.ant.RunSahiTask" classpath="${sahi.home}/lib/ant-sahi.jar"/>

    <target name="StartRegressionTest" description="Starting the Execution of Sahi Suite">
    <antcall target="startsahi"/>
    <sleep seconds="4"/>
    <sahi suite="C:/sahi/userdata/scripts/ARC/NewUI/Suites/SC_ExecuteAllScenarios.suite"
    browserType="firefox"
    baseurl="${urlbase}"
    sahihost="localhost"
    sahiport="9999"
    failureproperty="sahi.failed"
    haltonfailure="false"
    threads="1">
    <report type="html" logdir="C:/Documents and Settings/mcfadyen_2/.hudson/jobs/SampleTest3/workspace/testresult"/>
    </sahi>
    <sleep seconds="4"/>
    <antcall target="stopsahi"/>
    <sleep seconds="4"/>
    <antcall target="failsahi"/>
    </target>

    <target name="startsahi" description="Start the Default Proxy for Sahi Server">
    <java classname="net.sf.sahi.Proxy" fork="true" spawn="true" dir="${sahi.home}">
    <classpath location="${sahi.home}/lib/sahi.jar">
    <fileset dir="${sahi.home}/extlib" includes="**/*.jar"/>
    </classpath>
    <arg value="${sahi.home}" id="basePath"/>
    <arg value="${user.data}" id="userdataPath"/>
    </java>
    </target>

    <target name="stopsahi" description="Stop Sahi Server">
    <sahi stop="true" sahihost="localhost" sahiport="9999"/>
    </target>

    <target name="failsahi" if="sahi.failed">
    <fail message="Execution of the Suite failed in Sahi"/>
    </target>

    </project>
  • SPSP Members
    Hi Sumitra,

    Can you please give me an answer for this, since this issue is little bit urgent for me?

    Regards,
    SP
  • Hi SP,

    To run all scripts run sequentially in a single browser session without closing the browser, modify

    usesinglesession="true" to singlesession="true" in your ant Target.

    This might help you.

    Regards,
    Theeran.
  • SPSP Members
    Hi Theeran,

    Thank you very much. The issue is resolved now. Everything works fine

    Regards,
    SP
This discussion has been closed.