public void CheckRegistryKeyExist() { string regKey = @"HKEY_LOCAL_MACHINE/SOFTWARE/Dell/Dell Help & Support"; // open regedit Keyboard.Press("{LWin down}r{LWin up}"); Delay.Milliseconds(1000); Keyboard.Press("regedit"); Delay.Milliseconds(200); Keyboard.Press("{Return}"); Delay.Milliseconds(200); // click Computer Root Item TreeItem parentKey = repo.RegistryEditor.Computer.FindSingle("."); ExpandRegTreeItem(parentKey); // split path into item string[] key = regKey.Split('/'); Report.Info("Check the Registry items of DHS"); for (int i = 0; i < key.Count(); i++) { // select & open child key string childKeyXpath = @"./treeitem[@text='" + key[i] + "']"; TreeItem childKey = null; try{ childKey = parentKey.FindSingle(childKeyXpath); } catch (ElementNotFoundException) { // report failure Report.Log(ReportLevel.Failure, "Registry KEY not found: " + key[i]); break; } childKey.Click(); ExpandRegTreeItem(childKey); Delay.Milliseconds(500); parentKey = childKey; if (i == key.Count() - 1) { // report success Report.Log(ReportLevel.Success, "Registry KEY found: " + regKey); } } // close registry window repo.RegistryEditor.Close.Click(); }