Class AttributeDescriptor
A descriptor for element attributes.
public class AttributeDescriptor : Descriptor, IEquatable<Descriptor>, IComparable<Descriptor>
- Inheritance
-
AttributeDescriptor
- Implements
- Inherited Members
Constructors
AttributeDescriptor(string, string, Type, int)
Creates a new (read-only) element attribute descriptor.
public AttributeDescriptor(string name, string description, Type valueType, int weight)
Parameters
namestringThe name of the attribute. This should be CamelCased.
descriptionstringA short description of the attribute.
valueTypeTypeThe type of the attribute. This type should provide a useful ToString() implementation.
weightintThe weight of this attribute in the context of the element. If the weight is <100 it is not used in the RanorexPath.
Remarks
The created attribute descriptor is read-only and its TruncationLength is set to Int32.MaxValue.
AttributeDescriptor(string, string, Type, int, bool)
Creates a new element attribute descriptor.
public AttributeDescriptor(string name, string description, Type valueType, int weight, bool readOnly)
Parameters
namestringThe name of the attribute. This should be CamelCased.
descriptionstringA short description of the attribute.
valueTypeTypeThe type of the attribute. This type should provide a useful ToString() implementation.
weightintThe weight of this attribute in the context of the element. If the weight is <100 it is not used in the RanorexPath.
readOnlyboolSpecifies whether the attribute value is read-only.
Remarks
The TruncationLength of the created attribute descriptor is set to Int32.MaxValue.
AttributeDescriptor(string, string, Type, int, bool, int)
Creates a new element attribute descriptor.
public AttributeDescriptor(string name, string description, Type valueType, int weight, bool readOnly, int truncationLength)
Parameters
namestringThe name of the attribute. This should be CamelCased.
descriptionstringA short description of the attribute.
valueTypeTypeThe type of the attribute. This type should provide a useful ToString() implementation.
weightintThe weight of this attribute in the context of the element. If the weight is <100 it is not used in the RanorexPath.
readOnlyboolSpecifies whether the attribute value is read-only.
truncationLengthintSpecifies the TruncationLength for this instance.
Properties
Container
Gets the capability containing this attribute.
public Capability Container { get; }
Property Value
ReadOnly
Gets a value specifying if the attribute value is read-only.
public bool ReadOnly { get; }
Property Value
TruncationLength
Gets or sets the maximum length of the string representation of an attribute value when used in RxPaths. If the length of the string representation of the attribute value is greater than this value, the string representation is truncated at the next word boundary (extending truncation length up to 100% of the configured value) and converted to a StartsWith expression.
public int TruncationLength { get; set; }
Property Value
- int
The maximum length of the string representation of the attribute value when used in RxPaths. Default is
int.MaxValue, i.e. by default truncating is disabled.
Remarks
If you set this value to -1, the MaxMatchTextLen will
be used as truncation length for this attribute.
ValueType
The type of the attribute value. The type should provide a useful ToString() implementation, and additionally, a useful explicit cast from string.
public Type ValueType { get; }
Property Value
Methods
ResolveWeight(Element)
Resolves the weight.
public int ResolveWeight(Element elem)
Parameters
elemElementThe element to resolve the weight for. Can be null.
Returns
- int
The dynamic weight of the attribute.
Remarks
A weight smaller than 100 is not used in RanorexPath and should be used for transient values.
Events
GlobalWeightResolving
Occurs when the weight for any registered attribute needs to be resolved. Intended to be used by plugins to dynamically change weights based on context.
public static event EventHandler<AttributeDescriptor.WeightResolvingEventArgs> GlobalWeightResolving
Event Type
WeightResolving
Occurs when the weight for this attribute needs to be resolved. Intended to be used by plugins to dynamically change weights based on context.
public event EventHandler<AttributeDescriptor.WeightResolvingEventArgs> WeightResolving