selenium cookies code example
Example 1: how to handle cookies in selenium
There are several ways to handle cookies
driver.manage().getCookies();
driver.manage().getCookieNamed(arg0);
driver.manage().addCookie(arg0);
driver.manage().deleteCookie(arg0);
driver.manage().deleteCookieNamed(arg0);
driver.manage().deleteAllCookies();
Example 2: how to handle cookies in selenium
There are several ways to handle cookies
driver.manage().getCookies();
driver.manage().getCookieNamed(arg0);
driver.manage().addCookie(arg0);
driver.manage().deleteCookie(arg0);
driver.manage().deleteCookieNamed(arg0);
driver.manage().deleteAllCookies();
Example 3: how to handle cookie
To handle cookie in postman there is a button
called cookie to give us a way to add cookie
to certain domain by providing key+value pair
Once added any request sent to the same domain,
can access that cookie. We can also access to
the cookie in test tab.
pm.test('the "abc" cookie has correct value', function () {
pm.expect(pm.cookies.toObject()).to.have.property('abc', 'AWESOME');
});
pm.test('the "Motto" cookie has correct value', function () {
pm.expect(pm.cookies.toObject()).to.have.property('Motto', 'Hold your horse');
});