import .csv file into TestComplete
I have a .csv file I need to pull into my Keyword Test. The file is pulled during recording and the data displays correctly. However; the playback fails at this step.
tvNamespaceTreeControl ClickItem "|Desktop|This PC|Documents" Clicks the '|Desktop|This PC|Documents' item of the 'tvNamespaceTreeControl' tree.
Are there any existing scripts or guidance that would help me pull this file in?
Playing back the interaction with an Open File dialog can indeed prove tricky at times. Usually it comes down to the click event on the specific file not working correctly. For this we have a couple of workarounds.
The first is that we actually have a built-in 'openFile' method that can be used on Open File dialogs. Once you have the dialog open you can stop the recording process, grab the object spy and spy the 'File Name' field of the Open File dialog. Once that field is mapped, there is an 'openFile' method that can be used and when selecting this method TC will allow you to specify the file you would like to upload. On playback it will then automatically push your file into the Open File dialog and send.
A second way to do this is to begin typing the name of your file into the File Name field of the dialog, and select the file with the arrow keys on your keyboard and press enter.
Both of these processes allow you to avoid clicking on the file itself in the dialog to avoid any issues.
I hope this helps!