Convert UiElement to Boolean

Hello guys,
I need to convert a Ui element to Boolean, does anyone know how I can do it?

please someone help me. I would be very grateful

@momi_fede

You can’t convert a string or ui element to a boolean, but you can return Boolean value based on some conditions.

Example,
Stringa.Contains(“abc”)
If Stringa contains abc then it will return True else False.

Regards,
Mahesh

I’m sorry but I do not know how to do “return” activity

@momi_fede

Can you please tell your requirement.

Regards,
Mahesh

If you have “False” or “True” stored in a string variable, you can use vb to convert it with CBool()

CBool("False")

Also, like what was mentioned, you can use any variable in a condition.

If activity: string = "False"

You can also use the ElementExists activity to get a boolean with the output property.
Just simply place the UiElement variable in the element property and it will give you False or True.

I hope this helps.

Regards.

5 Likes