JavaTable Object
Description
A Java table.
IMPORTANT
The OpenText Functional Testing Java Add-in provides built-in support for several standard Swing JTable cell editor types. This means that by default, OpenText Functional Testing records operations on these standard cell editors in the same way as other table objects, using SetCellData statements. This default behavior can be modified if required. For more information, see the Java Add-in section of the OpenText Functional Testing Help Center.
Operations
The sections below list the built-in methods and properties that you can use as operations for the JavaTable object.
Note: You can also view a list and descriptions of the JavaTable 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.
Methods
ActivateCell | Activates the specified cell in the table. |
ActivateColumn | Activates the specified column in the table. |
ActivateRow | Activates the specified row in the table. |
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 specified location with the specified mouse button. |
ClickCell | Clicks the specified cell in the table. |
CreateObject | Creates an instance of any Java object within your application. |
DblClick | Double-clicks the specified location with the specified mouse button. |
DeselectColumn | Clears the selection of the specified column in the table. |
DeselectColumnsRange | Clears the selection of the specified range of columns in the table. |
DeselectRow | Clears the selection of the specified row in the table. |
DeselectRowsRange | Clears the selection of the specified range of rows in the table. |
DoubleClickCell | Double-clicks the specified cell in the table. |
Drag | Performs a mouse drag from the specified starting cell to the specified ending cell. |
ExtendColumn | Selects an additional column in the table. |
ExtendColumnsRange | Selects the specified range of additional columns in the table. |
ExtendRow | Selects an additional row in the table. |
ExtendRowsRange | Selects the specified range of additional rows in the table. |
FireEvent | Simulates an event on a test object using one of several pre-defined event constants. |
FireEventEx | Simulates an event on a Java test object, given the ClassName, Event ID, and Event Parameters. |
GetAllROProperties | Returns the collection of properties and current values from the object in the application. |
GetCellData | Returns the data contained in the specified cell. |
Returns the data contained in the specified range of cells. | |
GetColumnName | Returns the name of the column with the specified index. |
GetROProperty | Returns the current value of the description property from the object in the application. |
GetStatics | Returns the Java object capable of accessing static members (methods and fields) of the specified Java class. |
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. |
MouseDrag | Performs a mouse drag and drop operation from the specified X1, Y1 coordinates to the specified Xn, Yn coordinates. |
Output | Retrieves the current value of an item and stores it in a specified location. |
PressKey | Presses the specified key and modifier in the object. |
RefreshObject | Instructs OpenText Functional Testing to re-identify the object in the application the next time a step refers to this object. |
SelectCell | Selects the specified cell in the table. |
SelectCellsRange | Selects the specified range of cells in the table. |
SelectColumn | Selects the specified column in the table. |
SelectColumnHeader | Selects the specified column header in the table. |
SelectColumnsRange | Selects the specified range of columns in the table. |
SelectRow | Selects the specified row in the table. |
SelectRowsRange | Selects the specified range of rows in the table. |
SetCellData | Sets the cell contents with the specified data. |
SetTOProperty | Sets the value of the specified description property in the test object description. |
ToString | Returns a string that represents the test object. |
Type | Types the specified text in 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. |
Object | Accesses the native methods and properties of the object. |
ActivateCell Method
Description
Activates the specified cell in the table.
Syntax
object.ActivateCell (Row, Column)
Arguments
Parameter | Description |
---|---|
Row |
Required. A Variant. The row number or row header label of the row containing the cell you want to activate. Row numbers begin with 0. |
Column |
Required. A Variant. The column number or column header label of the column containing the cell you want to activate. Column numbers begin with 0. |
Return Type
None.
Example
'The following example uses the ActivateCell method to activate the cell in row 1, column 3 in Table 'Example, in the SwingSet JavaApplet. Browser("Browser").Page("SwingSet demo").JavaApplet("Swingsetapplet").JavaTable("Table Example").ActivateCell 1, 3
ActivateColumn Method
Description
Activates the specified column in the table.
Syntax
object.ActivateColumn (Column)
Arguments
Parameter | Description |
---|---|
Column |
Required. A Variant. The column number or column header label of the column you want to activate. Column numbers begin with 0. |
Return Type
None.
IMPORTANT
This method is not supported for SWT tables.
Example
The following example uses the ActivateColumn method to activate column 2 in Table Example, in the 'SwingSet JavaApplet. Browser("Browser").Page("SwingSet demo").JavaApplet("Swingsetapplet").JavaTable("Table Example").ActivateColumn 2
'The following example uses the ActivateColumn method to activate the "Employee Names" column header. Browser("Browser").Page("SwingSet demo").JavaApplet("Swingsetapplet").JavaTable("Table Example").ActivateColumn "employee names"
ActivateRow Method
Description
Activates the specified row in the table.
Syntax
object.ActivateRow (Row)
Arguments
Parameter | Description |
---|---|
Row |
Required. A Variant. The row number or row header label of the row you want to activate. Row numbers begin with 0. |
Return Type
None.
Example
'The following example uses the ActivateRow method to activate row 1 in Table Example, in the 'SwingSet JavaApplet. Browser("Browser").Page("SwingSet demo").JavaApplet("Swingsetapplet").JavaTable("Table Example").ActivateRow 1
'The following example uses the ActivateRow method to activate the "Amount Paid" row header. Browser("Browser").Page("SwingSet demo").JavaApplet("Swingsetapplet").JavaTable("Table Example").ActivateRow "amount paid"
Click Method
Description
Clicks the specified location with the specified mouse button.
Syntax
object.Click (X, Y, [MouseButton])
Arguments
Parameter | Description |
---|---|
X |
Required. A Variant. The x-coordinate of the click. |
Y |
Required. A Variant. The y-coordinate of the click. |
MouseButton |
Optional. A String value. Indicates whether the click should be performed with the left or right mouse button. Possible values: "LEFT" (default) "RIGHT" Default value = "LEFT" |
Return Type
None.
IMPORTANT
You must enter valid x- and y-coordinates.
Example
'The following example uses the Click method to click in the table in the "Periodic" applet at coordinates 503 and 55 'using the left mouse button. Browser("Periodic").Page("Periodic").JavaApplet("Periodic").JavaTable("Periodic").Click 503, 55, "LEFT"
ClickCell Method
Description
Clicks the specified cell in the table.
Syntax
object.ClickCell (Row, Col, [MouseButton], [Modifier])
Arguments
Parameter | Description |
---|---|
Row |
Required. A Variant. The row number or the row header label. Row numbers begin with 0. |
Col |
Required. A Variant. The column number or the column header label. Column numbers begin with 0. |
MouseButton |
Optional. A Variant. Indicates whether the click should be performed with the left or right mouse button. Possible values: "RIGHT" "LEFT" |
Modifier |
Optional. A Variant. The keyboard keys used to perform the operation. Use one of the following values: NONE (default) SHIFT CONTROL CONTROL_SHIFT LOCK ALT |
Return Type
None.
Example
'The following example uses the ClickCell method to perform a shift-click the cell in row 2 of the Last 'Name column, in the SwingSet JavaTable. Browser("SwingSet demo").Page("SwingSet demo").JavaApplet("SwingSetApplet").JavaTable("Inter-cell spacing:").ClickCell 2, "Last Name", "LEFT", "SHIFT"
CreateObject Method
Description
Creates an instance of any Java object within your application.
Syntax
object.CreateObject (ClassName, ConsArgs)
Arguments
Parameter | Description |
---|---|
ClassName |
Required. A String value. The Java class name. |
ConsArgs |
Required. None Any arguments required for the object's constructor. Enter the values in a comma separated list. If no arguments are required for the constructor, you do not need to supply a value for the ConsArgs argument. |
Return Type
A Variant.
Returns an object reference. You can use this reference to access the object's methods and properties, without using the Object property.
IMPORTANT
- The class loader of the Java test object on which the CreateObject method is performed is used to load the class of the newly created Java object.
- We recommend using the CreateObject method on a test object from the same toolkit as the object you want to create. For example, to create a Swing/JFC object, use the CreateObject method on an existing Swing/JFC Java test object.
- For more information on the CreateObject method and for additional documentation on standard JDK classes, see the Java documentation.
Example
'The following example uses the CreateObject method to create a rectangle object. Set Rect = Browser("Periodic").Page("Periodic").JavaApplet("Periodic").JavaList("Panel").CreateObject("java.awt.Rectangle", 10, 20)
DblClick Method
Description
Double-clicks the specified location with the specified mouse button.
Syntax
object.DblClick (X, Y, [MouseButton])
Arguments
Parameter | Description |
---|---|
X |
Required. A Variant. The x coordinate of the location on the applet to be clicked. |
Y |
Required. A Variant. The y-coordinate of the location on the applet to be clicked. |
MouseButton |
Optional. A String value. Indicates whether the double-click should be performed with the left or right mouse button. Possible values: "LEFT" (default) "RIGHT" Default value = "LEFT" |
Return Type
None.
IMPORTANT
You must enter valid x- and y-coordinates.
Example
'The following example uses the DblClick method to double-click the "Periodic JavaButton" object at 'coordinates 503 and 55, using the left mouse button. Browser("Periodic").Page("Periodic").JavaApplet("Periodic").JavaButton("Frame").DblClick 5, 5, "LEFT"
DeselectColumn Method
Description
Clears the selection of the specified column in the table.
Syntax
object.DeselectColumn (Column)
Arguments
Parameter | Description |
---|---|
Column |
Required. A Variant. The column number or the column header label of the column you want to deselect. Column numbers begin with 0. |
Return Type
None.
IMPORTANT
This method is not supported for SWT tables.
Example
'The following example uses the DeselectColumn method to deselect column 2 ("Favorite Color") in Table Example, 'in the SwingSet applet. Browser("Browser").Page("SwingSet demo").JavaApplet("Swingsetapplet").JavaTable("Table Example").DeselectColumn "Favorite color"
DeselectColumnsRange Method
Description
Clears the selection of the specified range of columns in the table.
Syntax
object.DeselectColumnsRange (StartCol, EndCol)
Arguments
Parameter | Description |
---|---|
StartCol |
Required. A Variant. The column number or column header label for the first column in the range of columns you want to deselect. Column numbers begin with 0. |
EndCol |
Required. A Variant. The column number or column header label for the last column in the range of columns you want to deselect. Column numbers begin with 0. |
Return Type
None.
IMPORTANT
This method is not supported for SWT tables.
Example
'The following example uses the DeselectColumnsRange method to deselect column 2 ("Favorite Color") through 'column 5 ("Favorite Song") in Table Example, in the SwingSet applet. Browser("Browser").Page("SwingSet demo").JavaApplet("Swingsetapplet").JavaTable("Table Example").DeselectColumnsRange "Favorite color", "Favorite song"
DeselectRow Method
Description
Clears the selection of the specified row in the table.
Syntax
object.DeselectRow (Row)
Arguments
Parameter | Description |
---|---|
Row |
Required. A Variant. The row number or row header label of the row you want to deselect. Row numbers begin with 0. |
Return Type
None.
Example
'The following example uses the DeselectRow method to deselect row 1 in Table Example, in the SwingSet applet. Browser("Browser").Page("SwingSet demo").JavaApplet("Swingsetapplet").JavaTable("Table Example").DeselectRow 1
DeselectRowsRange Method
Description
Clears the selection of the specified range of rows in the table.
Syntax
object.DeselectRowsRange (StartRow, EndRow)
Arguments
Parameter | Description |
---|---|
StartRow |
Required. A Variant. The row number or row header label of the first row in the range of rows you want to deselect. Row numbers begin with 0. |
EndRow |
Required. A Variant. The row number or row header label of the last row in the range of rows you want to deselect. Row numbers begin with 0. |
Return Type
None.
Example
'The following example uses the DeselectRowsRange method to deselect row 1 through row 3 in Table Example, 'in the SwingSet applet. Browser("Browser").Page("SwingSet demo").JavaApplet("Swingsetapplet").JavaTable("Table Example").DeselectRowsRange 1, 3
DoubleClickCell Method
Description
Double-clicks the specified cell in the table.
Syntax
object.DoubleClickCell (Row, Col, [MouseButton], [Modifier])
Arguments
Parameter | Description |
---|---|
Row |
Required. A Variant. The row number or the row header label. Row numbers begin with 0. |
Col |
Required. A Variant. The column number or the column header label. Column numbers begin with 0. |
MouseButton |
Optional. A Variant. Indicates whether the double-click should be performed with the left or right mouse button. Possible values: "LEFT" (default) "RIGHT" |
Modifier |
Optional. A Variant. The keyboard keys used to perform the operation. |
Return Type
None.
Example
'The following example uses the DoubleClickCell method to double-click the cell in row 4, column 3 in Table 'Example, in the SwingSet applet. Browser("Browser").Page("SwingSet demo").JavaApplet("Swingsetapplet").JavaTable("Table Example").DoubleClickCell 4, 3
Drag Method
Description
Performs a mouse drag from the specified starting cell to the specified ending cell.
Syntax
object.Drag (StartRow, StartCol, EndRow, EndCol, [MouseButton], [Modifier])
Arguments
Parameter | Description |
---|---|
StartRow |
Required. A Variant. The row number or row header label of the first row containing the cells you want to drag. Row numbers begin with 0. |
StartCol |
Required. A Variant. The column number or column header label of the first column containing the cells you want to drag. Column numbers begin with 0. |
EndRow |
Required. A Variant. The row number or row header label of the last row containing the cells you want to drag. Row numbers begin with 0. |
EndCol |
Required. A Variant. The column number or column header label of the last column containing the cells you want to drag. Column numbers begin with 0. |
MouseButton |
Optional. A Variant. Indicates whether the click should be performed with the left or right mouse button. Possible values: "LEFT" (default) "RIGHT" |
Modifier |
Optional. A Variant. The keyboard keys used to perform the operation. |
Return Type
None.
Example
'The following example uses the Drag method to drag the mouse from row 1, column 1 to row 4, column 3 in 'Table Example, in the SwingSet applet. Browser("Browser").Page("SwingSet demo").JavaApplet("Swingsetapplet").JavaTable("Table Example").Drag 1, 1, 4, 3
ExtendColumn Method
Description
Selects an additional column in the table.
Syntax
object.ExtendColumn (Column)
Arguments
Parameter | Description |
---|---|
Column |
Required. A Variant. The column number or the column header label to select. Column numbers begin with 0. |
Return Type
None.
Example
'The following example uses the ExtendColumn method to add column 2 to the column or columns that are already 'selected in Table Example, in the SwingSet applet. Browser("Browser").Page("SwingSet demo").JavaApplet("Swingsetapplet").JavaTable("Table Example").ExtendColumn 2
ExtendColumnsRange Method
Description
Selects the specified range of additional columns in the table.
Syntax
object.ExtendColumnsRange (StartCol, EndCol)
Arguments
Parameter | Description |
---|---|
StartCol |
Required. A Variant. The column number or column header label for the first column in the range of columns you want to select. Column numbers begin with 0. |
EndCol |
Required. A Variant. The column number or column header label for the last column in the range of columns you want to select. Column numbers begin with 0. |
Return Type
None.
Example
'The following example uses the ExtendColumnsRange method to add columns 2-4 to the column or columns that 'are already selected in Table Example, in the SwingSet applet. Browser("Browser").Page("SwingSet demo").JavaApplet("Swingsetapplet").JavaTable("Table Example").ExtendColumnsRange 2, 4
ExtendRow Method
Description
Selects an additional row in the table.
Syntax
object.ExtendRow (Row)
Arguments
Parameter | Description |
---|---|
Row |
Required. A Variant. The row number or the row header label to select. Row numbers begin with 0. |
Return Type
None.
Example
'The following example uses the ExtendRow method to add row 3 to the row or rows that are already selected 'in the SwingSet applet. Browser("Browser").Page("SwingSet demo").JavaApplet("Swingsetapplet").JavaTable("Table Example").ExtendRow 3
ExtendRowsRange Method
Description
Selects the specified range of additional rows in the table.
Syntax
object.ExtendRowsRange (StartRow, EndRow)
Arguments
Parameter | Description |
---|---|
StartRow |
Required. A Variant. The row number or row header label of the first row in the range of rows you want to select. Row numbers begin with 0. |
EndRow |
Required. A Variant. The row number or row header label of the last row in the range of rows you want to select. Row numbers begin with 0. |
Return Type
None.
Example
'The following example uses the ExtendRowsRange method to add rows 2-4 to the row or rows that are already 'selected in Table Example, in the SwingSet applet. Browser("Browser").Page("SwingSet demo").JavaApplet("Swingsetapplet").JavaTable("Table Example").ExtendRowsRange 2, 4
FireEvent Method
Description
Simulates an event on a test object using one of several pre-defined event constants.
Syntax
object.FireEvent (EventType, EventArguments)
Arguments
Parameter | Description |
---|---|
EventType |
Required. A Numeric Value. Possible values: micMouseEnter, micMouseExit, micMouseClick, micMousePress, micMouseRelease, micMouseDrag, micMouseMove, micKeyPress, micKeyRelease, micKeyType, micFocusGain, micFocusLost. Note: The FireEvent method is supported only for java.awt.* components . The events for org.eclipse.swt.widgets.* controls are not supported. |
EventArguments |
Required. None Any parameters of the event's constructor except for the source and EventID. You can pass any Java constant that is used as one of the event’s constructor parameters using its string instead of its value. Enter the values in a comma separated list. If no additional parameters are required, you do not need to supply a value for the EventArguments argument. |
Return Type
None.
IMPORTANT
- If the list of pre-defined constants does not cover the event you want to fire, you can use the FireEventEx method to fire any event that has a constructor.
- This method is not supported for SWT-based controls.
For more information on the FireEvent method, and additional documentation on events, see the Java documentation.
Example
'The following example uses the FireEvent method to fire a MouseClick event on the MySpinButton_0 JavaSpin. Browser("Browser").Page("Page").JavaApplet("mybuttonapplet").JavaSpin("MySpinButton_0").FireEvent micMouseClick, 0, "BUTTON1_MASK", 4, 4, 1, "OFF"
FireEventEx Method
Description
Simulates an event on a Java test object, given the ClassName, Event ID, and Event Parameters.
Syntax
object.FireEventEx (ClassName, EventId, EventArguments)
Arguments
Parameter | Description |
---|---|
ClassName |
Required. A String value. The name of the Java class representing the event to be activated. |
EventId |
Required. A String value. The event ID number or the final field string that represents the event ID. |
EventArguments |
Required. None Any parameters of the event's constructor except for the source and EventID. You can pass any Java constant that is used as one of the event’s constructor parameters using its string instead of its value. Enter the values in a comma separated list. If no additional parameters are required, you do not need to supply a value for the EventArguments argument. |
Return Type
None.
IMPORTANT
- You can use FireEventEx for any Java event.
- This method is not supported for SWT-based controls.
For more information on the FireEventEx method, and additional documentation on events, see the Java documentation.
Example
'The following example uses the FireEventEx method to fire a MouseClick event on the MyCheckBox_0 Java check box. Browser("Browser").Page("Page").JavaApplet("mybuttonapplet").JavaCheckBox("MyCheckBox_0").FireEventEx "java.awt.event.MouseEvent", "MOUSE_CLICKED", 0, "BUTTON1_MASK", 4, 4, 1, "False"
GetCellData Method
Description
Returns the data contained in the specified cell.
Syntax
object.GetCellData (Row, Column)
Arguments
Parameter | Description |
---|---|
Row |
Required. A Variant. The row number or row header label of the row containing the cell. Row numbers begin with 0. |
Column |
Required. A Variant. The column number or column header label of the column containing the cell. Column numbers begin with 0. |
Return Type
A Variant.
Example
'The following example uses the GetCellData method to retrieve the data contained in the cell in row 1, 'column 1. Browser("SwingSet demo").Page("SwingSet demo").JavaApplet("SwingSetApplet").JavaTable("Inter-cell spacing:").GetCellData 1, 1
'The following example uses the GetCellData method to list the data of each cell in a table of '10 rows and 10 columns. Note that the comment in the example below should be replaced with the 'necessary code for writing the retrieved information to a file or otherwise using the information 'retrieved in each iteration of the loop: For i=0 to 10 For j=0 to 10 dat=Browser("SwingSet demo").Page("SwingSet demo").JavaApplet("SwingSetApplet").JavaTable("Inter-cell spacing:").GetCellData (i, j) ' Use the value obtained in dat variable Next Next
GetCellRangeData Method
Description
Returns the data contained in the specified range of cells.
Syntax
object.GetCellRangeData (startRow, endRow, startColumn, endColumn)
Arguments
Parameter | Description |
---|---|
startRow | Required. A Variant. The row number or row header label of the starting row in the range. Row numbers begin with 0. |
endRow | Required. A Variant. The row number or row header label of the ending row in the range. Row numbers begin with 0. |
startColumn | Required. A Variant. The column number or column header label of the column containing the starting column in the range. Column numbers begin with 0. |
endColumn | Required. A Variant. The column number or column header label of the column containing the ending column in the range. Column numbers begin with 0. |
Return Type
A String.
The returned strings contains the cell content from the specified range.
- Rows are separated by ASCII code 30.
- Cells in a row are separated by ASCII code 37.
Example
'The following example uses the GetCellRangeData method to retrieve the data contained ' in columns 1 through 4, in the first 6 rows of the table. ' Then the example uses the the GetCellRangeData method to retrieve the data contained ' in the columns from "First Name" to "Last Name" in the first 6 rows of the table. Browser("SwingSet demo").Page("SwingSet demo").JavaApplet("SwingSetApplet").JavaTable("Inter-cell spacing:").GetCellRangeData 0, 5, 1, 4 Browser("SwingSet demo").Page("SwingSet demo").JavaApplet("SwingSetApplet").JavaTable("Inter-cell spacing:").GetCellRangeData 0, 5, "First Name", "Last Name"
GetColumnName Method
Description
Returns the name of the column with the specified index.
Syntax
object.GetColumnName (index)
Arguments
Parameter | Description |
---|---|
index |
Required. A Variant. The index of the column whose name you want to return. Index values begin with 0. |
Return Type
A Variant.
Example
'The following example uses the GetColumnName method to check the name of the third column in the Inter-cell 'spacing: table. JavaWindow("SwingSet").JavaCheckBox("JTable").Set "ON" If JavaWindow("SwingSet").JavaTable("Inter-cell spacing:").GetColumnName(3) <> "Favorite Color" Then Reporter.ReportEvent micFail, "Table Check", "3rd column is not Favorite Color" End If
GetStatics Method
Description
Returns the Java object capable of accessing static members (methods and fields) of the specified Java class.
Syntax
object.GetStatics (ClassName)
Arguments
Parameter | Description |
---|---|
ClassName |
Required. A String value. The Java class name whose static members you want to access. |
Return Type
A Variant.
A reference to a Java object.
IMPORTANT
The class loader of the Java test object on which the GetStatics method is performed is used to load the class specified as a parameter of the GetStatics method.
Example
'The following example uses the GetStatics method to retrieve the value of the 'out field of the java.lang.System class. Set OutStream = JavaWindow("Win").JavaRadioButton("SomeButton").GetStatics("java.lang.System").out
'The following example uses the GetStatics method to retrieve the object 'through which static members of the java.lang.System class can be accessed. 'It then uses this object to invoke the gc method of the .java.lang.System class, 'which runs the garbage collector on the application. Set SystemStatics = Browser("Browser").Page("Page").JavaApplet("mybuttonapplet.htm").JavaObject("MyButton").GetStatics("java.lang.System") SystemStatics.gc
'The following example uses the GetStatics method to print the "Hello, World!" string to the standard 'output, by using the static out field of the java.lang.System class. JavaWindow("Win").JavaEdit("Name").GetStatics("java.lang.System").out.println ("Hello, World!")
MouseDrag Method
Description
Performs a mouse drag and drop operation from the specified X1, Y1 coordinates to the specified Xn, Yn coordinates.
Syntax
object.MouseDrag (X1, Y1, X2, Y2, [MouseButton])
Arguments
Parameter | Description |
---|---|
X1 |
Required. A Variant. The x-coordinate of the location from which to begin the mouse drag. |
Y1 |
Required. A Variant. The y-coordinate of the location from which to begin the mouse drag. |
X2 |
Required. A Variant. The x-coordinate of the location where the mouse drag stops. |
Y2 |
Required. A Variant. The y-coordinate of the location where the mouse drag stops. |
MouseButton |
Optional. A String value. Indicates whether the click should be performed with the left or right mouse button. Possible values: "LEFT" (default) "RIGHT" Default value = "LEFT" |
Return Type
None.
Example
'The following example uses the MouseDrag method to perform a mouse drag and drop operation on a Java table object. Browser("Browser").Page("Page").JavaApplet("Periodic").JavaTable("Periodic").MouseDrag 4, 10, 10, 10, "LEFT"
PressKey Method
Description
Presses the specified key and modifier in the object.
Syntax
object.PressKey (Key, [Modifier])
Arguments
Parameter | Description |
---|---|
Key |
Required. A String value. micF1. Presses the F1 key. micF2. Presses the F2 key. micF3. Presses the F3 key. micF4. Presses the F4 key. micF5. Presses the F5 key. micF6. Presses the F6 key. micF7. Presses the F7 key. micF8. Presses the F8 key. micF9. Presses the F9 key. micF10. Presses the F10 key. micF11. Presses the F11 key. micF12. Presses the F12 key. micLeft. Presses the left arrow key. micRight. Presses the right arrow key. micDwn. Presses the down arrow key. micUp. Presses the up arrow key. micTab. Presses the TAB key. micReturn. Presses the RETURN or ENTER key. micBack. Presses the BACK key. micDel. Presses the DELETE key. micHome. Presses the HOME key. micEnd. Presses the END key. micEsc. Presses the ESC key. micPause. Presses the PAUSE key. micPrintScr. Presses the PRINT SCREEN key; supported for JavaFX only. micIns. Presses the INSERT key. |
Modifier |
Optional. A String value. The modifier(s) to use. Supported modifiers: micCtrl micAlt micShift micCtrlAlt micCtrlShift micCtrlShiftAlt micShiftAlt Default value = "" |
Return Type
None.
IMPORTANT
When typing keys during a recording session, OpenText Functional Testing records the PressKey method when one or more hot keys (such as F-keys, Alt, and Ctrl) are used.
It also records the PressKey method for any typed key in a Java object that supports text editing, but does not support the Set method.
Example
'The following example enters text in an edit box and then uses the PressKey method to cut the word 'edit' 'and paste it in a different location using the Ctrl-X and Ctrl-V shortcut keys. 'Place the cursor at the beginning of the text box. Browser("Java Examples").Page ("Java Examples") .Frame("MAIN").JavaApplet("TextAreaApplet").JavaEdit("Text field").SetCaretPos 0, 0 'Enter a sentence in the text box. Browser("Java Examples").Page("Java Examples").Frame("MAIN").JavaApplet("TextAreaApplet").JavaEdit("Text field ").Set "Set the edit text." 'Select (highlight) the word 'edit'. Browser("Java Examples").Page("Java Examples").Frame("MAIN").JavaApplet("TextAreaApplet").JavaEdit("Text field").SetSelection 0, 8, 0, 12 'Cut the word 'edit' Browser("Java Examples").Page("Java Examples").Frame("MAIN").JavaApplet("TextAreaApplet").JavaEdit("Text field").PressKey "X", micCtrl 'Place the cursor at the end of the text. Browser("Java Examples").Page("Java Examples").Frame("MAIN").JavaApplet("TextAreaApplet").JavaEdit("Text field").SetCaretPos 0, 12 'Insert a space at the end of the text. Browser("Java Examples").Page("Java Examples").Frame("MAIN").JavaApplet("TextAreaApplet").JavaEdit("Text field").Insert " ", 0, 12 'Paste the word 'edit' at the end of the text. Browser("Java Examples").Page("Java Examples").Frame("MAIN").JavaApplet("TextAreaApplet").JavaEdit("Text field").PressKey "V", micCtrl
SelectCell Method
Description
Selects the specified cell in the table.
Syntax
object.SelectCell (Row, Column)
Arguments
Parameter | Description |
---|---|
Row |
Required. A Variant. The row number or row header label of the row containing the cell you want to select. Row numbers begin with 0. |
Column |
Required. A Variant. The column number or column header label of the column containing the cell you want to select. Column numbers begin with 0. |
Return Type
None.
Example
'The following example uses the SelectCell method to select the cell in row 1, column 2 ("Favorite Color") 'in Table Example, in the SwingSet applet. Browser("Browser").Page("SwingSet demo").JavaApplet("Swingsetapplet").JavaTable("Table Example").SelectCell 1, "Favorite color"
SelectCellsRange Method
Description
Selects the specified range of cells in the table.
Syntax
object.SelectCellsRange (StartRow, StartCol, EndRow, EndCol)
Arguments
Parameter | Description |
---|---|
StartRow |
Required. A Variant. The row number or row header label of the first row containing the cells you want to select. Row numbers begin with 0. |
StartCol |
Required. A Variant. The column number or column header label of the first column containing the cells you want to select. Column numbers begin with 0. |
EndRow |
Required. A Variant. The row number or row header label of the last row containing the cells you want to select. Row numbers begin with 0. |
EndCol |
Required. A Variant. The column number or column header label of the last column containing the cells you want to select. Column numbers begin with 0. |
Return Type
None.
IMPORTANT
This method is not supported for SWT tables.
Example
'The following example uses the SelectCellsRange method to select the cells in row 1, column 2 ("Favorite Color") 'through row 3, column 5 ("Favorite Song") in Table Example, in the SwingSet applet. Browser("Browser").Page("SwingSet demo").JavaApplet("Swingsetapplet").JavaTable("Table Example").SelectCellsRange 1, "Favorite color", 3, "Favorite song"
SelectColumn Method
Description
Selects the specified column in the table.
Syntax
object.SelectColumn (Column)
Arguments
Parameter | Description |
---|---|
Column |
Required. A Variant. The column number or column header label of the column you want to select. Column numbers begin with 0. |
Return Type
None.
Example
'The following example uses the SelectColumn method to select column 2 ("Favorite color") in Table Example, 'in the SwingSet applet. Browser("Browser").Page("SwingSet demo").JavaApplet("Swingsetapplet").JavaTable("Table Example").SelectColumn "Favorite color"
SelectColumnHeader Method
Description
Selects the specified column header in the table.
Syntax
object.SelectColumnHeader (Column, [MouseButton])
Arguments
Parameter | Description |
---|---|
Column |
Required. A Variant. The column number or column header label containing the column header you want to select. Column numbers begin with 0. |
MouseButton |
Optional. A Variant. Indicates whether the click should be performed with the left or right mouse button. Possible values: "LEFT" (default) "RIGHT" |
Return Type
None.
Example
'The following example uses the SelectColumnHeader method to select the "First 'Name" column header (using the right mouse button). Browser("SwingSet demo").Page("SwingSet demo").JavaApplet("SwingSetApplet").JavaTable("Inter-cell spacing:").SelectColumnHeader "First Name", "RIGHT"
SelectColumnsRange Method
Description
Selects the specified range of columns in the table.
Syntax
object.SelectColumnsRange (StartCol, EndCol)
Arguments
Parameter | Description |
---|---|
StartCol |
Required. A Variant. The column number or column header label of the first column in the range of columns you want to select. Column numbers begin with 0. |
EndCol |
Required. A Variant. The column number or column header label of the last column in the range of columns you want to select. Column numbers begin with 0. |
Return Type
None.
Example
'The following example uses the SelectColumnsRange method to select column 2 ("Favorite Color") through column '5 ("Favorite Song") in Table Example, in the SwingSet applet. Browser("Browser").Page("SwingSet demo").JavaApplet("Swingsetapplet").JavaTable("Table Example").SelectColumnsRange "Favorite color", "Favorite song"
SelectRow Method
Description
Selects the specified row in the table.
Syntax
object.SelectRow (Row)
Arguments
Parameter | Description |
---|---|
Row |
Required. A Variant. The row number or row header label of the row you want to select. Row numbers begin with 0. |
Return Type
None.
Example
'The following example uses the SelectRow method to select row 1 in Table Example, in the SwingSet applet. Browser("Browser").Page("SwingSet demo").JavaApplet("Swingsetapplet").JavaTable("Table Example").SelectRow 1
SelectRowsRange Method
Description
Selects the specified range of rows in the table.
Syntax
object.SelectRowsRange (StartRow, EndRow)
Arguments
Parameter | Description |
---|---|
StartRow |
Required. A Variant. The row number or row header label of the first row in the range of rows you want to select. Row numbers begin with 0. |
EndRow |
Required. A Variant. The row number or row header label of the last row in the range of rows you want to select. Row numbers begin with 0. |
Return Type
None.
Example
'The following example uses the SelectRowsRange method to select row 1 through row 3 in Table Example, in 'the SwingSet applet. Browser("Browser").Page("SwingSet demo").JavaApplet("Swingsetapplet").JavaTable("Table Example").SelectRowsRange 1, 3
SetCellData Method
Description
Sets the cell contents with the specified data.
Syntax
object.SetCellData (Row, Column, data)
Arguments
Parameter | Description |
---|---|
Row |
Required. A Variant. The row number or row header label of the row containing the cell in which you want to insert data. Row numbers begin with 0. |
Column |
Required. A Variant. Indicates the column number or the column header label of the column containing the cell in which you want to insert data. Column numbers begin with 0. |
data |
Required. A String value. The data to be inserted in the specified cell. |
Return Type
None.
Example
'The following example uses the SetCellData method to set the cell contents in row 2, column 4 of Table 'Example to "2 passengers". Browser("Browser").Page("SwingSet demo").JavaApplet("Swingsetapplet").JavaTable("Table Example").SetCellData 2, 4, "2 passengers"
Type Method
Description
Types the specified text in the object.
Syntax
object.Type (Text)
Arguments
Parameter | Description |
---|---|
Text |
Required. A String value. For additional supported keyboard presses, see PressKey method. |
Return Type
None.
IMPORTANT
This method is not recorded. (Keyboard operations are recorded using the Set or PressKey methods.) The Type method is useful for entering a combination of text and keyboard modifiers. You concatenate text strings and keyboard modifiers using the ampersand (&) symbol. For example, you can enter: Type "Hello World" & micCtrl & "S"
To add this method to your test, use the Step Generator or enter it manually in the Keyword View or Editor. For more information, see the OpenText Functional Testing User Guide.
Note: 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.
Example
'The following example uses the Type method to type ABC in a Java edit box. Browser("Periodic").Page("Periodic").JavaApplet("Periodic").JavaEdit("Text").Type "ABC"
See also: