SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 7 of 7
  1. #1
    Member graemeal's Avatar
    Join Date
    Nov 2005
    Location
    Belfast
    Posts
    326
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Unable to download file

    I'm testing a web application that allows me to download a Word document.
    when I manually click on the download link, a new browser window appears which activates the download. I get a dialog asking is want to Open, Save or Cancel the download. After selecting an option, then new dialog closes.
    Thats all relatively straight forward.

    But, when QTP clicks on the link, the new browser opens as expected, but the download dialog doesn't appear. The new dialog closes shortly after being opened.

    Has anyone ever come across different behaviour between manually clicking a link, and QTP clicking a link?

    Any ideas, greatly appreciated.
    Graeme

  2. #2
    Member
    Join Date
    Oct 2007
    Location
    Mumbai
    Posts
    34
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Unable to download file

    It would be helpful if you could post your code related to this.
    <font color="olive">Cheers !

    Life is On Error Resume Next</font>

  3. #3
    Moderator
    Join Date
    Sep 2001
    Location
    Doncaster, UK
    Posts
    5,839
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Unable to download file

    Graeme have you tried recording this part of the script in Low-Level recording mode?


    Mark Smith.

  4. #4
    Member graemeal's Avatar
    Join Date
    Nov 2005
    Location
    Belfast
    Posts
    326
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Unable to download file

    Low-Level recoding seems to work! Thanks Mark.
    I don't like using anything with x, y coordinates, but I might have to this time.

    I'm just a bit confused that different things happen depending on whether I click a link, or QTP clicks it. Has anyone any explanation as to why this might be? Is it QTP problem? Is it a problem with the AUT?
    Graeme

  5. #5
    Junior Member
    Join Date
    Dec 2006
    Posts
    8
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Unable to download file

    Hi,

    Try capturing the url ( of the download file).
    Create an IE object and open Url with it.

    I hope it works.

    Thanks,
    nzlanka

  6. #6
    Junior Member
    Join Date
    Mar 2008
    Posts
    25
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Unable to download file

    [ QUOTE ]
    Low-Level recoding seems to work! Thanks Mark.
    I don't like using anything with x, y coordinates, but I might have to this time.

    I'm just a bit confused that different things happen depending on whether I click a link, or QTP clicks it. Has anyone any explanation as to why this might be? Is it QTP problem? Is it a problem with the AUT?

    [/ QUOTE ]

    Try Setting the replay type before pressing the link
    Setting.WebPackage("ReplayType") = 2
    and then setting it back after
    Setting.WebPackage("ReplayType") = 1

    This has saved me a few times when problems occur pressing certain links (mainly in FF)

  7. #7
    Member
    Join Date
    Oct 2005
    Posts
    352
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Unable to download file

    yeah this was alos a problem which bugged us a lot. The problem with the windows file download dialog box is there needs to be a delay before you click the Save button. So adding wait of 5-10 seconds after the dialog box appears will help. I am attaching the function for your reference.



    'Function to verify the download popup has popped up
    Function VerifyFileDownloadPopup (FileName)

    FileNameIndia = replace(FileName, "_", " ")
    If Dialog("dlg_File_Download").WinObject("regexpwndcl ***:=SysLink","attached text:=Name:","text:="&amp;FileName).Exist(20) or Dialog("dlg_File_Download").WinObject("regexpwndcl ***:=SysLink","attached text:=Name:","text:="&amp;FileNameIndia).Exist(20) then
    Environment("ActualFileName")= Dialog("dlg_File_Download").WinObject("lbl_FileNam e").GetROProperty("text")
    reporter.ReportEvent micDone, "File Download Dialog popup OK. File name", Environment("ActualFileName")
    VerifyFileDownloadPopup = true
    Else
    If Dialog("dlg_Dialog").WinObject("regexpwndclass:=Sy sLink","attached text:=Name:","text:="&amp;FileName).Exist(20) then
    Environment("ActualFileName")= Dialog("dlg_Dialog").WinObject("lbl_FileName").Get ROProperty("text")
    reporter.ReportEvent micDone, "File Download Dialog popup OK. File name", Environment("ActualFileName")
    VerifyFileDownloadPopup = true
    Else
    Environment("ActualFileName")= Dialog("dlg_File_Download").WinObject("lbl_FileNam e").GetROProperty("text")
    VerifyFileDownloadPopup=false
    End if
    End if

    End Function

    'Function to download the file by default teh file downloads into the results folder.
    Function FileDownload(FileName)
    ' If Environment("ExecutedIn") = "UK"Then

    If VerifyFileDownloadPopup(FileName) then
    'ActualFileName= Dialog("dlg_File_Download").WinObject("lbl_FileNam e").GetROProperty("text")
    Dialog("dlg_File_Download").Activate
    wait 1
    Dialog("dlg_File_Download").WinButton("btn_Save"). DblClick 10,10
    If Dialog("dlg_File_Download").WinButton("btn_Save"). exist(1) Then
    Dialog("dlg_File_Download").Activate
    sendkey("ALT+S")
    sendkey("{ENTER} ")
    End If
    If Dialog("dlg_File_Download").WinButton("btn_Save"). exist(1) Then
    Dialog("dlg_File_Download").WinButton("btn_Cancel" ).Click
    FileDownload = false
    Exit function
    End If
    'Browser("DMS").Sync
    end if
    Environment("CompleteFileName")= reporter.ReportPath&amp;"\"&amp;Environment("Actua lFileName")

    If Dialog("dlg_SaveAs").Exist(25) then
    Dialog("dlg_SaveAs").WinEdit("File name:").Set Environment("CompleteFileName")
    Dialog("dlg_SaveAs").WinButton("Save").Click
    end If
    wait 2
    If Dialog("ExportTo").Dialog("Save As").Dialog("Save As").WinButton("Yes").Exist(2) Then
    Set fso = CreateObject("Scripting.FileSystemObject")
    fso.DeleteFile (Environment("CompleteFileName"))
    wait 2
    Set fso = nothing
    Dialog("ExportTo").Dialog("Save As").Dialog("Save As").Activate
    Dialog("ExportTo").Dialog("Save As").Dialog("Save As").WinButton("Yes").Click
    End If

    If FileExist(Environment("CompleteFileName"), Environment("FileDownLoadTimeOut")) Then
    FileDownload = true
    else
    FileDownload = false
    End If
    If Dialog("dlg_File_Download").Exist(0) Then
    Dialog("dlg_File_Download").Close
    End If
    ' End If

    End Function


    'Checks the file existing or not in the filenamepath for a certain time period.
    Function FileExist( FileName, timeout)
    FileExist = false
    Set fso = CreateObject("Scripting.FileSystemObject")
    For i = 1 to timeout
    If (fso.FileExists(FileName))Then
    FileExist = true
    Set fso = nothing
    Exit for
    end if
    wait 1
    Next
    Set fso = nothing
    End Function

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.40 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 9.38%
vBulletin Optimisation provided by vB Optimise v2.7.1 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.3.0 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 10:19 PM.

Copyright BetaSoft Inc.