Micro Focus QTP (UFT) Forums
Validate a File Download - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Validate a File Download (/Thread-Validate-a-File-Download)



Validate a File Download - flexdev - 05-10-2012

How can I validate that when a user clicks 'submit' on an HTML form that a windows dialog box with the name of the file to download comes up?

Thanks!


RE: Validate a File Download - sshukla12 - 05-10-2012

Hi,

Do u want to check if file is downloaded or not???


Regards,
Sankalp


RE: Validate a File Download - flexdev - 05-10-2012

Yes, I'd like to know if it's downloaded. My main concern was getting QTP to click the "save" buttons on the windows dialog boxes.


RE: Validate a File Download - joncfrazier - 05-10-2012

You can add the windows dialog boxes to your object repository, then record the click on save (or just add using object spy).

I believe you have to setup QTP to accept windows dialog boxes, IIRC it's under [Tools] > [Web Event Recording Settings] > [Custom] > All? and make sure "onclick" is set to "Always"


RE: Validate a File Download - flexdev - 05-11-2012

I've added the windows dialog to my object repository and changed the setting for onclick. However, I'm still getting this error:

Object not visible

Line (5): "Browser("Browser").Dialog("File Download").Activate".

Perhaps I didn't add the object to my repository correctly? It seems to get added automatically as soon as I click on it when I'm recording.


RE: Validate a File Download - joncfrazier - 05-11-2012

QTP error codes are only semi-useful, as they mostly list just the first line of the code. What is on the 5th line? I find that recording is the fastest and easiest way to add objects to the repository, and have yet to have any real issue on adding them. Descriptive Programming, so far, seems a bit of a waste unless you already know what the identifiers are (which I rarely do).


RE: Validate a File Download - flexdev - 05-11-2012

Code:
Browser("Browser").Page("Page").WebEdit("meetingid").Click
Browser("Browser").Page("Page").WebEdit("meetingid").Set "982"
Browser("Browser").Page("Page").WebEdit("docid").Set "22"
Browser("Browser").Page("Page").WebButton("Submit").Click
Browser("Browser").Dialog("File Download").Activate
Browser("Browser").Dialog("File Download").WinButton("Save").Click
Browser("Browser").Page("Page").Sync
Dialog("0% of get from minime.fmr.com").Dialog("Save As").Activate
Dialog("0% of get from minime.fmr.com").Dialog("Save As").WinButton("Save").Click
Dialog("0% of get from minime.fmr.com").Dialog("Save As").Dialog("Save As").Activate
Dialog("0% of get from minime.fmr.com").Dialog("Save As").Dialog("Save As").WinButton("Yes").Click



RE: Validate a File Download - joncfrazier - 05-11-2012

My only thought right now is that it's attempting line 5, activate, faster than that dialog can show up. Try inserting Wait (x) between them. Where x is a time in seconds.

edit: From what I understand of this, the user inputs data, then submits it, and then is given a prompt to download the data they were just given? Are there no other screens or actions taken between these? Somtimes QTP misses on some steps if the user directly clicks on functional buttons (login, submit, search, etc..) I have to sometimes click off in a blank area to force QTP to record what I just did, and then delete the empty space click.


RE: Validate a File Download - Ankesh - 05-11-2012

Use synchronisation/WAITProperty on the File download dialog box. Its happening because script is trying to activate the dialog where as once you submit a form, it usually takes sometime to popup/display the next window.

Regards,
Ankesh