Forum Discussion

MarcusBe's avatar
MarcusBe
Occasional Contributor
25 days ago

Unable to click second item/object in File Explorer

Hello ! I just want the test automation to navigate to second folder (RT1.0) in this case, it is always changing name so cant go on that.

I tried using keyboard nagivation but sometimes it goes to the bottom if i just have Down + Enter keys. Am i doing something wrong? or why is it so inconsistent, im using keyword tests if that helps.

 

Thankful for help !

4 Replies

  • MarcusBe's avatar
    MarcusBe
    Occasional Contributor

    Found a workaround that works for now, had to do "End" keyboard input, down arrow and enter.

    • Hassan_Ballan's avatar
      Hassan_Ballan
      Icon for Champion Level 3 rankChampion Level 3

      The inconsistency happens because File Explorer sometimes isn’t focused when the keys are sent. You can fix this directly in your Keyword Test with a simple, stable sequence:

      1. Click on a fixed folder (e.g. BAS-Extra) to set focus.
      2. Delay – 500 to 1000 ms (wait for Explorer to stabilize).
      3. Keys – Down (move to the next folder).
      4. Delay – 300 ms.
      5. Keys – Enter (open it).

      This gives Explorer a reliable starting point and ensures the second folder is opened consistently.

      🤖 AI-assisted response
      👍 Found it helpful? Click Like
      ✅ Issue resolved? Click Mark as Solution

      • Hassan_Ballan's avatar
        Hassan_Ballan
        Icon for Champion Level 3 rankChampion Level 3

        Another idea:

        If the folder name changes but it’s always the second item, you can avoid keyboard timing issues by clicking it directly through the File Explorer object. For example:

        let explorer = Sys.Process("explorer");
        let list = explorer.Window("CabinetWClass").Window("DirectUIHWND");
        list.Child(1).DblClick(); // Opens the 2nd folder
        

        This skips the need for focus or delays and stays stable even if folder names change.
        You can also wrap it in a small routine and call it from your keyword test.

        🤖 AI-assisted response
        👍 Found it helpful? Click Like
        ✅ Issue resolved? Click Mark as Solution

    • rraghvani's avatar
      rraghvani
      Icon for Champion Level 3 rankChampion Level 3

      A better approach is to enable MSAA (Project Settings -> Open Applications -> MSAA), this will expose all controls of Explorer. You can then search for the appropriate item, in this example,  List("Items View") such as List("Items View").ListItem("Extensions") and perform e.g. a double click, to go into the folder of Extensions.

      Contents of folder C:\Program Files (x86)\SmartBear\TestComplete 15\x64\Bin

      The above picture shows all controls of Explorer, exposed to TC, which you can interact with. You don't have to take into account the ordering of items, you just call the appropriate method to perform the action you require.