Deleting cookies

In the previous section, we created a new cookie for the yahoo.com domain with the name 'username'. We can also delete the same cookie simply by passing its name to the deleteCookie function:

if( phantom.deleteCookie('username') ) {
  console.log('Cookie deleted.'),
} else {
  console.log('Cookie not deleted or does not exist.'),
}

If the desired cookie is not present, the function will not generate any error, but it will return a false value. To clear all cookies, simply use the clearCookies function.

phantom.clearCookies();
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.22.9