If element is present , run a set of steps if not run different steps

I have a scenario where there is a menu which can be expanded or can be minimized. When expanded it displays some icons and the name, but when minimized it displays only icons with tool tip. sometimes when we login to the application , this menu can be in expanded state or it can be minimized state.

All I want to do is when we login to the application and if the menu is minimized, verify the icons are present with tool tips and if its expanded verify the features accordingly. Can we achieve this without addons with recorded tests. If this element is present execute these set of steps , if not jump to these steps.

Hi @sravani.

You can use the logic in this example to achieve that:

Here I want to check if I am already logged in so I can perform some steps accordingly.

The first step - check if you are login by checking if an element exists (one that only exists when you are already login)

If the step fails (because the element is not found) run a recovery test which is a login test.

Thanks a lot, this solution worked, one quick question when we pull the main test cases to test Jobs, do we have to pull the recovery test also?


There is no need, they will be added automatically.

1 Like

This topic was automatically closed after 28 days. New replies are no longer allowed.