Forum Discussion

Lampson's avatar
Lampson
Occasional Contributor
12 days ago

Missing the step to select an item in a dropdown in recording scripts

I'm trying to click a dropdown and select "Agent" in the dropdown(picture1.png, picture2.png), which will open a popup,but the record scripts doesn't list the step of selecting "Agent"(picture3.png).

Does anyone know what's going on with the tool ?

I tried to manually add object as well, but it doesn't work for any items in this dropdown.

  • The ClickItem action you're using will normally drop down a menu and select the specified item for you.  I use it routinely to accomplish that task.

    However, it's not compatible with all drop down menus/combo boxes.  In those cases, you'll need two actions.  As you suggested, the first action will be to click on the listbox to drop down the list.  The second action is to click on the desired item.  In both cases you'll use the "Click" action.  

    That should work once you get the correct objects selected with each action.

    • Lampson's avatar
      Lampson
      Occasional Contributor

      The problem is options in the dropdown seem invisible to the tool.  The click for any option in this dropdown is not recorded. I tried manually added on-screen action, either "Drag the target to point the object" or "Point and fix" doesn't work for these options, they both map to the whole dropdown. 

      • littlebear's avatar
        littlebear
        Contributor

        Here's two things you can try:

        1. If you can access the option using arrow keys, you can add a 'Keys' step that uses your 'whole dropdown' object, and set its input to '[Down][Down][Down][Down][Down][Down][Enter]'. This will get you to 'Agent', without having to map anything inside the box.

        2. If that doesn't work, the more complex idea would be to manually create the Namemapping object you are looking for. In the Namemapping file, add a new object and select something you know you don't have mapped. You can then take that object and change its selector to an xpath equal to this formula:

          the current xpath selector for your entire dropdown/div[7]

          or

          //div[@id='globalDropdownActionItems']//div[7]

          Once saved, try Highlighting the object, with the dropdown open. TestComplete should highlight the Agent (the seventh div object) and then you can set up a 'Click' step with that object.

         

        Good luck,

  • Good morning!

    For clarification, is the whole textbox object named 'Policy Actions'? For example, if you open the popup in your browser, then right click on your final test step in picture3.jpg and click Highlight, does it highlight the whole dropdown or just the 'Policy Actions' box?

    If it highlights the entire dropdown as the 'Policy Actions' object, it makes sense that clicking anywhere on it (even on other fields than 'Agent') would record as clicking on the 'Policy Actions' object.

    • Lampson's avatar
      Lampson
      Occasional Contributor

      No, the name of the whole textbox is not "Policy Action". "Policy Action" is the first value of the dropdown. When right click on the final step in picture3.jpg and click Highlight, it highlights the box, like picture1.jpg.

       

       

      • rraghvani's avatar
        rraghvani
        Champion Level 3

        Depending on the control, record actions may behave differently and may not pick up all your actions. Therefore, add a step, to click on the item that you want.

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    picture3.jpg shows that you are not selecting "Agent", you're selecting "Policy Actions"?

    • Lampson's avatar
      Lampson
      Occasional Contributor

      Actually I selected, but it's not recorded.

      • rraghvani's avatar
        rraghvani
        Champion Level 3

        Is this your first time using TestComplete?