18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
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.
Download big file, waiting page, hanging instruction
OS Linux
Browser IE 8
Sahi build: 3.5, 2011-05-25
Hello
I have a problem with an instruction that hangs with no result.
The goal is to download a big file; I used the examples provided on the site.
We use a wait page in our application since the operation can take some time.
An iframe is used to check when the operation is finished and the browser shows a dialog box to store the file locally. I guess the state of the page is never updated so that Sahi is stuck...
Any sahi instruction after loading the html page does not complete.
Can you please advise anything?
Thanks a lot in advance!
Fabien
Here is the Sahi script:
Here are the output logs:
Here is the html generated code:
Browser IE 8
Sahi build: 3.5, 2011-05-25
Hello
I have a problem with an instruction that hangs with no result.
The goal is to download a big file; I used the examples provided on the site.
We use a wait page in our application since the operation can take some time.
An iframe is used to check when the operation is finished and the browser shows a dialog box to store the file locally. I guess the state of the page is never updated so that Sahi is stuck...
Any sahi instruction after loading the html page does not complete.
Can you please advise anything?
Thanks a lot in advance!
Fabien
Here is the Sahi script:
_assertNull(_lastDownloadedFileName()); // nothing so far
try{
_navigateTo($urlReport + "guaranteeReport"); //It hangs there, see the html code below
//The file is downloaded in the temp folder under the following name: sahi_5d3430a703d2704fa30951608aeb9abb55d9__bondReports.do
//so I know that there is no problem with the config params
_log(_lastDownloadedFileName()); //after some time, there are "< did not complete i
n 150 seconds." messages
_assertEqual("bondReports.do", _lastDownloadedFileName()); // check if downloaded
_saveDownloadedAs($guaranteeReportOutputFile); // save to another path
_clearLastDownloadedFileName(); // clear the variable
_assertNull(_lastDownloadedFileName()); // check to see if cleared.
}
catch(e){
_log("Error","ERROR");
_log(e);
}
Here are the output logs:
6 fÚvr. 2012 18:28:40 net.sf.sahi.RemoteRequestProcessor processHttp
INFO: Calling downloadFile
6 fÚvr. 2012 18:28:40 net.sf.sahi.RemoteRequestProcessor processHttp
INFO: http://salpt10073/bg/reports/bondReports.do?startCLT=1328534909750&reqCode
=guaranteeReport
6 fÚvr. 2012 18:28:40 net.sf.sahi.RemoteRequestProcessor processHttp
INFO: downloadURL = false
6 fÚvr. 2012 18:28:40 net.sf.sahi.RemoteRequestProcessor processHttp
INFO: response.isAttachment() = true
6 fÚvr. 2012 18:28:40 net.sf.sahi.RemoteRequestProcessor processHttp
INFO: contentTypeHeader = eisxx/attachment
6 fÚvr. 2012 18:28:40 net.sf.sahi.RemoteRequestProcessor processHttp
INFO: downloadContentType = false
6 fÚvr. 2012 18:28:40 net.sf.sahi.RemoteRequestProcessor processHttp
INFO: Content-Disposition=attachment; filename=Guarantees Report_01_12.xls
6 fÚvr. 2012 18:28:40 net.sf.sahi.RemoteRequestProcessor save
INFO: Downloading sahi_5d3430a703d2704fa30951608aeb9abb55d9__bondReports.do to t
emp directory: R:\My Documents\sahi\userdata\temp\download
6 fÚvr. 2012 18:28:41 net.sf.sahi.RemoteRequestProcessor downloadFile
INFO: Setting download_lastFile = bondReports.do
6 fÚvr. 2012 18:28:41 net.sf.sahi.RemoteRequestProcessor downloadFile
INFO: Session Id: sahi_5d3430a703d2704fa30951608aeb9abb55d9
Rhino lib:Step >_sahi._log(_sahi._lastDownloadedFileName());< did not complete i
n 150 seconds.
Rhino lib:Step >_sahi.saveCondition("__lastConditionValue__0", _sahi._link("Logo
ut") != null)< did not complete in 150 seconds.
Here is the html generated code:
<html><!--SAHI_INJECT_START-->
<script>/*<![CDATA[*//*---->*/__sahiDebugStr__="";__sahiDebug__=function(s){__sahiDebugStr__+=(s+"\n");};/*--*//*]]>*/</script>
<script src="/_s_/dyn/SessionState_domainfix/domainfix.js"></script>
<script src='/_s_/spr/concat.js' id='_sahi_concat'></script>
<script src='http://sahi.example.com/_s_/dyn/SessionState/state.js'></script>
<script src='/_s_/spr/language_pack.js' id='langpack'></script>
<script>/*<![CDATA[*//*---->*/_sahi.createCookie('sahisid', _sahi.sid);_sahi.loadXPathScript()/*--*//*]]>*/</script>
<script>/*<![CDATA[*//*---->*/eval(_sahi.sendToServer("/_s_/dyn/Player_script/script.js"));/*--*//*]]>*/</script>
<script src='/_s_/spr/playback.js'></script>
<!--SAHI_INJECT_END-->
<meta http-equiv="CACHE-CONTROL" content="MAX-AGE=3600, PUBLIC" />
<head>
<title>Wait page</title>
<style>
.label1 {font-family: Arial; font-size: 14px; font-weight: bold; color: #0F238C; text-decoration: none; text-align: left; }
.label2 { font-family: Arial; font-size: 13px; font-weight: normal; color: #666666; text-align: left; }
#global {
position:absolute;
left: 50%;
top: 50%;
width: 800px;
height: 100px;
margin-left: -400px;
margin-top: -50px;
text-align: center;
}
</style>
<script language="javascript" src="/bg/resources/js/cookies.js"></script>
<script language="javascript" src="/bg/resources/js/bng.js"></script>
<script>
function historyBack()
{
if (document.stateSaverForm.alreadySubmitted.value == "true") {
var iframe = document.getElementById("iframe");
iframe.parentNode.removeChild(iframe);
setInterval('history.go(-3)',2000);
} else {
document.stateSaverForm.alreadySubmitted.value = "true";
setHistoryCookie();
}
}
function setHistoryCookie()
{
var wDate = new Date();
wDate.setSeconds(wDate.getSeconds()+1);
SetCookie("historyBack", "true", wDate);
}
</script>
</head>
<body>
<br>
<div id="global"><p><font class="label1">Your action is being processed…</font><br/>
<font class="label2">Please wait until the page is loaded.</font></p>
</div>
<form name="stateSaverForm"><input type="hidden" name="alreadySubmitted" value="false"></form>
<form name="submitForm" action="/bg/reports/bondReports.do" method="GET" target="iframe"><input type="hidden" name="reqCode" value="guaranteeReport"><input type="hidden" name="startCLT" value="1328534239332"></form>
<iframe name="iframe" id="iframe" onreadystatechange="historyBack();" style="visibility: hidden;"></iframe>
<script>
document.submitForm.startCLT.value=(new Date()).getTime();
if (window.name=="") {
window.name = (new Date()).getTime();
}
var wDate = new Date();
wDate.setSeconds(wDate.getSeconds()+1);
SetCookie("windowid", window.name, wDate);
document.submitForm.submit();
</script>
</body>
</html>