Most UI elements have a standard role, defined in enum ERole (except None and Custom). Some UI elements have a custom role, usually as string; then returns ERole.Custom.
All UI elements must support this property. If failed, probably the elm is invalid, for example the window is closed.