Handling Menu item toggling +/-

On visiting an application, we need to click thru a menu tree to reach an item to click (open a form/page)

Ex.

+Menu A ( +, so click to expand)
+Sub Menu A.1 (+, so click to expand)
Form Item to click

This is relatively easy to automate however sometime menu tree may already be exploded/expanded

-Menu A (-, already expanded no need to expand)
-Sub Menu A.1 (-, already expanded no need to expand)
Item to click
or
-Menu A (-, already expanded no need to expand)
+Sub Menu A.1 (+, click to expand)
Item to click
or
+Menu A (+, so click to expand)
-Sub Menu A.1 (-, already expanded no need to expand)
Item to click

How can this be achieved ?

Hi,

Handling such menu items vary from different website. If the website you are using is not confidential and you can share then please share it.

However For +/- you identify if the by its attributes likes class this will definietly vary for both. And for that you can Element Exist and some if conditions activity to check what is the current status for this element and proceed further.

Just for an example see the behavior of expendable menu items of website Expanding and Collapsing Tree View Items in Desktop Windows Applications | TestComplete Documentation

You can see if the menu item is collapased then for + class is different and for - class is different. Please see screenshots below:

Hope this help.

Thanks.

Shenki