How to use getAttribute with if condition


I have a scenario where I am fetching one button using find element, if that button exists then it goes to get attribute and save it in a variable viz msp.
But when the button exists then it is giving me this error

also, can I change msp data type from UiPath.element to some string or boolean so that I can use that ivariable information in my if condition.

Thanks in advance

You can use the element exist activity. The boolean output of this activity can be further used in the if condition. Then you can simply use the get full text activity to get the button text.
Hope this helps…
Please mark it as solution if it helped you…


I cannot find element exists activity in modern interface.


Modern activity is check app state …

Or you can always select activities → filter icon → show classic then element exists will be available


In one of the properties of Get Attribute you are using the wrong datatype. That’s why it says it cannot convert from string.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.