Cookies
Cookies are those small files on your computer that store information
between sessions or between two login attempts. There are valid reasons where
you might need to delete cookies stored on your computer through scripting.
The Function clears all cookies that are present on your HardDrive in
an Internet Transaction.
'#Function Logic: The function opens the Properties Window of Internet
Explorer & fires the Click Event for the Delete Cookies ' Button &
Delete Temporary Internet Files.
Call ClearCookies()
'*********************************************************************************
Function ClearCookies()
SystemUtil.Run "Control.exe","inetcpl.cpl"
Set objShell = CreateObject("Wscript.Shell")
Do Until Success = True
Success = objShell.AppActivate("Internet Properties")
Wait(1)
Loop
objShell.Sendkeys "%i"
Wait(1)
objShell.Sendkeys "{ENTER}"
Wait(1)
objShell.Sendkeys "%f"
Wait(1)
objShell.Sendkeys "%d"
Wait(1)
objShell.Sendkeys "{ENTER}"
Wait(4)
objShell.Sendkeys "{ENTER}"
End Function
'*********************************************************************************
WebUtil object is one of the undocumented object in QTP.
'Execute the Below statement before opening the browser to delete
cookies.
Webutil.DeleteCookies
'To clear temporary Internet files
Set WshShell = CreateObject("WScript.Shell")
WshShell.run "RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess
8"
'To Clear Browsing History
WshShell.run "RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess
1"
No comments:
Post a Comment