.i).Delete
Cookie
ii).Delete Cookie with Name
iii).Delete All Cookies
ii).Delete Cookie with Name
iii).Delete All Cookies
Automation tester
can delete a cookie from the browser "cookie jar". Domain of the
cookie will be ignored.
Automation tester can
delete the named cookie from the current domain. It is an equivalent to setting
the named cookie's expiry date to sometime in the past.
Automation tester can
also delete all the cookies for the current domain using
driver.manage().deleteAllCookies();syntax.
ie:
Deleting the particular
cookie with cookie name "--utmbTest"
@Test
public void deleteCookieNamedExampleTest()
{
driver= new FirefoxDriver();
String URL="http://www.flipcart.com";// User your own site
driver.navigate().to(URL);
driver.manage().deleteCookieNamed("__utmbTest");
}
Deleting all the
cookies of the particular domain
@Test
public void deleteAllCookiesExample()
{
driver= new FirefoxDriver();
String URL="http://www.flipcart.com";
driver.navigate().to(URL);
driver.manage().deleteAllCookies();
}
No comments:
Post a Comment