Thursday 24 February 2011

working with web application Automation security alerts

While we are working with web application automation most of the times we got frustrated because of security pop windows ….

Here is the solution for disable all the security setting and enable it after your test completion
public WshShell
set obj=new Web_Settings
set WshShell=CreateObject("wscript.shell")
obj.Disablesettings()
msgbox "Disable"
'obj.Enablesettings()
msgbox "enabled"

class Web_Settings

Function Disablesettings()
'Disabling File Download – Information Bar
input=0
SettingCode="2200"
KeyPath="HKCU\Software\Microsoft\Windows\CurrentVersion\Internet
Settings\Zones"
for i=0 to 4
WshShell.RegWrite keyPath& "\" & Cint(i) & "\"&
SettingCode,input,"REG_DWORD"
next
'end Disabling File Download – Information Bar

'Disabling Active X Control  – Java Script Prompt
Settingcode="1400"
'KeyPath=”HKCU\Software\Microsoft\Windows\CurrentVersion\Interne
t Settings\Zones”
for i=0 to 4
WshShell.RegWrite keyPath& "\" & Cint(i) & "\"&
SettingCode,input,"REG_DWORD"
next
'end Disabling Active X Control  – Java Script Prompt

'Disabling Security Information  -Secure and Non secure item
Settingcode="1609"
for i=0 to 4
WshShell.RegWrite keyPath& "\" & Cint(i) & "\"&
SettingCode,input,"REG_DWORD"
next
'END Disabling Security Information  -Secure and Non secure item

'Disable Security pop-up Secure Connection
WshShell.RegWrite
"HKCU\software\microsoft\windows\CurrentVersion\Internet
Settings\WarnOnPost","no","REG_SZ"
'End Disable Security pop-up Secure Connection

'Disable Security pop-up Certificate Warning
WshShell.RegWrite
"HKCU\software\microsoft\windows\CurrentVersion\Internet
Settings\","no","REG_SZ"
'End Disable Security pop-up Certificate Warning

'Disable Security pop-up Redirection pop-up
WshShell.RegWrite
"HKCU\software\microsoft\windows\CurrentVersion\Internet
Settings\WarnOnPostRedirect","no","REG_SZ"
'END Disable Security pop-up Redirection pop-up

'Disabling Popup Blocker
popupkeyPath="HKCU\software\microsoft\internet explorer\New
windows\popupmgr"
Wshshell.regwrite popupkeyPath,"no","REG_SZ"
'Diable There is a problem with this website's security certificate
popupkeyPath="HKCU\SOFTWARE\Microsoft\Internet
Explorer\Main\FeatureControl\iexplore.exe"
Wshshell.regwrite popupkeyPath,1,"REG_DWORD"



'************** END *****************************************
End function

Function Enablesettings()
'Enabling File Download – Information Bar
input=3
SettingCode="2200"
KeyPath="HKCU\Software\Microsoft\Windows\CurrentVersion\Internet
Settings\Zones"
for i=0 to 4
WshShell.RegWrite keyPath& "\" & Cint(i) & "\"&
SettingCode,input,"REG_DWORD"
next
'end Enabling File Download – Information Bar

'Enabling Active X Control  – Java Script Prompt
Settingcode="1400"
'KeyPath=”HKCU\Software\Microsoft\Windows\CurrentVersion\Interne
t Settings\Zones”
for i=0 to 4
WshShell.RegWrite keyPath& "\" & Cint(i) & "\"&
SettingCode,input,"REG_DWORD"
next
'end Enabling Active X Control  – Java Script Prompt

'Enabling Security Information  -Secure and Non secure item
Settingcode="1609"
for i=0 to 4
WshShell.RegWrite keyPath& "\" & Cint(i) & "\"&
SettingCode,input,"REG_DWORD"
next
'END Enabling Security Information  -Secure and Non secure item

'Enable Security pop-up Secure Connection
WshShell.RegWrite
"HKCU\software\microsoft\windows\CurrentVersion\Internet
Settings\WarnOnPost","yes","REG_SZ"
'End Enable Security pop-up Secure Connection

'Enable Security pop-up Certificate Warning
WshShell.RegWrite
"HKCU\software\microsoft\windows\CurrentVersion\Internet
Settings\","yes","REG_SZ"
'End Enable Security pop-up Certificate Warning

'Enable Security pop-up Redirection pop-up
WshShell.RegWrite
"HKCU\software\microsoft\windows\CurrentVersion\Internet
Settings\WarnOnPostRedirect","yes","REG_SZ"
'END Enable Security pop-up Redirection pop-up

'Enabling Popup Blocker
popupkeyPath="HKCU\software\microsoft\internet explorer\New
windows\popupmgr"
Wshshell.regwrite popupkeyPath,"yes","REG_SZ"
''Enable There is a problem with this website's security certificate
popupkeyPath="HKCU\SOFTWARE\Microsoft\Internet
Explorer\Main\FeatureControl\iexplore.exe"
Wshshell.regwrite popupkeyPath,0,"REG_DWORD"
'************** END *****************************************
End function
End class

1 comment: