VerifySelRange Method

Class

TextField.

Action

Verifies the selected range of the text box.

Syntax

textfield.VerifySelRange(trExpected [, nTimeout])
Variable Description
trExpected The range you expect to be selected. TEXTRANGE.
nTimeout Optional: The number of seconds to wait for the expected value to be achieved. NUMBER.

Notes

VerifySelRange verifies that the selected range in the text box matches the range you expected to be selected. You specify the expected selection with a TEXTRANGE record.

A TEXTRANGE record includes the following fields:
Field
Description
iStartLine
The first line you expect to be selected. INTEGER.
iStartCol
The first column you expect to be selected. INTEGER.
iEndLine
The last line you expect to be selected. INTEGER.
iEndCol
The last column you expect to be selected. INTEGER.

The values of the column fields point to just before the columns themselves. Therefore, position 1 is the position just before the first character. The position at the end of the line is the one more than the last character.

For a single-line text box, iStartLine and iEndLine are ignored.

Calling this method is the same as calling the Verify function in the following manner:
Verify(window.GetSelRange(), expected_range)

If the ranges do not match, Silk Test Classic raises the exception E_VERIFY.

If a timeout is specified with the nTimeout parameter, Silk Test Classic calls VerifySelRange() until the condition is verified or the timeout is reached. The time between checks is the value of the window retry interval Agent option, OPT_WINDOW_RETRY. If the verification fails, an exception is thrown.

Example

TEXTRANGE trRange
trRange.iStartLine = 1
trRange.iStartCol = 1
trRange.iEndLine = 1
trRange.iEndCol = 6
TextEditor.Document.VerifySelRange(trRange)