0

I am trying to download a report using UFT by navigating to multiple web pages then finally interacting with download dialog box to save file on a particular location. But I want all this happen in background so want to make web pages and dialog box invisible while running the UFT. Is there any Browser and Dialog property which can make make them invisible in terms of GUI but download the report.

This is the code which I am using. Please help thanks in advance.

Browser("WELCOME. MicroStrategy").Page("WELCOME. MicroStrategy").Link("Link").Click
Browser("WELCOME. MicroStrategy").Page("WELCOME. MicroStrategy").Link("Shared ReportsRun reports").Click
Browser("WELCOME. MicroStrategy").Page("WELCOME. MicroStrategy").Link("Link_2").Click
Browser("WELCOME. MicroStrategy").Page("WELCOME. MicroStrategy").Link("Link_3").Click
Browser("WELCOME. MicroStrategy").Page("WELCOME. MicroStrategy").WebElement("tbExport").Click
While Dialog("Internet Explorer").Exist=False
    wait(1)
Wend
If Dialog("Internet Explorer").Exist=True Then
    Dialog("Internet Explorer").WinButton("Save &as").Click
End If
strSafeDate = DatePart("yyyy",Date) & Right("0" & DatePart("m",Date), 2) & Right("0" & DatePart("d",Date), 2)
strSafeTime = Right("0" & Hour(Now), 2) & Right("0" & Minute(Now), 2) & Right("0" & Second(Now), 2)
'Set strDateTime equal to a string representation of the current date and time, for use as part of a valid Windows filename
strDateTime ="H:\MSTR reports\IPP_Not_Paid_"& "_" & strSafeDate & "-" & strSafeTime
Dialog("Save As").WinEdit("File name:").Type strDateTime
Dialog("Save As_2").WinButton("&Save").Click
wait(5)
Browser("WELCOME. MicroStrategy").CloseAllTabs
  • Nope. The `.Type` command requires that the object being operated on has focus, so unless you find another way to enter that save location, you will need it to be visible for UFT. – Dave Apr 08 '17 at 22:28
  • I used Browser("WELCOME. MicroStrategy").Object.Visible=False for the web pages' invisibility but didn't found any thing about Dialog box's visibility. – Rohit Bhardwaj Apr 10 '17 at 11:38
  • That's because a Dialog box requires interaction. So you can't make it invisible. Consider trying to download it via an `XMLHTTP` object, perhaps? Have a look here: http://stackoverflow.com/questions/2973136/download-a-file-with-vbs – Dave Apr 10 '17 at 13:53
  • I tried with above solution using XMLHTTP and leverage an ADO stream but it's loading the html page not file data. I think it's because of url as it's not an absolute url while loading report its keep on changing. It's a bridge url so is there any other possibility ? – Rohit Bhardwaj Apr 11 '17 at 05:32
  • Can you get it via FTP or other method? Otherwise you'll have to live with the dialog box. – Dave Apr 11 '17 at 08:48

0 Answers0