Answered

How to upload a downloaded Excel file during a text execution

Good Morning,

I have a test which export an excel sheet and I need to read the data from it. Is there a command to upload the exported file that back to the system so a "SET_LIST" command can read it.

Thanks,

0
4 comments
Avatar
Joseph Hamdan

Good morning Hasib,

How do you get the Excel sheet?

If a link is clicked that downloads the file, then you can use Get_Web_Value command (with href attribute) and pass the stored path to Set_List command.

Regards,

Subject7 Team

0
Comment actions Permalink
Avatar
Hasib Rostaiee

Hi Joseph,

The file is a system generated file. A button is clicked which creates the file and then it downloads automatically. 

0
Comment actions Permalink
Avatar
Jonathan Hotz

Hi Hasib, here is solution we can suggest:

1. Download this jar file: https://subject7-prod-artifacts.s3.amazonaws.com/test_automation/FILES/1591788954592_test_automation_test_automation_download-helper.jar

2. Rename file to anything more short and useful.

3. Add WAIT command after the CLICK that downloads file, just to be sure file is downloaded.

4. Create Snippet with jar file from point 1, class name is com.subject7.DownloadHelper

5. Add command Execute_Java with the snippet from point 4. Method name is getMostRecentFile.

Execution of this snippet will find most recent file (your XLS) in C:\Users\<your_user>\Downloads\ and put it to a variable @DOWNLOAD_HELPER_MOST_RECENT_FILE

6. Add Set_List command, select source XLS, link type URL and put this as URL file:///@DOWNLOAD_HELPER_MOST_RECENT_FILE. It will read downloaded file.

0
Comment actions Permalink
Avatar
Hasib Rostaiee

Thank you Alexei,

I would modify the jar file for the download path as for NHLBI it's different path. However, I was able to pass file path directly in the set_list command without using the code snippet as the name of the file is always same so that will work.

0
Comment actions Permalink

Please sign in to leave a comment.