MCPcopy Index your code
hub / github.com/AirtestProject/Poco / setattr

Method setattr

poco/proxy.py:744–761  ·  view source on GitHub ↗

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 attr

(self, name, val)

Source from the content-addressed store, hash-verified

742
743 @refresh_when(PocoTargetRemovedException)
744 def setattr(self, name, val):
745 """
746 Change the attribute value of the UI element. Not all attributes can be casted to text. If changing the
747 immutable attributes or attributes which do not exist, the InvalidOperationException exception is raised.
748
749 Args:
750 name: attribute name
751 val: new attribute value to cast
752
753 Raises:
754 InvalidOperationException: when it fails to set the attribute on UI element
755 """
756
757 nodes = self._do_query(multiple=False)
758 try:
759 return self.poco.agent.hierarchy.setAttr(nodes, name, val)
760 except UnableToSetAttributeException as e:
761 raise InvalidOperationException('"{}" of "{}"'.format(str(e), self))
762
763 @volatile_attribute
764 def exists(self):

Callers 1

set_textMethod · 0.95

Calls 3

_do_queryMethod · 0.95
setAttrMethod · 0.45

Tested by

no test coverage detected