Modifying a Windows registry value from Selenium WebDriver
The WindowsUtils
class also provides methods to update existing Windows registry values or create new registry keys and values. Similar to reading registry values, WindowsUtils
class provides multiple methods to modify keys and values.
In this recipe, we will use the WindowsUtils
class to create a new registry key with a string value.
How to do it...
Use the writeStringRegistryValue()
method for modifying existing Windows registry value or creating a new key and value represented as a string.
WindowsUtils.writeStringRegistryValue("HKEY_CURRENT_USER\\SOFTWARE\\Selenium\\SeleniumVersion", "2.24"); assertEquals("2.24",WindowsUtils.readStringRegistryValue("HKEY_CURRENT_USER\\SOFTWARE\\Selenium\\SeleniumVersion"));
How it works...
When the writeStringRegistryValue()
method is executed along with the path, a new registry key will be created in HKEY_CURRENT_USER\SOFTWARE
with Selenium and a new value will be stored in SeleniumVersion
.
WindowsUtils...