Working with Dynamic Content

Q: How can I record and run components on objects that change dynamically from viewing to viewing?

Sometimes the content of objects in a Web page or application changes due to dynamic content. You can create dynamic descriptions of these objects so that QuickTest will recognize them when it runs the test.

Q: How can I check that a child window exists (or does not exist)?

Sometimes a link in one window creates another window.

You can use the Exist property to check whether or not a window exists. For example:

Browser("Window_name").Exist

You can also use the ChildObjects method to retrieve all child objects (or the subset of child objects that match a certain description) on the Desktop or within any other parent object.

For more information on the Exist property and ChildObjects method, refer to the QuickTest Professional Object Model Reference.

Q: How does QuickTest record on dynamically generated URLs and Web pages?

QuickTest actually clicks links as they are displayed on the page. Therefore, QuickTest records how to find a particular object, such as a link on the page, rather than the object itself. For example, if the link to a dynamically generated URL is an image, then QuickTest records the "IMG" HTML tag, and the name of the image. This enables QuickTest to find this image in the future and click on it.

Working with Function Libraries

Q: Can I store functions and subroutines in a function library?

You can create one or more VBScript function libraries containing your functions, and then use them in any component.

You can register your functions as methods for QuickTest test objects. Your registered methods can override the functionality of an existing test object method for the duration of a run session, or you can register a new method for a test object class.

Recording and Running Tests

  • How does QuickTest capture user processes in Web pages?

QuickTest hooks the Microsoft Internet Explorer browser. As the user navigates the Web-based application, QuickTest records the user actions. (For information about modifying which user actions are recorded. QuickTest can then run the component by running the steps as they originally occurred.

  • How can I record on objects or environments not supported by QuickTest?

You can do this in a number of ways:

    • By default, QuickTest supports several developmental environments. You can also enable support for additional environments, such as Java, Oracle, .NET, SAP Solutions, Siebel, PeopleSoft, terminal emulators, and Web services, by installing and loading any of the external add-ins that are available for QuickTest Professional.
    • You can map objects of an unidentified or custom class to standard Windows classes.

Identifying an Object Using the Index Property

While learning an object, QuickTest can assign a value to the test object's Index property to uniquely identify the object. The value is based on the order in which the object appears within the source code. The first occurrence is 0.

Index property values are object-specific. Therefore, if you use Index:=3 to describe a WebEdit test object, QuickTest searches for the fourth WebEdit object in the page. However, if you use Index:=3 to describe a WebElement object, QuickTest searches for the fourth Web object on the page—regardless of the type—because the WebElement object applies to all Web objects.

For example, suppose a page contains the following objects:

  • an image with the name Apple
  • an image with the name UserName
  • a WebEdit object with the name UserName
  • an image with the name Password
  • a WebEdit object with the name Password

The following statement refers to the third item in the list, as this is the first WebEdit object on the page with the name UserName:

WebEdit("Name:=UserName", "Index:=0")

In contrast, the following statement refers to the second item in the list, as that is the first object of any type (WebElement) with the name UserName:

WebElement("Name:=UserName", "Index:=0")