GetText Function (DomElement)




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


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.


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.


Window link = FindBrowserApplication("/BrowserApplication")
String linkText = link.GetText()