aPropValue = text.GetTextProp (sPropName[, iLine, iCol])
Variable | Description |
---|---|
aPropValue | The value of the property. ANYTYPE. |
sPropName | The name of the property. STRING. |
iLine | Optional: The line containing the text you want the property value of. Default is 1. INTEGER. |
iCol | Optional: The position of the character (starting with 1) on iLine that you want the property value of. Default is 1. INTEGER. |
Use GetTextProp to get the value of a property for a specified character in a text object. These are the properties you can access:
Property | Type | Description |
---|---|---|
$BackColor | STRING | Background color: the name of the color if it matches one of the colors in the Table of colors of Silk Test Classic; otherwise a RGB value (red, green, blue). |
$FontName | STRING | Font name |
$FontSize | INTEGER | Font size in points |
$FontStyle | FONTSTYLE | Font style |
$TextColor | STRING | Text color: the name of the color if it matches one of the colors in the Table of colors of Silk Test Classic; otherwise a RGB value (red, green, blue). |
Silk Test Classic does not consider the <i> or <span> tags when they lie inside the <p> tag, only when they lie outside the paragraph tag.
The following example gets the font name of the fifteenth character of the description of sunglasses on the Products page of the GMO Web application.
ANYTYPE aVal aVal = ProductsPage.SunGlassesDesc.GetTextProp("$FontName",1,15) Print(aVal) // Result: // Times New Roman
Use the return from GetTextPropList to get the values of all properties of a character.
LIST OF STRING lsProps STRING sProp // get list of properties lsProps = ProductsPage.SunGlassesDesc.GetTextPropList() // pass them one at a time to GetTextProp for each sProp in lsProps Print("{sProp}:{ProductsPage.SunGlassesDesc.GetTextProp (sProp,1,15)}") // Result: // $BackColor: White // $FontName: Times New Roman // $FontSize: 12 // $FontStyle: {} // $TextColor: Black