Forum Discussion

BMD's avatar
BMD
Contributor
9 years ago

aqFile.Open (Just open it, Please)

Hi,

I'm trying to just open a file on a network drive.  The Utilities.FileOpen(FileNameMode) functions are now 'obsolete' I'm guessing because they worked.  I'm trying to open a .pdf, it is just an Adobe report generated from a web application.  If I open the report in the web application TC does not see the Adobe application running and the script is VERY slow.  I'm thinking if I do a 'save as' and save the report and then open it - TC does see the Adobe application in the object browser.  I'm hoping this method will be faster.  The line of code below runs just fine and does nothing.  The .pdf is NOT opened and no errors are reported.  

 

aqFile.OpenBinaryFile("z:\\testing\\SD12345.pdf", 11);

 

My (what I think should be simple and easy) question is how do I get TC to open a simple .pdf file?  I can't believe the help is so convoluted and is helpless.

 

TC = 11.20.1491.7

Script = .sj

Browser = IE 11

 

Thanks for any pointers.

BMD

  • cunderw's avatar
    cunderw
    Community Hero

    Utilities.OpenFile was replaced by aqFile.openTextFile, but this still will not work with pdfs either.

     

    What are you trying to accomplish? open the file in the reader? Both methods mentioned above only opens files for reading them in script, not opening them in an application. 

     

    If you just need to read the contents of the pdf in your script, check out the PDFBox.NET framework. 

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      As cunderw mentioned, the open file commands you are trying to do have nothing to do with opening a report file to be displayed in a browser. They are low level open file commands to open them to be read into the test to check contents, write contents, etc.  These will not work for a PDF.

      • BMD's avatar
        BMD
        Contributor

        The web application I'm testing generates reports as a .pdf.  I copy the text displayed in the .pdf and search for items that need to be found.  When the web application generates and opens the .pdf TC does not see Adobe running in the object browsers, and when I do the .Keys("!^s") to open the save-as screen to enter the path and file name it all works but takes too long to run.  TC sits with the .pdf open and waits about two minutes before doing the keys command to open the save-as screen and waits again two minutes before entering the path and file name and again two minutes to close the .pdf.  Once the text is in the clipboard and the .pdf is closed the script runs fast again.  I believe this is all because TC does not see Adobe running in the project browser.  If I just open the file through windows Adobe is listed and I'm hoping this will of faster.  All I'm trying to do is, within the application do a save-as.  This does not open or use Adobe.  After the file is saved I want to open it through Windows (using 7enterprise-64) to do the verification of the text within the .pdf.  If I open the file from the drive TC see Adobe running and I'm hoping save the 6 minutes of waiting.

         

        I can't believe TC can't just open a file from a drive.

        Thanks, BMD