com.hp.lft.sdk

Interface TestObject

    • Method Summary

      Modifier and TypeMethod and Description
      booleanexists()
      Checks whether this object exists in the AUT before the UFT Developer object synchronization timeout elapses.
      booleanexists(java.lang.Integer timeout)
      Checks whether this object exists in the AUT before the specified timeout elapses.
      <TChild extends TestObject>
      TChild[]
      findChildren(java.lang.Class<TChild> type, Description description)
      Returns all the child test objects that match the specified test object type and description filter.
      DescriptiongetDescription()
      Returns a clone of the description for this test object (the test object must be obtained using the describe method, otherwise, this method returns null).
      java.lang.StringgetDisplayName()
      Returns the object display name defined in the Application Model.
      TestObjectgetParent()
      Returns the parent test object of this test object (the child object must be obtained using the describe method, otherwise, this method returns null).
      java.awt.image.RenderedImagegetSnapshot()
      Captures a bitmap of this test object and returns a RenderedImage of it.
      java.awt.Rectangle[]getTextLocations(java.lang.String textToFind)
      Returns all rectangular areas containing the specified text within this object.
      java.awt.Rectangle[]getTextLocations(java.lang.String textToFind, java.awt.Rectangle textArea)
      Returns all rectangular areas within the supplied rectangle that contain the specified text.
      java.lang.StringgetVisibleText()
      Returns all visible text from this object.
      java.lang.StringgetVisibleText(java.awt.Rectangle textArea)
      Returns all visible text within the supplied rectangle.
      voidhighlight()
      Highlights this object in the AUT.
      <TChild extends TestObject>
      int
      highlightMatches(java.lang.Class<TChild> type, Description description)
      Highlights all children that match the the specified test object type and description filter.
      voidsetDescription(Description description)
      Replaces this test object's description with the supplied description.
      voidsetDisplayName(java.lang.String displayName)
      Sets the object display name defined in the Application Model.
      java.awt.PointverifyImageExists(java.awt.image.RenderedImage imageToFind)
      Checks whether a snapshot of this object contains an exact match of the supplied image.
      java.awt.PointverifyImageExists(java.awt.image.RenderedImage imageToFind, byte similarity)
      Checks whether a snapshot of this object contains the supplied image.

      When this method returns a false value, the step fails, but the failure does not throw an exception or cause the test to stop running.
      booleanverifyImageMatch(java.awt.image.RenderedImage expectedImage)
      Checks whether a snapshot of this object is identical to the supplied image.
      booleanverifyImageMatch(java.awt.image.RenderedImage expectedImage, byte pixelTolerance)
      Checks whether a snapshot of this object and the supplied image are a match, given the specified pixel tolerance value.
      booleanverifyImageMatch(java.awt.image.RenderedImage expectedImage, byte pixelTolerance, byte rgbTolerance)
      Checks whether a snapshot of this object and the supplied image are a match, given the specified pixel and RGB tolerance values.
      booleanverifyImageMatch(java.awt.image.RenderedImage expectedImage, ImageMaskArea maskArea)
      Checks whether the defined mask areas within the object snapshot and the supplied image are identical.
      booleanverifyImageMatch(java.awt.image.RenderedImage expectedImage, ImageMaskArea maskArea, byte pixelTolerance)
      Checks whether the defined mask areas within the object snapshot and the supplied image match, given the specified pixel tolerance values.
      booleanverifyImageMatch(java.awt.image.RenderedImage expectedImage, ImageMaskArea maskArea, byte pixelTolerance, byte rgbTolerance)
      Checks whether the defined mask areas within the object snapshot and the supplied image match, given the specified pixel and RGB tolerance values.
      booleanwaitUntilExists()
      Waits until this test object exists or the UFT Developer object synchronization timeout elapses.
      booleanwaitUntilExists(int totalTimeOutInSeconds)
      Waits until this test object exists or until the specified timeout elapses.
    • Method Detail

      • getParent

                                                    TestObject getParent()
        Returns the parent test object of this test object (the child object must be obtained using the describe method, otherwise, this method returns null).
        Returns:
        the parent test object of this test object.
      • getDescription

                                                    Description getDescription()
                            throws GeneralLeanFtException
        Returns a clone of the description for this test object (the test object must be obtained using the describe method, otherwise, this method returns null). For example, if the test object is a WebElement, the Parent is the IFrame or IBrowser test object that contains it.
        Returns:
        a clone of the description that was used in order to describe the current test object instance.
        Throws:
        GeneralLeanFtException - if an error occurs during execution.
      • setDescription

        void setDescription(Description description)
                     throws GeneralLeanFtException
        Replaces this test object's description with the supplied description.
        Parameters:
        description - the new Description for this test object. (A clone of the description is used.)
        Throws:
        GeneralLeanFtException - if an error occurs during execution.
      • exists

        boolean exists()
                throws GeneralLeanFtException
        Checks whether this object exists in the AUT before the UFT Developer object synchronization timeout elapses.
        Returns:
        true if the object is found in the AUT before the timeout; false, otherwise.
        Throws:
        GeneralLeanFtException - if an error occurs during execution.
      • exists

        boolean exists(java.lang.Integer timeout)
                throws GeneralLeanFtException
        Checks whether this object exists in the AUT before the specified timeout elapses. Wait only the specified amount of time in the timeout parameter.
        Parameters:
        timeout - the time (in seconds) to wait for this object before returning the true or false result.
        Returns:
        true if the object is found in the AUT before the specified timeout; false, otherwise.
        Throws:
        GeneralLeanFtException - if an error occurs during execution.
      • findChildren

        <TChild extends TestObject> TChild[] findChildren(java.lang.Class<TChild> type,
                                                          Description description)
                                                   throws GeneralLeanFtException,
                                                          java.lang.CloneNotSupportedException
        Returns all the child test objects that match the specified test object type and description filter.
        For example, you can use this method to retrieve all Web buttons on a Page with type="submit".
        Type Parameters:
        TChild - the generic type of the child test object.
        Parameters:
        type - the test object interface type to find. To avoid limiting to a specific test object type, use TestObject.
        description - a description containing the set of properties and values that should be common to all objects that are returned.
        Returns:
        an array of child test objects.
        Throws:
        GeneralLeanFtException - if an error occurs during execution.
        java.lang.CloneNotSupportedException - in case description.clone() fails.
      • highlightMatches

        <TChild extends TestObject> int highlightMatches(java.lang.Class<TChild> type,
                                                         Description description)
                                                  throws GeneralLeanFtException,
                                                         java.lang.CloneNotSupportedException
        Highlights all children that match the the specified test object type and description filter.
        Type Parameters:
        TChild - the generic type of the child test object.
        Parameters:
        type - The test object interface type to highlight. To avoid limiting to a specific test object type, use TestObject.
        description - A description containing the set of properties and values that is common to all objects to be are highlighted.
        Returns:
        the number of object that match the provided description and were highlighted.
        Throws:
        GeneralLeanFtException - if an error occurs during execution.
        java.lang.CloneNotSupportedException - in case description.clone() fails.
      • getSnapshot

        java.awt.image.RenderedImage getSnapshot()
                                          throws GeneralLeanFtException
        Captures a bitmap of this test object and returns a RenderedImage of it.
        Returns:
        a RenderedImage of the captured test object.
        Throws:
        GeneralLeanFtException - if an error occurs during execution.
      • getDisplayName

        java.lang.String getDisplayName()
        Returns the object display name defined in the Application Model.
        Returns:
        the object display name.
      • setDisplayName

        void setDisplayName(java.lang.String displayName)
        Sets the object display name defined in the Application Model.
        Parameters:
        displayName - the object display name.
      • getVisibleText

        java.lang.String getVisibleText()
                                 throws GeneralLeanFtException
        Returns all visible text from this object.
        Returns:
        all visible text from this object.
        Throws:
        GeneralLeanFtException - if an error occurs during execution.
      • getVisibleText

        java.lang.String getVisibleText(java.awt.Rectangle textArea)
                                 throws GeneralLeanFtException
        Returns all visible text within the supplied rectangle.
        Parameters:
        textArea - an inner rectangle within this object.
        Returns:
        all visible text within the supplied rectangle.
        Throws:
        GeneralLeanFtException - if an error occurs during execution.
      • getTextLocations

        java.awt.Rectangle[] getTextLocations(java.lang.String textToFind)
                                       throws GeneralLeanFtException
        Returns all rectangular areas containing the specified text within this object.
        Parameters:
        textToFind - the text string to find.
        Returns:
        all rectangular areas containing the specified text within this object.
        Throws:
        GeneralLeanFtException - if an error occurs during execution.
      • getTextLocations

        java.awt.Rectangle[] getTextLocations(java.lang.String textToFind,
                                              java.awt.Rectangle textArea)
                                       throws GeneralLeanFtException
        Returns all rectangular areas within the supplied rectangle that contain the specified text.
        Parameters:
        textToFind - the text string to find.
        textArea - an inner rectangle within this object.
        Returns:
        all rectangular areas within the supplied rectangle that contain the specified text.
        Throws:
        GeneralLeanFtException - if an error occurs during execution.
      • verifyImageExists

        java.awt.Point verifyImageExists(java.awt.image.RenderedImage imageToFind)
                                  throws GeneralLeanFtException
        Checks whether a snapshot of this object contains an exact match of the supplied image.
        When this method returns a false value, the step fails, but the failure does not throw an exception or cause the test to stop running.
        Parameters:
        imageToFind - the image to locate in the sourceImage
        Returns:
        the Point where the image was located, or null if it was not found.
        Throws:
        GeneralLeanFtException - if an error occurs during execution.
      • verifyImageExists

        java.awt.Point verifyImageExists(java.awt.image.RenderedImage imageToFind,
                                         byte similarity)
                                  throws GeneralLeanFtException
        Checks whether a snapshot of this object contains the supplied image.

        When this method returns a false value, the step fails, but the failure does not throw an exception or cause the test to stop running.
        Parameters:
        imageToFind - the image to look for within the test object's snapshot.
        similarity - the minimum similarity between the two images (as a percentage), above which the find is considered a match.
        Returns:
        the Point where the image was located, or null if it was not found.
        Throws:
        GeneralLeanFtException - if an error occurs during execution.
      • verifyImageMatch

        boolean verifyImageMatch(java.awt.image.RenderedImage expectedImage)
                          throws GeneralLeanFtException
        Checks whether a snapshot of this object is identical to the supplied image.
        When this method returns a false value, the step fails, but the failure does not throw an exception or cause the test to stop running.
        Parameters:
        expectedImage - the image to compare to the test object snapshot.
        Returns:
        true if the images are identical, else false.
        Throws:
        GeneralLeanFtException - if an error occurs during execution.
      • verifyImageMatch

        boolean verifyImageMatch(java.awt.image.RenderedImage expectedImage,
                                 byte pixelTolerance)
                          throws GeneralLeanFtException
        Checks whether a snapshot of this object and the supplied image are a match, given the specified pixel tolerance value.
        When this method returns a false value, the step fails, but the failure does not throw an exception or cause the test to stop running.
        Parameters:
        expectedImage - the image to compare to the test object snapshot.
        pixelTolerance - the percentage of pixels that can differ between the two images, and still be considered a match.
        Returns:
        true if the images match within the specified tolerance, else false.
        Throws:
        GeneralLeanFtException - if an error occurs during execution.
      • verifyImageMatch

        boolean verifyImageMatch(java.awt.image.RenderedImage expectedImage,
                                 byte pixelTolerance,
                                 byte rgbTolerance)
                          throws GeneralLeanFtException
        Checks whether a snapshot of this object and the supplied image are a match, given the specified pixel and RGB tolerance values.
        When this method returns a false value, the step fails, but the failure does not throw an exception or cause the test to stop running.
        Parameters:
        expectedImage - the image to compare to the test object snapshot.
        pixelTolerance - the percentage of pixels that can differ between the two images, and still be considered a match.
        rgbTolerance - the percent by which the RGB values of the pixels in the two images can differ, and still be considered a match.
        Returns:
        true if the images match within the specified tolerances, else false.
        Throws:
        GeneralLeanFtException - if an error occurs during execution.
      • verifyImageMatch

        boolean verifyImageMatch(java.awt.image.RenderedImage expectedImage,
                                 ImageMaskArea maskArea)
                          throws GeneralLeanFtException
        Checks whether the defined mask areas within the object snapshot and the supplied image are identical.
        When this method returns a false value, the step fails, but the failure does not throw an exception or cause the test to stop running.
        Parameters:
        expectedImage - the image to compare to the test object snapshot.
        maskArea - the mask area within the two images to use for the comparison.
        Returns:
        true if the mask areas within the images are identical and the two full images are the same size, else false.
        Throws:
        GeneralLeanFtException - if an error occurs during execution.
      • verifyImageMatch

        boolean verifyImageMatch(java.awt.image.RenderedImage expectedImage,
                                 ImageMaskArea maskArea,
                                 byte pixelTolerance)
                          throws GeneralLeanFtException
        Checks whether the defined mask areas within the object snapshot and the supplied image match, given the specified pixel tolerance values.
        When this method returns a false value, the step fails, but the failure does not throw an exception or cause the test to stop running.
        Parameters:
        expectedImage - the image to compare to the test object snapshot.
        maskArea - the mask area within the two images to use for the comparison.
        pixelTolerance - the percentage of pixels that can differ between the two images, and still be considered a match.
        Returns:
        true if the mask areas within the images match and the two full images are the same size, else false.
        Throws:
        GeneralLeanFtException - if an error occurs during execution.
      • verifyImageMatch

        boolean verifyImageMatch(java.awt.image.RenderedImage expectedImage,
                                 ImageMaskArea maskArea,
                                 byte pixelTolerance,
                                 byte rgbTolerance)
                          throws GeneralLeanFtException
        Checks whether the defined mask areas within the object snapshot and the supplied image match, given the specified pixel and RGB tolerance values.
        When this method returns a false value, the step fails, but the failure does not throw an exception or cause the test to stop running.
        Parameters:
        expectedImage - the image to compare to the test object snapshot.
        maskArea - the mask area within the two images to use for the comparison.
        pixelTolerance - the percentage of pixels that can differ between the two images, and still be considered a match.
        rgbTolerance - the percent by which the RGB values of the pixels in the two images can differ, and still be considered a match.
        Returns:
        true if the mask areas within the images match and the two full images are the same size, else false.
        Throws:
        GeneralLeanFtException - if an error occurs during execution.
      • Method Detail

        • getParent

          TestObject getParent()
          Returns the parent test object of this test object (the child object must be obtained using the describe method, otherwise, this method returns null).
          Returns:
          the parent test object of this test object.
        • getDescription

          Description getDescription()
                              throws GeneralLeanFtException
          Returns a clone of the description for this test object (the test object must be obtained using the describe method, otherwise, this method returns null). For example, if the test object is a WebElement, the Parent is the IFrame or IBrowser test object that contains it.
          Returns:
          a clone of the description that was used in order to describe the current test object instance.
          Throws:
          GeneralLeanFtException - if error occurs during execution
        • exists

          boolean exists()
                  throws GeneralLeanFtException
          Checks whether this object exists in the AUT before the UFT Developer object synchronization timeout elapses.
          Returns:
          true if the object is found in the AUT before the timeout; false, otherwise.
          Throws:
          GeneralLeanFtException - if error occurs during execution
        • exists

          boolean exists(Integer timeout)
                  throws GeneralLeanFtException
          Checks whether this object exists in the AUT before the specified timeout elapses. Wait only the specified amount of time in the timeout parameter.
          Parameters:
          timeout - the time (in seconds) to wait for this object before returning the true or false result.
          Returns:
          true if the object is found in the AUT before the specified timeout; false, otherwise.
          Throws:
          GeneralLeanFtException - if error occurs during execution
        • findChildren

          <TChild extends TestObject> TChild[] findChildren(Class<TChild> type,
                                                            Description description)
                                                     throws GeneralLeanFtException,
                                                            CloneNotSupportedException
          Returns all the child test objects that match the specified test object type and description filter.
          For example, you can use this method to retrieve all Web buttons on a Page with type="submit".
          Type Parameters:
          TChild - the generic type of the child test object.
          Parameters:
          type - the test object interface type to find. To avoid limiting to a specific test object type, use TestObject.
          description - a description containing the set of properties and values that should be common to all objects that are returned.
          Returns:
          an array of child test objects.
          Throws:
          GeneralLeanFtException - if error occurs during execution
          CloneNotSupportedException - in case description.clone() fails.
        • highlightMatches

          <TChild extends TestObject> int highlightMatches(Class<TChild> type,
                                                           Description description)
                                                    throws GeneralLeanFtException,
                                                           CloneNotSupportedException
          Highlights all children that match the the specified test object type and description filter.
          Type Parameters:
          TChild - the generic type of the child test object.
          Parameters:
          type - The test object interface type to highlight. To avoid limiting to a specific test object type, use TestObject.
          description - A description containing the set of properties and values that is common to all objects to be are highlighted.
          Returns:
          the number of object that match the provided description and were highlighted.
          Throws:
          GeneralLeanFtException - if error occurs during execution
          CloneNotSupportedException - in case description.clone() fails.
        • getDisplayName

          String getDisplayName()
          Returns the object display name defined in the Application Model.
          Returns:
          the object display name.
        • setDisplayName

          void setDisplayName(String displayName)
          Sets the object display name defined in the Application Model.
          Parameters:
          displayName - the object display name.
        • getVisibleText

          String getVisibleText(Rectangle textArea)
                         throws GeneralLeanFtException
          Returns all visible text within the supplied rectangle.
          Parameters:
          textArea - an inner rectangle within this object.
          Returns:
          all visible text within the supplied rectangle.
          Throws:
          GeneralLeanFtException - if error occurs during execution
        • getTextLocations

          Rectangle[] getTextLocations(String textToFind)
                                throws GeneralLeanFtException
          Returns all rectangular areas containing the specified text within this object.
          Parameters:
          textToFind - the text string to find.
          Returns:
          all rectangular areas containing the specified text within this object.
          Throws:
          GeneralLeanFtException - if error occurs during execution
        • getTextLocations

          Rectangle[] getTextLocations(String textToFind,
                                       Rectangle textArea)
                                throws GeneralLeanFtException
          Returns all rectangular areas within the supplied rectangle that contain the specified text.
          Parameters:
          textToFind - the text string to find.
          textArea - an inner rectangle within this object.
          Returns:
          all rectangular areas within the supplied rectangle that contain the specified text.
          Throws:
          GeneralLeanFtException - if error occurs during execution
        • verifyImageExists

          Point verifyImageExists(RenderedImage imageToFind)
                           throws GeneralLeanFtException
          Checks whether a snapshot of this object contains an exact match of the supplied image.
          When this method returns a false value, the step fails, but the failure does not throw an exception or cause the test to stop running.
          Parameters:
          imageToFind - the image to locate in the sourceImage
          Returns:
          the Point where the image was located, or null if it was not found.
          Throws:
          GeneralLeanFtException - if error occurs during execution
        • verifyImageExists

          Point verifyImageExists(RenderedImage imageToFind,
                                  byte similarity)
                           throws GeneralLeanFtException
          Checks whether a snapshot of this object contains the supplied image.

          When this method returns a false value, the step fails, but the failure does not throw an exception or cause the test to stop running.
          Parameters:
          imageToFind - the image to look for within the test object's snapshot.
          similarity - the minimum similarity between the two images (as a percentage), above which the find is considered a match.
          Returns:
          the Point where the image was located, or null if it was not found.
          Throws:
          GeneralLeanFtException - if error occurs during execution
        • verifyImageMatch

          boolean verifyImageMatch(RenderedImage expectedImage)
                            throws GeneralLeanFtException
          Checks whether a snapshot of this object is identical to the supplied image.
          When this method returns a false value, the step fails, but the failure does not throw an exception or cause the test to stop running.
          Parameters:
          expectedImage - the image to compare to the test object snapshot.
          Returns:
          true if the images are identical, else false.
          Throws:
          GeneralLeanFtException - if error occurs during execution
        • verifyImageMatch

          boolean verifyImageMatch(RenderedImage expectedImage,
                                   byte pixelTolerance)
                            throws GeneralLeanFtException
          Checks whether a snapshot of this object and the supplied image are a match, given the specified pixel tolerance value.
          When this method returns a false value, the step fails, but the failure does not throw an exception or cause the test to stop running.
          Parameters:
          expectedImage - the image to compare to the test object snapshot.
          pixelTolerance - the percentage of pixels that can differ between the two images, and still be considered a match.
          Returns:
          true if the images match within the specified tolerance, else false.
          Throws:
          GeneralLeanFtException - if error occurs during execution
        • verifyImageMatch

          boolean verifyImageMatch(RenderedImage expectedImage,
                                   byte pixelTolerance,
                                   byte rgbTolerance)
                            throws GeneralLeanFtException
          Checks whether a snapshot of this object and the supplied image are a match, given the specified pixel and RGB tolerance values.
          When this method returns a false value, the step fails, but the failure does not throw an exception or cause the test to stop running.
          Parameters:
          expectedImage - the image to compare to the test object snapshot.
          pixelTolerance - the percentage of pixels that can differ between the two images, and still be considered a match.
          rgbTolerance - the percent by which the RGB values of the pixels in the two images can differ, and still be considered a match.
          Returns:
          true if the images match within the specified tolerances, else false.
          Throws:
          GeneralLeanFtException - if error occurs during execution
        • verifyImageMatch

          boolean verifyImageMatch(RenderedImage expectedImage,
                                   ImageMaskArea maskArea)
                            throws GeneralLeanFtException
          Checks whether the defined mask areas within the object snapshot and the supplied image are identical.
          When this method returns a false value, the step fails, but the failure does not throw an exception or cause the test to stop running.
          Parameters:
          expectedImage - the image to compare to the test object snapshot.
          maskArea - the mask area within the two images to use for the comparison.
          Returns:
          true if the mask areas within the images are identical and the two full images are the same size, else false.
          Throws:
          GeneralLeanFtException - if error occurs during execution
        • verifyImageMatch

          boolean verifyImageMatch(RenderedImage expectedImage,
                                   ImageMaskArea maskArea,
                                   byte pixelTolerance)
                            throws GeneralLeanFtException
          Checks whether the defined mask areas within the object snapshot and the supplied image match, given the specified pixel tolerance values.
          When this method returns a false value, the step fails, but the failure does not throw an exception or cause the test to stop running.
          Parameters:
          expectedImage - the image to compare to the test object snapshot.
          maskArea - the mask area within the two images to use for the comparison.
          pixelTolerance - the percentage of pixels that can differ between the two images, and still be considered a match.
          Returns:
          true if the mask areas within the images match and the two full images are the same size, else false.
          Throws:
          GeneralLeanFtException - if error occurs during execution
        • verifyImageMatch

          boolean verifyImageMatch(RenderedImage expectedImage,
                                   ImageMaskArea maskArea,
                                   byte pixelTolerance,
                                   byte rgbTolerance)
                            throws GeneralLeanFtException
          Checks whether the defined mask areas within the object snapshot and the supplied image match, given the specified pixel and RGB tolerance values.
          When this method returns a false value, the step fails, but the failure does not throw an exception or cause the test to stop running.
          Parameters:
          expectedImage - the image to compare to the test object snapshot.
          maskArea - the mask area within the two images to use for the comparison.
          pixelTolerance - the percentage of pixels that can differ between the two images, and still be considered a match.
          rgbTolerance - the percent by which the RGB values of the pixels in the two images can differ, and still be considered a match.
          Returns:
          true if the mask areas within the images match and the two full images are the same size, else false.
          Throws:
          GeneralLeanFtException - if error occurs during execution
        • waitUntilExists

          boolean waitUntilExists()
                           throws GeneralLeanFtException
          Waits until this test object exists (or until the UFT Developer object synchronization timeout (20 seconds) elapses.
          Returns:
          true if the object exists within 20 seconds, otherwise false.
          Throws:
          GeneralLeanFtException - if error occurs during execution
        • waitUntilExists

          boolean waitUntilExists(int totalTimeOutInSeconds)
                           throws GeneralLeanFtException
          Waits until this test object exists or until the specified timeout elapses.
          Parameters:
          totalTimeOutInSeconds - the time (in seconds) to wait until the test object exists.
          Returns:
          true if the object exists before the specified timeout, otherwise false.
          Throws:
          GeneralLeanFtException - if error occurs during execution