-
Book Overview & Buying
-
Table Of Contents
Advanced UFT 12 for Test Engineers Cookbook
Reading registry keys and values is an important task. For example, it can assist us in testing the correctness of an application installation process, or in reading specific settings of applications or even operating system environment variables. In this recipe, we will see how to read the value of a key from the registry, specifically the Java Options environment variable.
From the File menu, navigate to New | Test or use the Ctrl + N shortcut.
The syntax to retrieve the value of a registry key is as follows:
Registry_ReadKey
Here, object is an instance of the Wscript.Shell class and sKeyPath, a valid key.
An example of how to retrieve the value of the _JAVA_OPTIONS environment variable is as shown in the following code snippet:
Dim oWshShell, sKeyVal, sKeyPath, sKeyExpected
sKeyPath = "HKEY_CURRENT_USER\Environment\_JAVA_OPTIONS"
Set oWshShell = CreateObject("Wscript.Shell")
sKeyVal = oWshShell.RegRead(sKeyPath)
Print...
Change the font size
Change margin width
Change background colour