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 a file under sahi
Hi all,
I've a new problem. When i'm using my webapplication, i can download a document (word .docx). When i clic on my link, i've a pop-up "open file with", i can open the document or save the document.
When i try the same action under Sahi browser, nothing appears.
Console Logs gives me
i've a crypted document in userdata\temp\download
named => sahi_7eb9f33a069b404183081b10ee7a580a2e58__file.do
but i dont know how to use it.
maybe downloadURL = false must be on true but i dont know how to do that
What is file.do ?
I read few topics, i tried few configurations in download_urls.txt and in
download_contenttypes.txt and nothing works.
thank you for your help
Fabrice
I've a new problem. When i'm using my webapplication, i can download a document (word .docx). When i clic on my link, i've a pop-up "open file with", i can open the document or save the document.
When i try the same action under Sahi browser, nothing appears.
Console Logs gives me
22 sept. 2011 14:20:53 net.sf.sahi.RemoteRequestProcessor processHttp
INFO: Calling downloadFile
22 sept. 2011 14:20:53 net.sf.sahi.RemoteRequestProcessor processHttp
INFO: http://kimv2qualite2/file.do?id=8
22 sept. 2011 14:20:53 net.sf.sahi.RemoteRequestProcessor processHttp
INFO: downloadURL = false
22 sept. 2011 14:20:53 net.sf.sahi.RemoteRequestProcessor processHttp
INFO: response.isAttachment() = false
22 sept. 2011 14:20:53 net.sf.sahi.RemoteRequestProcessor processHttp
INFO: contentTypeHeader = application/msword
22 sept. 2011 14:20:53 net.sf.sahi.RemoteRequestProcessor processHttp
INFO: downloadContentType = true
22 sept. 2011 14:20:53 net.sf.sahi.RemoteRequestProcessor processHttp
INFO: Content-Disposition=attachment;filename="LE MEME-1.docx"
22 sept. 2011 14:20:53 net.sf.sahi.RemoteRequestProcessor save
INFO: Downloading sahi_7eb9f33a069b404183081b10ee7a580a2e58__file.do to temp directory:\Program Files\InstallSahiProject\userdata\temp\do
wnload
22 sept. 2011 14:20:53 net.sf.sahi.RemoteRequestProcessor downloadFile
INFO: Setting download_lastFile = file.do
22 sept. 2011 14:20:53 net.sf.sahi.RemoteRequestProcessor downloadFile
INFO: Session Id: sahi_7eb9f33a069b404183081b10ee7a580a2e58
i've a crypted document in userdata\temp\download
named => sahi_7eb9f33a069b404183081b10ee7a580a2e58__file.do
but i dont know how to use it.
maybe downloadURL = false must be on true but i dont know how to do that
What is file.do ?
I read few topics, i tried few configurations in download_urls.txt and in
download_contenttypes.txt and nothing works.
thank you for your help
Fabrice
Comments
Add .*MEME[-]1[.]docx.* in download_urls.txt by clicking on configure on the Dashboard.
Save. Restart Sahi.
Also, suppose clicking a download link throws the save as dialog. You can use this:
Check if this solves your issue.
Regards
Sumitra
Sorry for the delay, i was on another task since 4 days.
I tried to add some expressions in download_urls.txt :
.*[.]pdf[.]docx.*
.*file[.]do.*
.*[.].pdf.*
.*[.].docx.*
but it still not works...
To answer to your question, it's not a download link, but a call on a file, a report on office word format.
Without of sahi proxy, i've a pop-up to choose a soft to read my file, i choose Word and i can see my report.
I just want to do the same with sahi, see this report and be able to assert in it.
I think my problem is on file.do : i dont understand what it is...
How could i exploit the : download_lastFile = file.do in a script ?
Thank you
regards
Fabrice
Can you try doing _saveDownloadedAs("c:/path/myfile.docx"); in your script and check if you are able to download the file in the correct format.
Regards
Sumitra
Yes it' is ok,
i've the trace in the console
And my doc is correct format MSoffice-word
What can i do with it to assert in ?
Thx
Fabrice
There is a bug in Sahi because of which the downloaded file is not in the correct format.
You can assert the file in userdata\temp\download by using:
_lastDownloadedFileName(); API
For more details:
http://sahi.co.in/w/handle-file-downloads
Regards
Sumitra
it's ok for me
i would to assert on the content of this file but with msword format i think it is hard.
_readFile gave to me the crypted text of course...
Before ending end the topic, would you have an idea ?
thx
Fabrice
_readFile() will help you to read all type of files.
If you are trying to read a msword format file then it will be in a crypted format because the contents will be large enough to read by Sahi.
Regards
sumitra
yes indeed...
did you have an idea to get only the text and in a clear readable format from a .docx ?
thx
Fabrice