Forum Discussion

medha2016's avatar
medha2016
New Contributor
8 years ago
Solved

Select a particular file in windows explorer pop up

I am testing an web application. if user clicks on a button (import button : allows user to select file to import), windows explorer pops up for selecting file.

if record this test, i cannot select a different file each time.. as it records the click on co-ordinates.

recorded test converted to script does not allow me to select random files.

 

alias.browser.dlgopen.DUIViewWndClassName.DirectUIHWND.ctrNotifySink.NamespaceTreeCotrol.sysTreeView32.click(105, 349)

 

on click i get the window ,  i dont know how to click on particular file.

 

I am new to testcomplete.. this is second week.

 

 

  • Hi medha2016,

     

    You can use the OpenFile method to select a file by its path:

     

    // JScript
    Aliases.browser.dlgopen.OpenFile("C:\\MyFolder\\MyFile.txt");

3 Replies

  • NisHera's avatar
    NisHera
    Valued Contributor

    in VB you can get random number using Rnd([number])
    this gives you number between 0 and 1
    define variable like... dim y=Rnd([number])*H
    H is height of the pop up window
    and use.........................NamespaceTreeCotrol.sysTreeView32.click(105, y)

     

    just a rough idea you may have to fine tune this

  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)

    Hi medha2016,

     

    You can use the OpenFile method to select a file by its path:

     

    // JScript
    Aliases.browser.dlgopen.OpenFile("C:\\MyFolder\\MyFile.txt");
    • medha2016's avatar
      medha2016
      New Contributor

      thank you .. i was bit confused about using the systreeview object.. openfile worked...