I am facing some issues while saving excel file.
Scenario is as below:
1. Provide some cust id in UI
2. Click on fetch button.
3. Records will appear in grid below.
4. Right click on any row and click on "Export to Excel" option from context menu. <This is causing problem many times as context menu doesn't appear quickly and even a small movement in mouse or delay in appearnce - QTP throws err>
5. Considering export is successful, I need to save exported excel file to some predefined location. For this thing, I am using Sendkeys methods. Refer the code snippet below. However, again here also I've faced some issues as sometimes file(excel) doesn't appear or window takes some time to open and thus all the next operations fail.
Plese let me know the ways how to handle this so that I can execute it in one go without any issues/errors. Thanks a lot in advance.
Set WshShell= CreateObject("Wscript.Shell")
Set WshShell= Nothing
Step1: wait 5 for table to appearp
Step2:kill all excel process
Step 3: get object of excel after click on export to excel( before it kill all excel process)
Step4: open excel workbook,worksheet
Ste5: Save excel