Working with Cookies and caches Using WATiN 2.0

Release of WATiN 2.0 having work around with cookies and caches like
1. Clear cookies /caches
2. Get and set cookies

1. Clear cookies/caches
This functionality/method we can call any time during the live instance of an IE.
We need to call this method just after creating new instance of an IE.
Example: below code would clear cookies/caches just after creating new instance of an IE.

using(IE ie = new IE())
{
ie.ClearCache;
ie.ClearCookies;
ie.GoTo(“http://jawedmblogspot.com”);
}
Caution: if we call this method at later moment then the open instance of an IE still might have cached items in memory. To avoid this situation we need to use new IE.ReOpen() method. This method would close the previous open Instance and reopens new IE instances which solve our problem.

2. Get and set cookies
To manipulate Cookies and/or to read cookie information, IE.GetCookie() and IE.SetCookie are added.
using(IE ie = new IE(“http://jawedm.blogspot.com))
{
string setvalue = “test-cookie=abc; expires=Wed, 01-Jan-2020 00:00:00 GMT”;
ie.SetCookie(http://1.watin.com/“, setvalue);
string getvalue = ie.GetCookie(http://1.watin.com/”, “test-cookie”);
Assert.AreEqual(“test-cookie=abc”, getvalue);
}

for more information you can visit below website
http://watin.sourceforge.net/releasenotes-1-2-0-4000.html
Thanks!!!!

One thought on “Working with Cookies and caches Using WATiN 2.0

  1. Hi Everybody!

    I've been looking to figure out a place to begin with the Acai Berry free trial & was wanting to know if anybody had any thoughts on whether or not it works for dieting? So far here's the 1 [url=http://acaiberries.zoomblog.com/]article[/url] I have been able to check out that seemed realistic for what my goals are. Opinions?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s