Reputation: 309
I need write functional for coded UI test, which disable popup, when open first time the browser Internet explorer. So how can I do this programmatically on c#? Is it need edit some register?
Upvotes: 4
Views: 130
Reputation: 7285
Based on http://www.petenetlive.com/KB/Article/0000175.htm we should set a registry key as:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Internet Explorer\Main] "DisableFirstRunCustomize"=dword:00000001
in C#, we should be able to do it like:
var key = Registry.LocalMachine.OpenSubKey("SOFTWARE", true)
.OpenSubKey("Policies", true)
.OpenSubKey("Microsoft", true);
key = key.OpenSubKey("Internet Explorer", true) ?? key.CreateSubKey("Internet Explorer", RegistryKeyPermissionCheck.ReadWriteSubTree);
key = key.OpenSubKey("Main", true) ?? key.CreateSubKey("Main", RegistryKeyPermissionCheck.ReadWriteSubTree);
key.SetValue("DisableFirstRunCustomize", 1, RegistryValueKind.DWord);
Upvotes: 1