GetItemProp Function (HtmlList)

Class

HtmlList.

Action

Returns the value of the specified property at the specified position in the list item.

Availability

This functionality is supported only if you are using the Classic Agent.

Syntax

Prop = list.GetItemProp (Item, sPropName [, iLine, iCol])
Variable Description
Prop The value of the property. ANYTYPE.
Item The item in the list. LISTITEM.
sPropName The name of the property. STRING.
iLine Optional: The line of the list item containing the text you want the property value of. Default is 1. INTEGER.
iCol Optional: The position of the character (starting with 1) in the list item containing the text you want the property value of. Default is 1. INTEGER.

Notes

Use GetItemProp to get the value of a property for a specified position in a list item. 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 an 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 an RGB value (red, green, blue).

Examples

These examples use the list of used technologies in the About This Site page of the GMO Web application.

Example 1

The following example returns the font name of the fourth character, first line of the third item in the list UsedList:

STRING sFont
sFont = AboutPage.UsedList.GetItemProp(3,"$FontName", 1, 4)
Print (sFont)

// Result:
// Times New Roman

Example 2

You can pass in the return from GetItemPropList to get the values of all properties of an item, as shown in the following example.

LIST OF STRING lsProps
STRING sProp

// get list of properties
lsProps = AboutPage.UsedList.GetItemPropList()

// pass them one at a time to GetItemProp
for each sProp in lsProps
  Print ("{sProp}:{AboutPage.UsedList.GetItemProp(3,sProp)}")

// Result:
// $BackColor: White
// $FontName: Times New Roman
// $FontSize: 9
// $FontStyle: {}
// $TextColor: Black