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.

Trouble getting an automation suite to work

StringyLowStringyLow Members
edited October 2008 in Sahi - Open Source
I'm trying to get a batch of tests to run automatically using the commandline and Firefox but encountering the "Firefox is already running, but is not responding" error.

Here's my script start command:
java -cp "C:\Documents and Settings\tester1\Desktop\sahi\lib\ant-sahi.jar" net.sf.sahi.test.TestRunner "C:/Documents and Settings/tester1/Desktop/sahi/scripts/Canary/Canary.Suite" "C:\Program Files\Mozilla Firefox\firefox.exe" http://test.server.example.com:9891/select/home default localhost 9999 3 "-profile C:\Documents and Settings\tester1\Desktop\sahi\browser\ff\profiles\sahi$threadNo"
Here's my Sahi.bat
SET EXT_CLASS_PATH=..\extlib\mysql-connector-java-5.0.4-bin.jar
SET SAHI_CLASS_PATH=..\lib\sahi.jar;
SET MOZ_NO_REMOTE=1
java -classpath %EXT_CLASS_PATH%;%SAHI_CLASS_PATH% net.sf.sahi.Proxy
Restarting Firefox or the system doesn't eliminate the error. Click "OK" on the dialogs and attempting to run again isn't helping either.

Any ideas?

Comments

  • johnjohn Members
    StringyLow,

    Have you considered using ant to run the test automatically? The sahi distribution comes with an example ant script. It will take the pain out of trying to write a startup script.

    regarding the error - if there are any instances of firefox running on your system the controller will not be able to start one to exectute the script in. Or if there is a stuck firefox process (look for firefox.exe in the task manager) then that will also block firefox starting.

    If that doesn't work, then try switching to IE and see what happens.

    John
  • pankaj.nithpankaj.nith Members
    edited January 2009
    Hi,

    I tried using ant and batch to run sahi suites. Everything works fine except one thing. I am not able to run the proxy through the ant/batch.
    Whenever I try to do so, the proxy takes some seconds to start and in the meanwhile the suite-runner not finding the proxy running fails throwing errors on the console. On the other hand if I run the same suite after manually running the proxy and then running the suite through ant/batch file it runs fine.
    Any suggestions please?

    Regards,
    Pankaj.
    PS: Same happened when i tried the demo suite thats available with sahi.
  • and if i run the proxy first through the ant and then the task to run the suite it never goes to running the suite after invoking proxy. it just keeps their on the proxy and the control never goes to the suite runner.
    This is my suite.xml:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <project name="project" default="all">
        <property file="suite.properties"/>
        <taskdef name="sahi" classname="net.sf.sahi.ant.RunSahiTask"
                 classpath="${sahidir}/lib/ant-sahi.jar"/>
    
        <target name="run-ff-tests" depends="start">
            <sahi suite="${suite}"
                  browser="${ff-exe}"
                  baseurl="http://google.com"
                  sahihost="localhost"
                  sahiport="9999"
                  failureproperty="sahi.failed"
                  haltonfailure="false"
                  browseroption="-profile ${basedir}/browser/ff/profiles/sahi$threadNo"
                  threads="1">
                <report type="html"/>
                <report type="junit" logdir="${junit-log-dir}"/>
            </sahi>
        </target>
    
        <target name="run-ie-tests" depends="start">
            <sahi suite="${suite}"
                  browser="${ie-exe}"
                  baseurl="http://google.com"
                  sahihost="localhost"
                  sahiport="9999"
                  failureproperty="sahi.failed"
                  haltonfailure="false"
                  threads="1">
                <report type="html"/>
                <report type="junit" logdir="${junit-log-dir}"/>
            </sahi>
        </target>
        
        <target name="start" description="starts proxy">
            <java classname="net.sf.sahi.Proxy" fork="true" dir="bin">
            <env key="MOZ_NO_REMOTE" value="1"/>
            <classpath location="lib/sahi.jar">
                <fileset dir="extlib" includes="*.jar"/>
            </classpath>
        </java>
        </target>
    
    </project>
    
    any thoughts?

    Regards,
    Pankaj.
  • pankaj.nithpankaj.nith Members
    edited January 2009
    Hi,
    Could get around the problem with this:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <project name="project" default="run-ff-tests">
        <property file="suite.properties"/>
        <taskdef name="sahi" classname="net.sf.sahi.ant.RunSahiTask"
                 classpath="${sahidir}/lib/ant-sahi.jar"/>
    
    
        <target name="run-ff-tests">
            <parallel>
                <java classname="net.sf.sahi.Proxy" fork="true" dir="bin">
            <env key="MOZ_NO_REMOTE" value="1"/>
                <classpath location="lib/sahi.jar">
                    <fileset dir="extlib" includes="*.jar"/>
                </classpath>
            </java>
         <sequential>
            <sleep seconds="15"/>
            <sahi suite="${suite}"
                  browser="${ff-exe}"
                  baseurl="http://google.co.in"
                  sahihost="localhost"
                  sahiport="9999"
                  failureproperty="sahi.failed"
                  haltonfailure="false"
                  browseroption="-profile ${basedir}/browser/ff/profiles/sahi$threadNo"
                  threads="1">
                <report type="html"/>
                <report type="junit" logdir="${junit-log-dir}"/>
            </sahi>
            </sequential>
            </parallel>    
        </target>
    
    </project>
    
    But one issue i am facing now is that while running the suite i am getting various browser warnings like another instance already running, first close it etc. I think sahi is not able to pick the right profile. It also shows warning for resume from crash.
    Any thoughts on this?

    Regards,
    Pankaj.
  • Hi All,

    I got the solution for my problem. Thanks to Narayan. Heres what he guided:
    ================================================
    We need to have system property MOZ_NO_REMOTE=1 if we want to run
    multiple profiles. This should be set before you start Sahi, in
    sahi.bat or which ever way you start Sahi.

    If you are using an older Sahi:

    I would suggest deleting all profiles in sahi/browser/ff/profiles folder.

    Download a new version of Sahi. There will be a folder called
    sahi/config/ff_profile_template. It just has a prefs.js. You can
    delete your sahi/config/ff_profile_template and copy this folder from
    the latest build. This has the correct preferences. Then restart Sahi.
    Sahi will copy this template 10 times into sahi/browser/ff/profiles to
    create 10 profile folders.

    Try running the suite again. This time accept the alerts if they come,
    once. The next run onwards things should work fine.

    If you still have problems, start firefox with
    sahi/config/ff_profile_template as your profile. You can do this by
    firefox -profile sahi/config/ff_profile_template. When firefox starts,
    modify the preferences you want. The again delete profiles in
    sahi/browser/ff/profiles, and restart Sahi. This will again copy your
    template profile into the profiles folder 10 times. You should then
    have the same profile settings in each of your 10 profiles.
    ============================================
    I followed the steps for older sahi and it worked.

    Thanks Narayan and all the wonderful guys out there!
    Pankaj.
Sign In or Register to comment.