Header Ads

How to Combat Cookie in VBScript?

HTTP cookies, more commonly referred to as Web cookies, tracking cookies or just cookies, are parcels of text sent by a server to a Web client (usually a browser) and then sent back unchanged by the client each time it accesses that server. HTTP cookies are used for authenticating, session tracking (state maintenance), and maintaining specific information about users, such as site preferences or the contents of their electronic shopping carts. The term "cookie" is derived from "magic cookie," a well-known concept in UNIX computing which inspired both the idea and the name of HTTP cookies.

Because they can be used for tracking browsing behavior, cookies have been of concern for Internet privacy. As a result, they have been subject to legislation in various countries such as the United States, as well as the European Union. Cookies have also been criticized because the identification of users they provide is not always accurate and because they could potentially be a target of network attackers. Some alternatives to cookies exist, but each has its own uses, advantages, and drawbacks.
Cookies are also subject to a number of misconceptions, mostly based on the erroneous notion that they are computer programs. In fact, cookies are simple pieces of data unable to perform any operation by themselves. In particular, they are neither spyware nor viruses, although cookies from certain sites are described as spyware by many anti-spyware products because they allow users to be tracked when they visit various sites.
Most modern browsers allow users to decide whether to accept cookies, but rejection makes some websites unusable. For example, shopping carts implemented using cookies do not work if cookies are rejected.

The recent Method to delete cookie through QTP is webutil.DeleteCookies..
This is a unpublished function of QTP. However it is working fine as of right now. But it is highly recommended that before using this command Testers need to cheek its adoptability with the script.

We have some old method too…
WebUtil.DeleteCookies: We can use this command to those scenarios where we can close the browser completely. Means if we are using this command, we need to make sure not a single IEExplorer in opened in the task manager. If a single IEExplorer is opened in the task manager this command will not work as it can not kill the session and the temp folder will be in read only mode. The objective is not fulfilled.
Secondly, it can not handle such cookies which are written in a log file or in a .txt format ...what i mean those browsers who handles cookie in different way like..Opera etc
Imagine a situation where the demo is displayed over sametime meeting-room or WebEx meeting which requires an/two active webpage(s) needs to be opened (i.e. IE-Explorer). The command will fail in those scenarios. Or it will close the sharing window (browsers) which may create a noise to the viewer level.

The other old method might take a few seconds more but will not arise such situation.

Sub netCacheClear()
systemutil.Run "iExplore.exe",sURL
set WshShell = CreateObject("WScript.Shell")
WshShell.Sendkeys "%"+"{T}"
set WshShell = Nothing
set WshShell = CreateObject("WScript.Shell")
WshShell.Sendkeys "{o}"
set WshShell = Nothing
wait(1)
set WshShell = CreateObject("WScript.Shell")
WshShell.Sendkeys "%"+"{i}"
set WshShell = Nothing
wait(1)
set WshShell = CreateObject("WScript.Shell")
WshShell.Sendkeys "{Enter}"
set WshShell = Nothing
set WshShell = CreateObject("WScript.Shell")
WshShell.Sendkeys "%"+"{f}"
set WshShell = Nothing
wait(1)
set WshShell = CreateObject("WScript.Shell")
WshShell.Sendkeys "^"+"{d}"
set WshShell = Nothing
wait(1)
set WshShell = CreateObject("WScript.Shell")
WshShell.Sendkeys "{Enter}"
set WshShell = Nothing
wait(1)
set WshShell = CreateObject("WScript.Shell")
WshShell.Sendkeys "%"+"{h}"
set shShell = Nothing
wait(1)
set WshShell = CreateObject("WScript.Shell")
WshShell.Sendkeys "{Tab}"
set WshShell = Nothing
wait(1)
set WshShell = CreateObject("WScript.Shell")
WshShell.Sendkeys "{Enter}"
set WshShell = Nothing
set WshShell = CreateObject("WScript.Shell")
WshShell.Sendkeys "{Enter}"
set WshShell = Nothing
End sub



Let me know your views as well.




Powered by Blogger.