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")); ...

Get Selenium Testing Tools Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.