GetText Function (DomElement)

Class

DomElement.

Action

Returns the specified text in the first line of the object or the full text of the object.

Syntax

sText = object.GetText ([iStartChar, iNumChars, bFullText])
Variable Description
sText The text. STRING.
iStartChar Optional: The position in the text (starting with 1) of the first character to return. Default is 1. INTEGER.
iNumChars Optional: The number of characters to return. Default is all characters after iStartChar. INTEGER.
bFullText Optional: If TRUE, returns the full text of the object. If FALSE (the default), returns the first line. BOOLEAN.

Notes

The GetText function returns the specified text in the first line of an object. Calling GetText with no arguments returns the entire first line of text. GetText returns up to 1023 characters.

GetText with the DOM extension returns the first line as defined by any line break characters such as <BR>. GetText always returns the same value regardless of browser size, font size, or browser. This happens because the DOM does not offer a visual interpretation of browser content and therefore Silk Test Classic has no way of knowing where the line break appears on the screen.

Example

Window link = FindBrowserApplication("/BrowserApplication")
																					.FindBrowserWindow("//BrowserWindow")
                     .FindDomLink("A[@id='story2128000']")
String linkText = link.GetText()
print(linkText)