Download PDF from a link

2 posts, 1 answers
  1. Carl
    Carl avatar
    11 posts
    Member since:
    Apr 2012

    Posted 26 Feb 2013 Link to this post

    Hi there
            one of our applications uses a PDF to display some information to the user, now I know that test studio doesn’t support PDF documents either in a browser or standalone, but I have been able to do some testing of the PDF file using the iTextSharp library for c#, the only problem is I need the file to be on my local hard disk and I don’t know how to get test studio to download the PDF from the link. Basically I want test studio to right click the link and select "save target as..." and then save the file to my hard drive. How do I do that?

    Thanks

    Carl
  2. Answer
    Boyan Boev
    Admin
    Boyan Boev avatar
    1072 posts

    Posted 26 Feb 2013 Link to this post

    Hello Carl,

    Test Studio is able to download a file directly with a left click on the link.

    I recorded a short video as a demonstration. 

    If it is really necessary to be with a right click you should use Desktop Mouse Click (see attached screen shot) and then via a coded step press down arrow four times (if the "Save target as" is the 4th from the top in the context menu for example) and hit Enter:

    this.Manager.Desktop.KeyBoard.KeyPress(System.Windows.Forms.Keys.Down,500,4);
    this.Manager.Desktop.KeyBoard.KeyPress(System.Windows.Forms.Keys.Enter,100,1);

    Note that you need to add an assembly reference to System.Windows.Forms.dll and a using statement for the System.Windows.Forms namespace. 

    As a last step you should have again Handle "Download" dialog step.

    Here is another video that demonstrates it.

    Hope this helps.


    All the best,
    Boyan Boev
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
Back to Top