Work with PDFText test objects

Relevant for: GUI tests and components

Add PDFText test objects to the object repository directly from a PDF application.

Add a PDFText test object

  1. In the Object Repository window, click the Add PDFText Object to Local toolbar button.

  2. In the Select Learn Mode dialog box, select the mode you want for learning the object (Automatic learn mode | Manual learn mode), and then select the text.

    Automatic learn mode

    The pointer changes to a pointing hand. Click on the text in the application.

    UFT One automatically detects the borders of the text, and takes a snapshot of it.

    This mode is the faster mode and should be satisfactory for PDFText test objects in most cases.

    Manual learn mode

    The pointer changes to a crosshair, with an adjacent circle displaying a magnified image of the area around the center of the crosshair.

    Example:  

    Take a snapshot of the text in the application, manually specifying the borders of the text.

    Use this mode in cases where the automatic mode does not correctly detect the borders of the text, such as when it selects an area of the application which is much larger than the area you want.

    By holding the left CTRL, you can temporarily change the pointing hand or crosshair to a standard pointer.

    This enables you to change the window focus or perform operations in UFT One or in your application.

    UFT One takes a snapshot of the text, and the Add PDFText Test Object dialog box opens.

  3. In the Add PDFText Test Object dialog box, you can:

    • Adjust the borders of the image saved with the test object in the object repository.

    • Take a new snapshot to replace the image entirely.

A new test object is added to the object repository, under the test object that represents the application or window that contains the text. The selected image is saved with the test object.

Back to top

Define a new PDFText test object

You can create a PDFText test object in the object repository by description, specifying the text to use to identify the object in the application.

Use the Define New Test Object button in the toolbar as described in Define a new test object.

In the Environment drop-down list, select PDF Windows. Then select the PDFText class and specify the properties to use for the object identification.

Back to top

Retrieve text from a PDFText test object

Use the PDFText.GetText method to retrieve text displayed on a PDFText test object.

Use this text for verification purposes, or as a way of differentiating between objects or states of the application.

For details, see the PDFText object in UFT One Object Model Reference for GUI Testing.

Back to top

Update PDFText test object details

Do any of the following to improve the readability and efficiency of your test or component:

  • Rename the test object to a name that describes the control it represents. (Recommended)

  • Move the test object within the test object hierarchy:

    If you place it under another test object...

    UFT One searches for the object in the application only within its parent test object.

    If you move the test object to be a top-level object... UFT One searches for the object anywhere on the screen.
  • Update description properties.

  • Modify the ordinal identifier created for the test object. For details, see Ordinal identifiers.

  • Define visual relation identifiers for the test object. For details, see Visual relation identifiers.

For more details, see Maintain test objects in an object repository.

Back to top

See also: