TestProject Forum

How to let TestProject click only when some element exist or not exist?

I need to click a menu to unfold the sub-menu, but if I click it again, the menu will fold and the sub-menu disappeared. How can I let TestProject click the menu only the sub-menu hasn’t show up.

Hi @hanshwang .

To achieve that, please try following these steps:

  • Add a step that gets the text from one of the sub-menu’s options using the action “Get text(if visible)” , and store the text into a parameter, like this:

  • Then, add a step that clicks on the menu button, like this:

  • Finally, open the click step that you just created, and add there a condition that the text you got before must be null. Like this:

Let me know if you still need any help :slight_smile:

Kind regards,
Ricardo.

great! it works for me.
thank you very much.

And, I have a requirement, I think will be very useful:
for the verification of “is present” or “is visible” etc.
can we add a boolean output that shows the result?
Thus, I can use the output result as an input condition for the following test step

thanks