Exemple #1
0
 def setAttr(self, attrName, val):
     attrs = self.Control.getAttributes()
     if attrName != 'text':
         raise UnableToSetAttributeException(attrName, self)
     else:
         if 'AXValue' in attrs:
             self.Control.AXValue = val
         else:
             raise UnableToSetAttributeException(attrName, self)
Exemple #2
0
 def setAttr(self, attrName, val):
     if attrName != 'text':
         raise UnableToSetAttributeException(attrName, self)
     else:
         if ((isinstance(self.Control, UIAuto.ValuePattern)
              and self.Control.IsValuePatternAvailable())):
             self.Control.SetValue(val)
             return True
         else:
             raise UnableToSetAttributeException(attrName, self)
Exemple #3
0
 def setAttr(self, node, attrName, attrVal):
     if attrName == 'text':
         if type(node) in (list, tuple):
             node = node[0]
         instance_id = node.getAttr('_instanceId')
         if instance_id:
             success = self.client.call('SetText', instance_id, attrVal)
             if success:
                 return True
     raise UnableToSetAttributeException(attrName, node)
Exemple #4
0
    def setAttr(self, attrName, val):
        """
        Apply changes of the attribute value to this node. Not all attributes can be modified. The most common
        attribute to be modified is the `text`. It is not recommended to modify attributes such as position, name,
        their modifications can lead to unexpected and false-positive errors.

        Args:
            attrName (:obj:`str`): attribute name
            val: attribute value

        See Also:
            :py:meth:`setAttr <poco.sdk.interfaces.hierarchy.HierarchyInterface.setAttr>` in
             ``poco.sdk.interfaces.hierarchy``
        """

        raise UnableToSetAttributeException(attrName, None)
Exemple #5
0
 def setAttr(self, attrName, val):
     # cannot set any attributes on local nodes
     raise UnableToSetAttributeException(attrName, self.node)
Exemple #6
0
 def SetText(self, id, val2):
     control = UIAuto.ControlFromHandle(id)
     if not control or not isinstance(val2, string_types):
         raise UnableToSetAttributeException("text", control)
     else:
         control.SetValue(val2)