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.

Long pause after download

Rhubarb3.1415Rhubarb3.1415 Members
edited April 2009 in Sahi - Open Source
Hello,
Running Firefox on a Fedora 10 machine.
After executing a successful download:
_click(_link("Download"));
the .sah script pauses for about 3 minutes after the browser has announced the download is complete.
After the pause script execution continues without any errors.
Nothing unusual in the log file.
Beside the _debug() API is there anyway to start the script in a debugging or verbose mode so to see what's going on during the pause?

Thanks

Comments

  • narayannarayan Administrators
    Rhubarb, are you letting Sahi download the file or is the browser downloading the file?
  • Rhubarb3.1415Rhubarb3.1415 Members
    edited April 2009
    Since the script issues a _click on the link I'm assuming that means I'm having the browser download the file.
    Also there is the little pop-up window that tells you when download is complete so it must be the browser that is doing the download.
  • Since the this script doesn't need to wait for the download to complete is there a way "background" the command? That way the script can continue without waiting.
  • narayannarayan Administrators
    I am having a look at this.
  • Rhubarb3.1415Rhubarb3.1415 Members
    edited April 2009
    Solved it.
    What works for me isn't to click the Download button:

    _click(_link("Download"));

    But to instead get the href info for the button:

    _set($linkinfo, document.links[5].href);

    Then open another window using that href:

    <browser>
    function openwin($href,$name){
    window.open($href, $name);
    return $name;
    }
    </browser>

    _debugToFile( openwin($href_array[$j],$window[$j]),"/tmp/debug-sahi")

    I use the above code to open a series of windows, one for each download..
    The script will open a window then continue, not waiting for the window to complete it's download.
    When the window does complete it terminates without any problems.

    OK now I have a NEW problem.
    If I open too many windows at one time I'll get the "java.lang.OutOfMemoryError: Java heap space" error.
    I can use an _wait() to space out the window creations but that's not very efficient.
    I'd like to be able to regulate the number of currently open windows and not open a new one until another has closed.
    I've attempted this using the Javascript window.closed:
    http://www.w3schools.com/HTMLDOM/prop_win_closed.asp

    I've tried many iterations of window.closed and I can't seem to get any of them to work the way I want.
    If I'm using "window.open($href, $name)" correctly shouldn't the window created have the name stored in $name?
    I just want a loop that will execute until (for example) "window0" completes.

    Suggestions welcomed.
    Thanks for the help.
    Rhubarb
Sign In or Register to comment.