Reading a Windows registry value from Selenium WebDriver

The WindowsUtils class provides various methods to interact with the registry on the Windows operating system. While running tests on the Windows operating system and Internet Explorer, the test might need to read and modify IE settings or there may be a need to get some settings related to the web server or database from the registry in tests. The WindowsUtils class comes handy in these situations.

In this recipe, we will use WindowsUtil to read the exact name of the operating system on which the test is running. We might need this information printed in our test logs.

How to do it...

We need to import the org.openqa.selenium.os.WindowsUtils class and use the readStringRegistryValue() method ...

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.