get_cookies() used to return the list of all cookies stored in the web browser.
# Go to the correct domain
driver.get("https://www.example.com")
# And now output all the available cookies for the current URL
driver.get_cookies()
get_cookie() used to return the specific cookie according to its name.
driver.get_cookie('foo')
add_cookie() method is used to create and add the cookie.
# Go to the correct domain
driver.get("https://chercher.tech")
# Now set the cookie. This one's valid for the entire domain
cookie = {‘name’ : ‘foo’, ‘value’ : ‘bar’}
driver.add_cookie(cookie)
Using delete_cookie() to delete a cookie according to its name.
driver.delete_cookie(“foo�)
delete_all_cookies() is used to delete all cookies.
driver.delete_all_cookies()
Article is written by Pavan (a) KarthiQ. Well, I am serving notice period in an MNC, Bangalore. I thought to enrich every person knowledge a little, I always have a feeling, when we teach something, we will learn more than what you know.
Knowledge is the only thing that doubles when you spend it.
I have also created the reporter for Protractor Jasmine. Use for your projects without any hesitation