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.

Get folder name of playback logs

lonely_girl01lonely_girl01 Members
edited April 2012 in Sahi - Open Source
Hi,

Anyone has an idea how to get the folder name of the current playback script?
The folder name has a pattern of <script_name>(underscore)<browser_name>(2 underscores)<date>(2 underscores)<time>

Here is my solution:
[list=*]
[*]get the script name by using _scriptName()[/*]
[*]for the date and time, will use date-time jscript functions[/*]
[/list]
My only problem is how to get the browser name which is defined in browser_types.xml

Is there any other solution?


Thanks and regards.

Comments

  • Hi

    evaluate _sahi.getDiagnostics() to get the browser name

    Regards
    Wormi
  • Thanks for the reply globalworming but, it's not what i'm looking for.
    The browser name i'm referring to is the from the <name> in browser_types.xml
    <browserType> 
            <name>firefox9</name> 
            <displayName>FF 9</displayName>
            <icon>firefox.png</icon>
            <path>$ProgramFiles\Mozilla Firefox 9\firefox.exe</path>  
            <options>-profile "$userDir/browser/ff/profiles/sahi$threadNo" -no-remote</options>  
            <processName>firefox.exe</processName> 
            <capacity>5</capacity>  
        </browserType>
    
    because, i think, that's what Sahi uses for concatinating the browser name in the playback folder and also for displaying the browser name in the logs.

    Maybe, there is another solution for getting the full folder name than in what i'm doing??

    Thanks and regards.
  • Hmm.. you possibly could read the XML and parse out the browser type...
    or you could change the sahi source net.sf.sahi.TestRunner and htdocs/spr/concat.js and implement an _getBrowserType API
  • you could change the sahi source net.sf.sahi.TestRunner

    Thanks for the quick reply globalworming.
    Where can i find the sahi source??

    Thanks and regards.
  • You have to download it from sourceforge... where you got your sahi installer, there is the source too. You may wan't to search the forums for "building sahi eclipse" and you may need some Java experience to implement an API.. maybe parsing the XML is faster.

    Regards
    Wormi
  • Thanks globalworming.
    Will check on it.

    Anyways, seems i found the answer to my question but, i still have some problem.
    Returned evaluation on _sahi.browserType is correct but, i somehow can't save the output in a variable.

    Any thoughts how i could save the value in a variable?

    Thanks and regards.
  • you will have to use _set($var, _sahi.getDiagnistics()) i think
  • you will have to use _set($var, _sahi.getDiagnistics()) i think

    Cool. It worked!
    Seems that, _set is not working in evaluate.
    I first tried _set($browserType, _sahi.browserType); and returns an error but when i include in my script, it returns a value.
    Weird.haha

    Anyway, thanks for your help Wormi. :)
Sign In or Register to comment.