Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE

How can I use SilkTest to verify that a textfield is protected?

How can I use SilkTest to verify that a textfield is protected?

Although protected textfields can not be interacted with they are enabled and hence display the value TRUE. One way to verify a textfield is protected, is to compare it"s background color with that of a textfield that isn"t protected. Typically protected textfields will be grayed out, whereas unprotected textfields will not be.

The GetBackgroundColor () method will return the background color of a textfield in terms of RGB values. This method can be used to obtain the background color of the unprotected textfield (typically white). Once you know the value of the background color, you can use to verify the background color of all the textfields

[-] testcase GetBackGroundColor ()
[ ] Print (MyApplication.Textfield.GetBackgroundColor ())
[ ]
[ ] //This will return the RGB values for the background color e.g. white would be {255, 255, 255}
[ ]
[-] testcase TestBackGroundColor ()
[ ] COLOR cColor
[ ] cColor = {255, 255, 255}
[ ] Verify (MyApplication.Textfield.GetBackgroundColor (), cColor, "background color")
[ ]

If the background color of the textfield is different from what you have defined, the testcase will fail with
*** Error: Verify background color failed. Then from the results file the user can open the difference viewer to see the difference in RGB values between the textfields.

Old KB# 22575


Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
1 of 1
Last update:
‎2013-02-15 19:32
Updated by:
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.