Forum Discussion

shankar_r's avatar
shankar_r
Community Hero
8 years ago

Drag a file from Windows Explorer to AUT

Hi,   Scenario: Select a file from Windows Explorer, Click and Drag into AUT Grid. Upload dialog should be displayed.   I want to drag a file from Windows Explorer into my AUT grid.   Question...
  • shankar_r's avatar
    8 years ago

    Bingoo karthick7, I too followed the same post for this and found the solution.

     

    Solution:

     

    Adding DirectUIHWND class in MSAA, Text Recognition and UI Automation in Project properties.

     

    then,

     

    function testasdf()
    {
           fn_ClickaFilein_WE("test_file_01.txt")
    }
    function fn_ClickaFilein_WE(str_FileOrFolerName)
    {
          var WindowsExplorer = Aliases.WindowsExplorer.ContentPane;
          var arr_Items = null;
          
          fn_OpenWindowsExplorer(Project.Path + "Test_Files_Folders");//Custom function
          
          arr_Items = WindowsExplorer.FindAllChildren("ObjectType","ListItem")
          
          for(var i = 0 ; i < arr_Items.length ; i++)
          {
                if(aqString.Compare(aqConvert.VarToStr(arr_Items[i].value),str_FileOrFolerName,false) == 0)
                {
                      arr_Items[i].Click();
                      break; 
                }
          }   
    }

     

    Then I used Drag method.