@refresh_when(PocoTargetRemovedException)<EOL><INDENT>def setattr(self, name, val):<DEDENT>
nodes = self._do_query(multiple=False)<EOL>try:<EOL><INDENT>return self.poco.agent.hierarchy.setAttr(nodes, name, val)<EOL><DEDENT>except UnableToSetAttributeException as e:<EOL><INDENT>raise InvalidOperationException('<STR_LIT>'.format(str(e), self))<EOL><DEDENT>
Change the attribute value of the UI element. Not all attributes can be casted to text. If changing the
immutable attributes or attributes which do not exist, the InvalidOperationException exception is raised.

Args:
    name: attribute name
    val: new attribute value to cast

Raises:
    InvalidOperationException: when it fails to set the attribute on UI element