TextField.
Substitutes new text for all or part of the text in the text field.
textfield.SetText (sText [, iStartChar, iNumChars])
Variable | Description |
---|---|
sText | The text to substitute. STRING. |
iStartChar | Optional: The character position in the text field (starting from 1) at which to begin the substitution. INTEGER. |
iNumChars | Optional: The number of characters in the text field to substitute with sText. INTEGER. |
STRING sHello = "Hello, world" Find.FindWhat.SetText (sHello)
The following example illustrates date transformation using the Text Field window in the test application shipped with Silk Test Classic.
testcase GetandSetText1 () STRING sReturnedText TextFieldWindow.Invoke () Print ("Entering the value '9/18/02'") TextFieldWindow.TheTextField.SetText ("9/18/02") Print ("Getting...") sReturnedText = TextFieldWindow.TheTextField.GetText () Print (sReturnedText) TextFieldWindow.Close () // Result: // Entering the value '9/18/02' // *** Y2K Notification: date value '9/18/02' has been changed to '09/18/2003' in TextFieldWindow.TheTextField.SetText // Getting ... // 09/18/2003
Note the following about this test:
This example illustrates date transformation using the Text Field window in the test application shipped with Silk Test Classic.
testcase GetandSetText2 () STRING sReturnedText TextFieldWindow.Invoke () Print ("Entering the value '9/18/20'") TextFieldWindow.TheTextField.SetText ("9/18/20") Print ("Getting...") sReturnedText = TextFieldWindow.TheTextField.GetText () Print (sReturnedText) TextFieldWindow.Close () // Result: // Entering the value '9/18/20' // *** Y2K Notification: date value '9/18/20' has been changed to '09/18/2020' in TextFieldWindow.TheTextField.SetText // Getting ... // 09/18/2020
Note the following about this test: