Forum Discussion

jmassey's avatar
jmassey
Contributor
8 years ago

Select specific file from Windows Explorer window

I have found a few other forum posts asking for similar things, where the solution is usually one form or another of doing what the tester needs to do in a different way, e.g. entering the location directly in the location bar in Open dialogs, clicking a random point in the window to pick any arbitrary file, etc., but have not found a direct answer on how to select a specific file from Windows Explorer. Is this possible?

 

I need to be able to test dragging-and-dropping a file onto our application. Depending on what will be tested and how later on, it needs to be a specific file. The folder is generated by the program at install, so I can't contrive to make it only contain one file or a specific set of files, and writing the test script to assume that it will always exactly contain the same set of files as the default install leaves it fragile.

 

It seems like this should be something I would be able to do, but all the workaround responses to similar questions are making me start to think that won't be the case, so has anybody else made drag-and-drop from Explorer to the application under test work in some other way?

1 Reply

  • NisHera's avatar
    NisHera
    Valued Contributor

    You can do something like this 

    1) open windows explorer (this can be achieved simply recording )

    2) go to your folder by clicking treeview node selecting tree view 

     

    3)Name map your file using object spy This will look like ........(Aliases.explorer.Window("CabinetWClass", "C:\\Temp", 1).Window("ShellTabWindowClass", "C:\\Temp", 1).Window("DUIViewWndClassName", "", 1).UIAObject("Explorer_Pane").Window("CtrlNotifySink", "", 3).Window("SHELLDLL_DefView", "ShellView", 1).UIAObject("Items_View").UIAObject("soapUI_x32_4_5_1_exe")) here I have got soapUI exe in my C:\temp folder.

    in that object you can click anywhere (eg hight/2  and widhth/2) 

     

    4) Drag and drop using above mapped object and it's points to your app click here for more

     

    this is high level steps and please try and ask any practical problems.