Testing Text in Web Applications

Classic Agent

Straight text in a Web application can be in the following classes:

  • HtmlHeading
  • HtmlText

Silk Test Classic provides methods for getting the text and all its properties, such as color, font, size, and style.

There are also classes for text in Java applets and applications.

Classic Agent Example

For example, the following code gets the copyright text on a sample Web page:
STRING sText
sText = Acme.Copyright.GetText ()
Print (sText)

Result:
Copyright © 2006 Acme Software, Inc. All rights reserved.

Open Agent

When you are using the Open Agent, use the GetText() method to get text out of every DomElement control.

Open Agent Example

For example, the following code gets the text of a DomLink control:
Window link = FindBrowserApplication("/BrowserApplication")
																					.FindBrowserWindow("//BrowserWindow")
                     .FindDomLink("A[@id='story2128000']")
String linkText = link.GetText()
print(linkText)