Excel worksheet download, find, and use

2 posts, 0 answers
  1. Si
    Si avatar
    4 posts
    Member since:
    Oct 2018

    Posted 07 Jan Link to this post

    Hello,

    So I am running into an issue when I'm trying to download and then use an excel file. I record all the steps and use the dialog handler for "download", it saves the file. How do I then find and use that file in a coded step?

    So for example. I am downloading a worksheet that has a row of data I need to validate exists. I am able to download the file correctly. But now I need to use a coded step to "find" the excel sheet I downloaded. I'm running into an issue when I try to do this. 

    The file downloads with a unique name (filename, date to milliseconds), so if I rename the file to something that I can repeatedly use in the coded step (setting the filepath = that name), the dialog box doesn't handle the "overwrite and rename the file if it already exists" issue. 

     

    Is there a way for Test Studio to handle this?

     

    Thanks,

    Si

  2. Elena
    Admin
    Elena avatar
    1093 posts

    Posted 10 Jan Link to this post

    Hello Si,

    Thank you for contacting us. 

    As you have noticed Test Studio provides a built-in download dialog handler which automatically records the download handling. One of the mandatory properties of that download dialog step is the DownloadPath which should be a valid full path where the file will be stored including the name of the file. This property can be also parameterized if using a data source to data drive the test. That way you can set different name for the file by each test run, if this is a requirement. 

    Since the file name will be available in the data source. you will be able then to use the same further in the test, for example to verify any data in the downloaded file. 

    Though, in case the downloaded files from each test can be overwritten, you still can use a static DownloadPpath to the file and leave the name of the file to be a static one - the built-in handler is designed to confirm the Overwrite prompt. Since you reported you experienced some issues with that, can you please prepare a sample test which demonstrates the troubles you have faced? If you can record the test against a public accessible page I will be able to test it on my end and verify what the outcome will be.

    Please, if this is the case, let me know the following details:
    - which is the browser you use to execute the test
    - which is the version of the browser
    - which is the version of the Test Studio extension enabled in the browser (for Chrome and Firefox)
    - which is the version of Test Studio in use

    Once we sort out what the trouble with the Download dialog might be, you can proceed with the other requirement to verify some data in the downloaded excel file in a coded step, as you suggested. Here is a sample article you can use for reference - although it demonstrates how you can write into an excel file, it still can be used as a starting point how to locate the file and read from it. This additional MSDN forum post will be useful how to design the custom solution to read from the file. 

    I hope the above notes will be useful for you. Though, in case of any questions, please let me know. 

    Thanks. 

    Regards,
    Elena Tsvetkova
    Progress Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
Back to Top