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.

"Firefox is already opened" error

vivek_gondivivek_gondi Members
edited November -1 in Sahi - Open Source
We use Sahi/Junit to run the automation suite.
All tests are written in Java

Can we run parallel tests, Sahi should be able to open more browsers and perform tests simultaneously.
Although the capacity is 5 in my case (browser_types.xml), opening another browser session gives an error "Firefox is already open..."
Is this supported in Sahi Pro?
It will help us in choosing this tool.

rgds,
vivek

Comments

  • Hi vivek_gondi,

    There are 3 reasons for getting "Firefox is already open.."

    1)The firefox browser must have not been closed properly.

    2)Profiles are been created for each instance of firefox browser once Sahi is started. Therefor, there is a possibility that the profile is not closed.

    3)In browser_types.xml if the processName is identified wrongly then we need to kill the browser by using task Manager.

    Regards
    Sumitra
  • Hello

    I understand what you say.
    My situation is like this: I run a suite with sahi/junit.
    Now is it not possible to run the same suite by another user in parallel.

    I thought the tool should spawn a new thread for each user to allow parallel execution.
    So how are the profiles created? It is browser/ff/profile 1 etc..

    My browser.xml is like this:
    <browserType>
    <name>firefox</name>
    <displayName>firefox</displayName>
    <icon>firefox.png</icon>
    <path>/usr/local/firefox/bin/firefox</path>
    <options>-profile "$userDir/browser/ff/profiles/sahi$threadNo" -no-remote</options>
    <processName>firefox</processName>
    <capacity>5</capacity>
    </browserType>

    Can I know which thread is being executed in some logs.
    I don't see the logs in the specified folder as well.

    In another forum in your site , I saw that parallel executin of test cases by Junit is not yet supported
    Help appreciated.
    rgds,
    Vivek
  • Hi vivek,

    Using Junit you can run the scripts sequentially if you want to run the scripts parallely then you can make use of TestNG.

    You can run the scripts parallely using following ways:

    1)Using TestNG with Marven plugin.

    Ref: http://java.dzone.com/articles/running-junit-tests-parallel

    2)Using TestNG with Parallel-junitsource code

    Ref: http://java.net/projects/parallel-junit/sources

    Also,If you want to run a suite file parallely using Sahi you can use testrunner.bat and ant.

    For example:If you have 2 .sah files in the suite file then you can run them using testrunner.bat.

    Check here for more details to work with testrunner.bat and ant:

    http://sahi.co.in/w/Running+multiple+tests+in+batch+mode

    In case of Firefox, $threadNo in browser options tells Sahi about the specific profile to use during the parallel playback. So $threadNo might not be picked correctly during parallel playback.

    It needs little programming logic to pass $threadNo correctly.

    Also, We are working on writing a wrapper around TestNG to run tests parallely without any browser issues using Sahi.


    Regards
    Sumitra
  • Hello

    I tried using the ant task to execute the java tests using net.sf.sahi.ant.RunSahiTask.
    How do I specify the path to all my files? For eg: I have 10 packages with 5 tests in each.
    I gave path to package, no luck, gave path to file, to luck.

    For eg:

    <target name="runbrowsertests">
    <sahi suite="path to package/file" browserType="firefox" baseurl="http://xxx.yyy.com";
    sahihost="localhost" sahiport="9999" failureproperty="sahi.failed" haltonfailure="false" threads="3" >
    </sahi>

    When I run the above target, each line in file is treated as a "script" by sahi which is wrong
    And the script is killed automatically by sahi.
    Actually I am running java code but Sahi treats it as script!!

    Can you help?

    My intention is to invoke the target which will internally run a suite (java code).
    Atleast 5 people should be able to run the suite simultaneously.

    rgds,
    Vivek
  • Hi vivek,

    You can use ant to run the suite file which contains the sahi scripts and not the java code.

    If you want to run the scripts parallely then you can use TestNG.

    We are working on writing a wrapper around TestNG to run tests parallely without any browser issues using Sahi.

    Regards
    Sumitra
  • i got this error on firefox 8.0...

    i am using Sahi Pro 4 Trial..



    "Server not found
    Firefox can't find the server at sahi.example.com."


    but theres no problem on other browsers..
  • Hi benjo143,

    Can you set proxy manually to FF and check if it works fine.

    Have a look at: http://sahi.co.in/w/configure-browser-proxy

    Also, post the contents of <browser_types.xml> by navigating to <sahi-home>/userdata/config/browser_types.xml

    Regards
    Sumitra
  • still "Server not found"
    yesterday i don't have this problem,, but when i restart my laptop, this problem showed



    this is browser_types.xml:



    <browserTypes>
    <browserType>
    <name>firefox</name>
    <displayName>Firefox</displayName>
    <icon>firefox.png</icon>
    <path>$ProgramFiles\Mozilla Firefox\firefox.exe</path>
    <options>-profile "$userDir/browser/ff/profiles/sahi$threadNo" -no-remote</options>
    <processName>firefox.exe</processName>
    <capacity>5</capacity>
    </browserType>

    <browserType>
    <name>firefox4</name>
    <displayName>Firefox 4</displayName>
    <icon>firefox.png</icon>
    <path>$ProgramFiles\Mozilla Firefox 4.0 Beta 7\firefox.exe</path>
    <options>-profile "$userDir/browser/ff/profiles/sahi$threadNo" -no-remote</options>
    <processName>firefox.exe</processName>
    <capacity>5</capacity>
    </browserType>

    <browserType>
    <name>ie</name>
    <displayName>IE</displayName>
    <icon>ie.png</icon>
    <path>$ProgramFiles\Internet Explorer\iexplore.exe</path>
    <options>-noframemerging</options>
    <processName>iexplore.exe</processName>
    <useSystemProxy>true</useSystemProxy>
    <capacity>5</capacity>
    </browserType>

    <!--
    <browserType>
    <name>ie</name>
    <displayName>IE 7</displayName>
    <icon>ie.png</icon>
    <path>$ProgramFiles\Internet Explorer\iexplore.exe</path>
    <options></options>
    <processName>iexplore.exe</processName>
    <useSystemProxy>true</useSystemProxy>
    <capacity>5</capacity>
    </browserType>
    -->

    <!--
    <browserType>
    <name>ie</name>
    <displayName>IE 6</displayName>
    <icon>ie.png</icon>
    <path>$ProgramFiles\Internet Explorer\iexplore.exe</path>
    <options></options>
    <processName>iexplore.exe</processName>
    <useSystemProxy>true</useSystemProxy>
    <capacity>5</capacity>
    </browserType>
    -->

    <browserType>
    <name>chrome</name>
    <displayName>Chrome</displayName>
    <icon>chrome.png</icon>
    <path>$LOCALAPPDATA\Google\Chrome\Application\chrome.exe</path>
    <options>--user-data-dir=$userDir\browser\chrome\profiles\sahi$threadNo --proxy-server=localhost:9999 --disable-popup-blocking</options>
    <processName>chrome.exe</processName>
    <capacity>5</capacity>
    </browserType>

    <browserType>
    <name>safari</name>
    <displayName>Safari</displayName>
    <icon>safari.png</icon>
    <path>$ProgramFiles\Safari\Safari.exe</path>
    <options> </options>
    <processName>safari.exe</processName>
    <useSystemProxy>true</useSystemProxy>
    <capacity>1</capacity>
    </browserType>

    <browserType>
    <name>opera</name>
    <displayName>Opera</displayName>
    <icon>opera.png</icon>
    <path>$ProgramFiles\Opera\opera.exe</path>
    <options> </options>
    <processName>opera.exe</processName>
    <useSystemProxy>true</useSystemProxy>
    <capacity>1</capacity>
    </browserType>

    <browserType>
    <name>phantomjs</name>
    <displayName>Safari</displayName>
    <icon>safari.png</icon>
    <path>$sahiDir\ext\phantomjs\sahi.bat</path>
    <options>--proxy=localhost:9999 $sahiDir\ext\phantomjs\sahi.js</options>
    <processName>phantomjs.exe</processName>
    <capacity>100</capacity>
    <force>true</force>
    </browserType>

    </browserTypes>
  • Hi benjo143,

    Did you tyr setting the proxy manually to FF and check if it works fine.

    Have a look at: http://sahi.co.in/w/configure-browser-proxy

    Regards
    Sumitra
  • last time i've tried it, it makes no effect....

    but this time, it works... tnx...
This discussion has been closed.