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.

dealing with audio

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

How can I Test slide show with mp3 speech...??
I have slides which contains images and speech to understand those images but while testing by sahi , audio content cant be loaded.....audio is in mp3 format..I added the content type of mp3 in download_contenttype.txt
but still not getting solution for that..

How can I deal with audio in sahi?


Regards
shrey

Comments

  • Hello Shrey,

    I don't see any problem with the audio being loaded via Sahi. You don't have to add anything to download_contenttypes.txt unless you want to download the mp3s

    Is it possible for you to point me to the URL?


    Regards,
    dkulkarni
  • Hello _dkulkarni ,

    yeah I am giving you the login Id and password for checking it.

    go to website: www.ipintentio.com
    click on login: provide email as xxxxx@gmail.com and Password is : xxxxxx
    then click on "PLAN" in left side top corner..
    then click on "Project" in left side bottom corner..
    now click on "Video" link under "Digital Circuits Revisited"..
    then on video panel will be opened....
    now click on play button , mp3 speech to understand the concept, will run..

    but while testing through Sahi that mp3 cant be loaded..
    I tried a lot for finding out the problem but still facing problem in it..

    Thank you for helping..

    regards,
    shrey
  • narayannarayan Administrators
    On the Sahi console, do you see any message like: "downloaded file to" etc.?
  • Hello narayana,

    no..
    there is no message being displayed on sahi console like "download file to"...

    I checked by enabling traffic log...the mp3 speech file is there in log ..and showing content file as text/plan instead of audio/mpeg as per MIME content type standard...


    thank for helping...
  • narayannarayan Administrators
    Hi Shrey,

    Try this:

    1) Go to Sahi Dashboard -> Configure -> exclude_inject.txt
    2) Add

    .*[.]mp3

    at the end of the list

    3) Restart Sahi Pro and check if your audio files can be heard.

    Explanation: Since the mimetype is text/plain Sahi may be injecting its javascript into it. This causes the mp3 file to get corrupted. So force Sahi to exclude injection for mp3 files.

    Regards,
    Narayan
  • Hi narayana,

    Thanks for helping ,

    but sir, still I am facing problem in that.I followed whatever you have instructed me in last response..but still issue is not solved.....

    I am showing the response.header_unmodified file here..
    Date: Mon, 05 Sep 2011 08:54:01 GMT
    Server: Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/0.9.8e-fips-rhel5 DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
    X-Powered-By: PHP/5.2.13
    Expires: Mon, 20 Dec 1977 00:00:00 GMT
    Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
    Pragma: no-cache
    Content-Encoding: gzip
    Vary: Accept-Encoding
    Last-Modified: Mon, 05 Sep 2011 08:54:01 GMT
    Keep-Alive: timeout=5, max=100
    Connection: Keep-Alive
    Transfer-Encoding: chunked
    Content-Type: text/plain;charset=utf-8
    Content-Length: 16624


    Regards,
    shrey
  • Hi shrey,

    You can use the following script:
    _navigateTo("http://www.ipintentio.com");
    _click(_span("Login"));
    _setValue(_textbox("login_email"),"xxxxxxx@gmail.com ");
    _setValue(_password("login_pass"),"xxxxx");
    _click(_button(0));
    _click(_div("PLAN"));
    _click(_div("Project"));
    _click(_link("Video"));
    _wait(10000);
    _click(_link("Synchronous Circuits"));
    _wait(10000);
    _click(_image("playa.png"));
    

    Basically you need to include a wait statement as it takes some time to buffer the audio.

    Let me know if this solves your issue.

    Regards
    Sumitra
  • shreyshrey Members
    edited September 2011
    Hi sumitra,

    Thanks for helping..
    Actually I want test for autoplay button . There is a button on that web page which is for autoplay of all slides..I want to test that , after completing the speech of the current slide it should go to the next slide and so on..

    but without playing mp3 speech It will not run properly and and shows error message..
  • Hi Shrey,

    Its not possible to record an audio using Sahi.

    You can however, listen to the audio manually and verify the functionality. You just need to add a wait statement while the audio is being played. This way, Sahi will stop execution for the duration while you listen to the audio.

    Regards
    Sumitra
  • Hi Sumitra,

    Thank for quick response.

    Yeah I know that its not possible to record an audio using Sahi. but can I use _wait() in a such a way that it will wait till that mp3 speech of the current slide gets over playing??..
    so if an auto play is on it will automatically go to the next slide and I can check for that..

    but here problem is , the mp3 speech is not being played so, autoplay will not work untill it gets over completing that speech and because of that it will not go to the next slide, hence test fails...

    I already created the script for testing but the main problem is that I cant play mp3 while it runs through sahi..
  • Hi Sumitra,

    Could you find any solution for my problem??

    Thank a lot for your helping hand..
  • Hi shrey,

    Try the following code:
    <browser>
    function verifyPlayState(){
        var state = soundManager.getSoundById('__smobj___' + __curr_vid_slide).playState;
        _sahi._debug("state:" + state);
        if (state == 1){
            verifyPlayState();
        } else {
            return;
        }
    }
    </browser>
    
    function fnPlay(){
        _click(_link("Next"));
        _click(_image("playa.png"));
        _call(verifyPlayState());
    }
    
    _navigateTo("http://www.ipintentio.com");
    _click(_span("Login"));
    _setValue(_textbox("login_email"),"xxxx@gmail.com ");
    _setValue(_password("login_pass"),"xxxx");
    _click(_button(0));
    _click(_div("PLAN"));
    _click(_div("Project"));
    _click(_link("Video"));
    _wait(10000);
    _click(_link("Synchronous Circuits"));
    _wait(10000);
    _click(_image("playa.png"));
    _wait(10000, _image("stopa.png"));
    _log("new audio");
    _call(verifyPlayState());
    for(var $i=0;$i<5;$i++) fnPlay();
    

    Regards
    Sumitra
  • Yuuppy!!..

    Thanks a lot Sumitra..It works now!!!!!
    Saluting you and Mr. Narayana for providing such a continual and quick help.....



    Regards,
    shrey
  • narayannarayan Administrators
    Hi Shrey and Sumitra,

    The solution proposed is not an optimal one. In this case, till the condition is met, the application is going to keep checking for the state without any time gap. This will cause your browser to stop reacting or hit large CPU usage.

    You could try with just
    function waitTillAudioFinishes() {
      //  Let the soundmanager shift to 1 for audio to start
      _wait(100000, soundManager.getSoundById('__smobj___' + __curr_vid_slide).playState==1); 
      // wait till audio ends
      _wait(100000, soundManager.getSoundById('__smobj___' + __curr_vid_slide).playState==0);
    }
    

    and call

    waitTillAudioFinishes()

    where needed.

    Eg.
    function fnPlay(){
    _click(_link("Next"));
    _click(_image("playa.png"));
    waitTillAudioFinishes();
    }


    Regards,
    Narayan
This discussion has been closed.