PDFApplication Object
Description
A PDF application object. A separate PDFApplication object is created for each PDF file you test.
Operations
The sections below list the built-in methods and properties that you can use as operations for the PDFApplication object.
Note: You can also view a list and descriptions of the PDFApplication description properties, for use in object repository descriptions, programmatic descriptions, checkpoint and output value steps, and as argument values for the GetTOProperty and GetROProperty methods.
IMPORTANT
To open a PDF document for testing, you must use the PDF Testing Utility. You can open the utility from within UFT One or using a PDFUtility.Open step.
Methods
CaptureBitmap | Saves a screen capture of the object as a .png or .bmp image using the specified file name. |
Check | Checks whether the actual value of an item matches the expected value. |
CheckProperty | Checks whether the actual value of the specified object property matches the specified expected value within the specified timeout. |
ChildObjects | Returns the collection of child objects contained within the object. |
Click | Clicks the object. |
Close | Closes the PDF application. |
DblClick | Double-clicks the object. |
GetAllROProperties | Returns the collection of properties and current values from the object in the application. |
GetROProperty | Returns the current value of the description property from the object in the application. |
GetText | Returns all of the text contained in the PDF document. |
GetTOProperties | Returns the collection of properties and values used to identify the object. |
GetTOProperty | Returns the value of the specified description property from the test object description. |
Highlight | Highlights the object in the application. |
GoToPage | Navigates to the specified page in the open PDF document. |
Maximize | Maximizes the PDF application's window to fill the entire screen. |
Minimize | Minimizes the PDF application's window to an icon. |
Output | Retrieves the current value of an item and stores it in a specified location. |
RefreshObject | Instructs UFT One to re-identify the object in the application being tested the next time a step refers to this object. |
Restore | Restores the PDF application's window to its previous size. |
Save | Saves the PDF document. |
SetFocus | Activates the selected object and brings it into focus. |
SetTOProperty | Sets the value of the specified description property in the test object description. |
ToString | Returns a string that represents the test object. |
Type | Simulates keyboard input on the object. |
WaitProperty | Waits until the specified object property achieves the specified value or exceeds the specified timeout before continuing to the next step. |
Properties
Exist | Checks whether the object currently exists in the open application. |
Click Method
Description
Clicks the object.
Syntax
object.Click [X], [Y], [MouseButton]
Arguments
Parameter | Description |
---|---|
X |
Optional. An integer value. The x-coordinate of the click. Note that the specified coordinates are relative to the upper left corner of the object. The default value is the center of the object. Default value = -9999 |
Y |
Optional. An integer value. The y-coordinate of the click. Note that the specified coordinates are relative to the upper left corner of the object. The default value is the center of the object.
Default value = -9999 |
MouseButton |
Optional. A predefined constant or number. The mouse button to use for the click. Default value = micLeftBtn |
Return Type
None
Example
'The following example left-clicks in the center of the open PDF application 'and then right-clicks a specific point in it. PDFApplication("Sample.pdf").Click PDFApplication("Sample.pdf").Click 50, 100, Right_Mouse_Button
Close Method
Description
Closes the PDF application.
Syntax
object.Close
Return Type
None
Example
'The following example closes the PDF application window PDFApplication("Sample.pdf").Close
DblClick Method
Description
Double-clicks the object.
Syntax
object.DblClick X, Y, [MouseButton]
Arguments
Parameter | Description |
---|---|
X |
Required. An integer value. The x-coordinate of the double-click. Note that the specified coordinates are relative to the upper left corner of the object. |
Y |
Required. An integer value. The y-coordinate of the double-click. Note that the specified coordinates are relative to the upper left corner of the object. |
MouseButton |
Optional. A predefined constant or number. The mouse button to use for the double-click. Default value = micLeftBtn |
Return Type
None
GetText Method
Description
Returns all of the text contained in the PDF document.
Syntax
object.GetText
IMPORTANT
The text is returned in one string, without any of the text formatting that exists in the PDF Document.
Return Type
None
Example
The following example retrieves the PDF's text PDFApplication("Sample.pdf").GetText
GoToPage Method
Description
Navigates to the specified page in the open PDF document.
Syntax
object.GoToPage PageNumber
Arguments
Parameter | Description |
---|---|
PageNumber | Required. An integer value. The page to which you want to navigate. |
Return Type
None
Example
'The following example opens page 3 in the open document PDFApplication("Sample.pdf").GoToPage 3
Maximize Method
Description
Maximizes the PDF application's window to fill the entire screen.
Syntax
object.Maximize
Return Type
None
Example
'The following example maximizes the PDF application window PDFApplication("Sample.pdf").Maximize
Minimize Method
Description
Minimizes the PDF application's window to an icon.
Syntax
object.Minimize
Return Type
None
Example
'The following example minimizes the PDF application window PDFApplication("Sample.pdf").Minimize
Restore Method
Description
Restores the PDF application's window to its previous size.
Syntax
object.Restore
Return Type
None
Example
'The following example restores the PDF application window 'to its previous size PDFApplication("Sample.pdf").Restore
Save Method
Description
Saves the PDF document.
Syntax
object.Save [path] [encryptedPassword]
Arguments
Parameter | Description |
---|---|
path | Optional. A string value. The full path for the PDF document. The document is saved to that location, overwriting any existing file. Note:
|
encryptedPassword | Optional. A string value. An encoded string specifying the password required to open the PDF file the next time it is opened. To encode the password before entering it here, use the Password Encoder utility (available from the Windows Start menu). Note:
|
Return Type
Boolean.
True. The document was saved successfully.
False. Failed to save the file.
Example
'The following example saves the current open document, and then 'saves a copy of the file with a different name. PDFApplication("Sample.pdf").Save PDFApplication("Sample.pdf").Save "C:\Temp\myDocument.pdf" 'The open document switches to the new saved file. However, the 'test object expects the old name property. 'To refer to the document that is now open, you must specify a description: PDFApplication("name:=myDocument.pdf").Click
SetFocus Method
Description
Activates the selected object and brings it into focus.
Syntax
object.SetFocus
Return Type
None.
Example
'The following example sets the focus on an open PDF application. PDFApplication("Sample.pdf").SetFocus
Type Method
Description
Simulates keyboard input on the object.
Syntax
object.Type KeyboardInput
Arguments
Parameter | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
KeyboardInput |
Required. A String value. The text string to type or a constant representing a non-alphanumeric key. The following constants are available:
|
Return Type
None.
IMPORTANT
Although the Type method is supported for most objects, if you enter a Type statement for an object in which a user cannot enter text, the method has no visual effect.
See also: